• Start

Languages

/

Mojo

/

Concepts

Value types

The SurrealDB tagged value types that the Mojo SDK encodes and decodes.

The Mojo SDK ships CBOR encoders and decoders for the SurrealDB tagged value types. These types live in the surrealdb.value module and map directly onto the values SurrealDB stores and returns.

A RecordId pairs a table with a record key. Its to_string() returns the canonical table:id form.

from surrealdb import RecordId, Table

var id = RecordId(Table("person"), "chiru")
print(id.to_string()) # person:chiru

Table wraps a table name on its own.

TypeFieldsDescription
UuidvalueA UUID string.
DateTimeseconds, nanosA point in time, split into seconds and nanoseconds.
Durationseconds, nanosA length of time.
DecimalvalueAn arbitrary-precision decimal, held as a string.
FileRefbucket, keyA reference to a file in a bucket.
SurrealSetitemsA set of values.
FutureValuebodyA computed (future) value, held as its expression body.

A RangeValue describes a bounded range. Its bounds are BoundIncluded or BoundExcluded, set on the begin_included, begin_excluded, end_included, and end_excluded fields.

The SDK models the full GeoJSON family:

  • GeometryPoint with longitude and latitude.

  • GeometryLine and GeometryPolygon.

  • GeometryMultiPoint, GeometryMultiLine, and GeometryMultiPolygon.

  • GeometryCollection, holding points, lines, and polygons together.

from surrealdb import GeometryPoint

var here = GeometryPoint(-0.118092, 51.509865)

Was this page helpful?