Skip to main content

Module check

Module check 

Source
Expand description

Evaluation of table/column check constraints.

Kit check constraints are stored as serializable expression strings (the TypeScript kit uses JS functions at the API layer, but the conformance fixtures and cross-language schema serialize a string grammar). This module implements a small, deterministic evaluator for that grammar so Rust, Python, and TypeScript enforce the same constraints.

Supported grammar:

expr       := or_expr
or_expr    := and_expr ( ("OR" | "||") and_expr )*
and_expr   := not_expr ( ("AND" | "&&") not_expr )*
not_expr   := ("NOT" | "!") not_expr | atom
atom       := "(" or_expr ")" | comparison
comparison := operand OP operand
operand    := column | number | string | bool | null
OP         := "=" | "==" | "!=" | "<>" | "<" | "<=" | ">" | ">="

Evaluation follows SQL three-valued logic: a check is only violated when it evaluates to a definite false. NULL/unknown comparisons pass.

Structs§

CheckParseError
Error produced when a check expression cannot be parsed.

Functions§

eval_check
Evaluate a check expression against a row.