githubEdit

Custom Types

SOM provides custom types for common patterns that aren't covered by Go's standard library.

som.Enum

Enums provide type-safe enumerated values. See Enums for detailed documentation.

type Status string

const (
    StatusActive   Status = "active"
    StatusInactive Status = "inactive"
)

func (s Status) Enum() {}

som.Email

Type-safe email addresses with filter support:

type User struct {
    som.Node[som.ULID]
    Email som.Email
}

Filter operations:

som.Password

Secure password handling with automatic hashing. Passwords are hashed using the specified algorithm before being stored in SurrealDB, and are never returned in query results.

Supported Algorithms

Algorithm
Type
Notes

som.Bcrypt

Bcrypt

Widely used, good default

som.Argon2

Argon2id

Most secure, memory-hard

som.Pbkdf2

PBKDF2

NIST recommended

som.Scrypt

Scrypt

Memory-hard alternative

Generated Schema

som.SemVer

Semantic version strings with comparison and component extraction:

Filter operations:

Geometry Types

SOM supports geometry types from three popular Go libraries:

paulmach/orb

peterstace/simplefeatures

twpayne/go-geom

Supported Geometry Types

All three libraries support:

Type
Description

Point

Single coordinate

LineString

Series of connected points

Polygon

Closed shape

MultiPoint

Collection of points

MultiLineString

Collection of line strings

MultiPolygon

Collection of polygons

GeometryCollection

Mixed geometry collection

Slices

All custom types support slice usage:

Last updated