s is a drop-in for Zod’s z that also records a SurrealQL type for each field. Use it anywhere you would use z. This page lists every builder and the TYPE it emits in DDL. For the conceptual side, see from schema to DDL; for the full type-by-type matrix with support status, see type mapping.
Primitives
Primitives
s.*SurrealQL TYPEDESCRIPTION
s.string()stringA UTF-8 string.
s.boolean()boolA boolean.
s.number()numberAny numeric value; use int/float for a specific kind.
s.literal(v)<value>An exact literal value.
s.enum([...])<a> | <b> | …A union of string literals.
Numbers
s.int, s.float, and friends share Zod’s numeric base; the format decides the SurrealQL type.
Numbers
s.*SurrealQL TYPEDESCRIPTION
s.int()intAn integer.
s.float()floatA floating-point number.
s.int32()intA 32-bit integer (validated in app).
s.uint32()intAn unsigned 32-bit integer (validated in app).
s.bigint()intA bigint, stored as a SurrealDB int.
s.decimal()decimalAn arbitrary-precision Decimal (native, no conversion).
Native SurrealDB types
These map to SurrealDB’s built-in types. datetime, uuid, and bytes convert between app and wire values (see codecs); the rest pass through as their SDK class.