Skip to main content

json_extract

Function json_extract 

Source
pub fn json_extract<'a, L>(
    left: L,
    path: impl AsRef<str>,
) -> SQL<'a, SQLiteValue<'a>>
where L: ToSQL<'a, SQLiteValue<'a>>,
Expand description

Builds left ->> path, which returns the value at path as an SQL value (TEXT, INTEGER, REAL or NULL).

path may be a key name or a JSON path. Use json_extract_text to get JSON text instead.

ยงExamples

let column = SQL::<SQLiteValue>::raw("metadata");
let extract_expr = json_extract(column, "theme");
assert_eq!(extract_expr.sql(), "metadata ->> ?");