Skip to main content

json_to_any_value

Function json_to_any_value 

Source
pub fn json_to_any_value(
    value: &Value,
    declared: AnyTypeInfoKind,
) -> AnyValueKind<'static>
Expand description

Converts a form-submitted value (already parsed as loose JSON, the same “try JSON, fall back to a plain string” idea larust_db::parse_cli_value uses for the KV store) into the shape bind_any needs - driven by the column’s declared type, not the JSON value’s own shape. This matters concretely: this schema (like most SQLite-first apps) stores booleans and timestamps as plain INTEGER, never a native BOOLEAN/TIMESTAMP column, so a checkbox posting true for such a column must become AnyValueKind::BigInt(1), not AnyValueKind::Bool(true) - binding the wrong kind against an INTEGER column is exactly the mistake this function exists to avoid.