The Kotlin SDK represents data with kotlinx.serialization JSON values, plus a small set of dedicated types for referring to tables and records. These are the building blocks passed to the CRUD builders and queries.
Record and table types
| Type | Description |
|---|---|
Table | Refers to a table by name |
RecordId | Refers to a single record (table:id) |
RecordIdRange | Refers to a range of records within a table |
When these are bound into a query, the SDK renders them with the appropriate SurrealDB casting functions — type::table(name) for a Table and type::record(table, id) for a RecordId — so values are always passed safely.
The JSON value model
Beyond the record types above, all data is modelled as JsonElement. Read methods return a JsonElement, and write methods accept a JsonObject. Build payloads with buildJsonObject.
Note
Learn more
Table,RecordId, andRecordIdRangereferencesValue (JSON model) reference
Serialization for decoding into your own types