# 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.

## Record identifiers

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

```python
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.

## Scalar types

<table>
    <thead>
        <tr>
            <th colspan="2" scope="col">Type</th>
            <th colspan="2" scope="col">Fields</th>
            <th colspan="2" scope="col">Description</th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td colspan="2" scope="row" data-label="Type"><code>Uuid</code></td>
            <td colspan="2" scope="row" data-label="Fields"><code>value</code></td>
            <td colspan="2" scope="row" data-label="Description">A UUID string.</td>
        </tr>
        <tr>
            <td colspan="2" scope="row" data-label="Type"><code>DateTime</code></td>
            <td colspan="2" scope="row" data-label="Fields"><code>seconds</code>, <code>nanos</code></td>
            <td colspan="2" scope="row" data-label="Description">A point in time, split into seconds and nanoseconds.</td>
        </tr>
        <tr>
            <td colspan="2" scope="row" data-label="Type"><code>Duration</code></td>
            <td colspan="2" scope="row" data-label="Fields"><code>seconds</code>, <code>nanos</code></td>
            <td colspan="2" scope="row" data-label="Description">A length of time.</td>
        </tr>
        <tr>
            <td colspan="2" scope="row" data-label="Type"><code>Decimal</code></td>
            <td colspan="2" scope="row" data-label="Fields"><code>value</code></td>
            <td colspan="2" scope="row" data-label="Description">An arbitrary-precision decimal, held as a string.</td>
        </tr>
        <tr>
            <td colspan="2" scope="row" data-label="Type"><code>FileRef</code></td>
            <td colspan="2" scope="row" data-label="Fields"><code>bucket</code>, <code>key</code></td>
            <td colspan="2" scope="row" data-label="Description">A reference to a file in a bucket.</td>
        </tr>
        <tr>
            <td colspan="2" scope="row" data-label="Type"><code>SurrealSet</code></td>
            <td colspan="2" scope="row" data-label="Fields"><code>items</code></td>
            <td colspan="2" scope="row" data-label="Description">A set of values.</td>
        </tr>
        <tr>
            <td colspan="2" scope="row" data-label="Type"><code>FutureValue</code></td>
            <td colspan="2" scope="row" data-label="Fields"><code>body</code></td>
            <td colspan="2" scope="row" data-label="Description">A computed (future) value, held as its expression body.</td>
        </tr>
    </tbody>
</table>

## Ranges

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.

## Geometry

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.

```python
from surrealdb import GeometryPoint

var here = GeometryPoint(-0.118092, 51.509865)
```
