server/schema library
Schema primitives: data types, columns, constraints, table schema.
Classes
- CheckConstraint
- ColumnDef
- A single column definition.
- ForeignKeyConstraint
- ForeignKeyRef
- Foreign key reference target.
- PrimaryKeyConstraint
- TableConstraint
- Table-level constraint (composite PK, multi-column UNIQUE, table CHECK, table-level FOREIGN KEY).
- UniqueConstraint
Enums
- DataType
- Supported SQL data types.
Constants
- kBlobJsonTag → const String
-
Sentinel key used to encode BLOB values when serialising rows to JSON
(both for on-disk persistence and the wire protocol). A BLOB is written
as
{"$blob": "<lowercase hex>"}so it round-trips losslessly and is distinguishable from a regularList<int>. -
kStrictAllowedTypeNames
→ const Set<
String> -
Set of declared type names (lower case) accepted by
STRICTtables. Matches SQLite: INT, INTEGER, REAL, TEXT, BLOB, ANY.
Functions
-
coerce(
Object? value, DataType type) → Object? -
Coerce a raw value (from parser literal or client JSON) into the storage
representation for
type, or throw FormatException if it cannot. -
dataTypeName(
DataType t) → String -
jsonValueToStorage(
Object? v) → Object? -
Reverse of storageToJsonValue: decode a value coming out of
jsonDecodeback to its in-memory storage form. Tagged BLOB sentinels becomeUint8List. -
parseDataType(
String s) → DataType - Parse a raw type token using SQLite's affinity rules. Unknown / empty declarations don't throw — they get NUMERIC affinity (or BLOB when completely empty), matching what real-world DDL relies on.
-
storageToJsonValue(
Object? v) → Object? -
Encode any Dart value coming out of the engine into a form
jsonEncodewill accept and that jsonValueToStorage can losslessly reverse.