RecordId
A RecordId uniquely identifies a record in SurrealDB. It consists of a table name and an ID value. The ID can be a long, String, UUID, or a composite key using Array or Object. See the SurrealQL record ID documentation for details on how record identifiers work in SurrealDB.
Source: surrealdb.java
Constructors
RecordId(String table, long id)
Creates a record ID with a numeric identifier.
| Parameter | Type | Description |
|---|---|---|
table | String | The table name. |
id | long | The numeric record identifier. |
RecordId(String table, String id)
Creates a record ID with a string identifier.
| Parameter | Type | Description |
|---|---|---|
table | String | The table name. |
id | String | The string record identifier. |
RecordId(String table, UUID id)
Creates a record ID with a UUID identifier.
| Parameter | Type | Description |
|---|---|---|
table | String | The table name. |
id | UUID | The UUID record identifier. |
RecordId(String table, Array id)
Creates a record ID with a composite key using an array.
| Parameter | Type | Description |
|---|---|---|
table | String | The table name. |
id | Array | The composite key as an array. |
RecordId(String table, Object id)
Creates a record ID with a composite key using an object.
| Parameter | Type | Description |
|---|---|---|
table | String | The table name. |
id | Object | The composite key as an object. |
Methods
.getTable()
Returns the table name of this record ID.
Returns: String
.getId()
Returns the identifier part of this record ID.
Returns: Id
Id
The Id class represents the identifier part of a RecordId. It wraps the underlying value and provides type checking and extraction methods.
Static Factory Methods
Id.from(long id)
Creates an Id from a numeric value.
| Parameter | Type | Description |
|---|---|---|
id | long | The numeric identifier. |
Returns: Id
Id.from(String id)
Creates an Id from a string value.
| Parameter | Type | Description |
|---|---|---|
id | String | The string identifier. |
Returns: Id
Id.from(UUID id)
Creates an Id from a UUID value.
| Parameter | Type | Description |
|---|---|---|
id | UUID | The UUID identifier. |
Returns: Id
Type Checking Methods
| Method | Returns true when |
|---|---|
isLong() | The ID is a numeric value |
isString() | The ID is a string value |
isUuid() | The ID is a UUID value |
isArray() | The ID is a composite array key |
isObject() | The ID is a composite object key |
Getter Methods
| Method | Return Type | Description |
|---|---|---|
getLong() | long | Returns the numeric ID value |
getString() | String | Returns the string ID value |
getUuid() | UUID | Returns the UUID ID value |
getArray() | Array | Returns the composite array key |
getObject() | Object | Returns the composite object key |
RecordIdRange
The RecordIdRange class represents a range of record IDs within a table. It can be used with methods like select to retrieve a subset of records.
Constructor
RecordIdRange(String table, Id start, Id end)
Creates a range of record IDs. Pass null for start or end to leave that bound open.
| Parameter | Type | Description |
|---|---|---|
table | String | The table name. |
start | Id | The start of the range. Pass null for an unbounded start. |
end | Id | The end of the range. Pass null for an unbounded end. |
Methods
.getTable()
Returns the table name of this range.
Returns: String
.getStart()
Returns the start bound of the range, or null if unbounded.
Returns: Id (nullable)
.getEnd()
Returns the end bound of the range, or null if unbounded.
Returns: Id (nullable)
Example
See Also
Value — The Value class reference
Surreal — Connection and method reference
Data manipulation — Working with records
SurrealQL record IDs — Record identifier formats and types