package granary
Module Granary_encoding.RowSource
Row schema and value (de)serialisation.
Defines column types (ty), DEFAULT/CHECK/GENERATED column metadata (column, schema) and the runtime cell values of a row (t), plus the binary encode/decode of a row against its schema.
type column = {name : string;ty : ty;not_null : bool;primary_key : bool;pk_desc : bool;(*#312: this PK column was declared
*)PRIMARY KEY DESC. A single-column INTEGER PK withpk_desc = trueis a NON-alias (hidden rowid + implicit__pkunique index), matching SQLite. Only meaningful whenprimary_keyis set.default : default_value option;check_sql : string option;generated_as : (string * bool) option;(*Some (expr_sql, is_stored): GENERATED ALWAYS AS expr. is_stored=true => STORED; false => VIRTUAL (both computed at write time).
*)
}encode schema row serialises row to its on-disk byte representation according to schema.
decode schema bytes reconstructs a row from its on-disk representation according to schema.
decode_prefix schema bytes ~upto decodes only columns 0, upto; columns beyond upto are left V_null and never decoded/allocated (#247). Use only when no consumer reads a column index > upto — it skips trailing columns (e.g. a large TEXT payload) an aggregate over a column prefix never needs. Columns in 0, upto are identical to decode.