Record functions
Note
These functions can be used to retrieve specific metadata from a SurrealDB Record ID.
| Function | Description |
|---|---|
record::exists() | Checks to see if a SurrealDB Record ID exists |
record::id() | Extracts and returns the identifier from a SurrealDB Record ID |
record::tb() | Extracts and returns the table name from a SurrealDB Record ID |
record::refs() | Extracts and returns the record IDs of any records that have a record link along with a REFERENCES clause |
record::is_edge() | Identifies whether the value passed in is a graph edge |
record::exists
The record::exists function checks to see if a given record exists.
A simple example showing the output of this function when a record does not exist and when it does:
A longer example of record::exists using method syntax:
record::id
The record::id function extracts and returns the identifier from a SurrealDB Record ID.
The following example shows this function, and its output, when used in a RETURN statement:
record::tb
The record::tb function extracts and returns the table name from a SurrealDB Record ID.
The following example shows this function, and its output, when used in a RETURN statement:
record::is_edge
The record::is_edge function checks to see if the value passed in is a graph edge.
Method chaining
Method chaining allows functions to be called using the . dot operator on a value of a certain type instead of the full path of the function followed by the value.
This is particularly useful for readability when a function is called multiple times.