Skip to main content

json_eq

Function json_eq 

Source
pub fn json_eq<'a, L, R>(
    left: L,
    field: &'a str,
    value: R,
) -> SQL<'a, SQLiteValue<'a>>
where L: ToSQL<'a, SQLiteValue<'a>>, R: Into<SQLiteValue<'a>>,
Expand description

Builds left ->> field = value: the JSON field field equals value.

field may be a key name ("theme") or a JSON path ("$.theme").

ยงExamples

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