Skip to main content

jsonb_contained

Function jsonb_contained 

Source
pub fn jsonb_contained<'a, L, R>(
    left: L,
    right: R,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>
where L: Expr<'a, PostgresValue<'a>>, R: ToSQL<'a, PostgresValue<'a>>,
Expand description

PostgreSQL <@ operator for JSONB - left JSON is contained by right JSON.

ยงExample

let data = SQL::<PostgresValue>::raw("data");
let cond = jsonb_contained(data, r#"{"key": "value", "other": 1}"#);
assert!(cond.to_sql().sql().contains("<@"));