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>> + ToSQL<'a, SQLiteValue<'a>>,
Expand description

Create a JSON field equality condition using SQLite ->> operator

ยงExample

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