pub enum SqlValue {
Null,
Boolean(bool),
Integer(i64),
Real(f64),
Text(String),
Blob(Vec<u8>),
Json(String),
}Expand description
A single SQL value. Boolean is carried as a distinct class (so a guest can
express one and a strictly-typed engine could bind a native BOOL); libsql,
being SQLite-family, maps it to 0/1.
Variants§
Null
SQL NULL.
Boolean(bool)
A boolean (a native BOOL where the engine has one, else 0/1).
Integer(i64)
A 64-bit signed integer.
Real(f64)
A 64-bit float.
Text(String)
UTF-8 text.
Blob(Vec<u8>)
A byte string.
Json(String)
A JSON document (its JSON text) — the portable “JSON document” value, bound to
each engine’s canonical document type: jsonb on Postgres (validated,
canonical, operator- and index-capable), the binary JSON type on MySQL, text
(json1) on SQLite. So a guest writes a jsonb/JSON column with no :: cast,
AND the value type-unifies with such a column in COALESCE/comparison/||,
not only on INSERT. Note Postgres jsonb validates on write (malformed JSON is
rejected). Postgres’s raw-text json type is out of the portable model — use
raw SQL with an explicit ::json cast for it. Read back as
Text (the engines stringify JSON on the way out).