Types Reference
This section provides comprehensive documentation for all field types supported by SOM. Each type includes its Go definition, SurrealDB schema, available filter operations, sorting capabilities, and practical examples.
Quick Reference
Type Categories
Primitive Types
Basic Go types with direct database mapping:
String - Text data with extensive string operations
Numeric - Integers and floating-point numbers
Bool - Boolean true/false values
Byte - Single bytes and binary data
Time Types
Temporal data with special CBOR encoding:
Special Types
Types with validation or special handling:
UUID - Universally unique identifiers
URL - Web addresses with component parsing
Email - Email addresses with validation
Enum - Constrained string values
Complex Types
Composite and reference types:
Universal Operations
All types support these base filter operations:
Pointer Types (Optional Fields)
All types support pointer variants for optional fields:
Pointer types add nil-checking operations:
CBOR Encoding
SOM uses CBOR (Concise Binary Object Representation) for efficient database communication. Most types use direct CBOR encoding, but some require special handling:
DateTime
12
[unix_seconds, nanoseconds]
Duration
14
[seconds, nanoseconds]
UUID
37
Binary (16 bytes)
Sorting
Most types support ascending and descending sort:
Not sortable: Slice, Node, Struct (use nested field sorting instead)
Method Chaining
Many filter operations return new filters, enabling powerful chains:
Schema Generation
SOM generates SurrealDB schema definitions for each field:
Last updated