Skip to main content

json_to_sql

Function json_to_sql 

Source
pub fn json_to_sql(
    ty: FieldType,
    case: Option<TextCase>,
    v: &Value,
) -> Result<Value, String>
Expand description

Convert a JSON value into a typed SQL value for the given column type. Returns a human-readable error on a type mismatch (surfaced as a 400).

case forces a text value’s case before it is stored, so the column holds one spelling of a code rather than however many the callers typed.