Skip to main content

jsonb_exists_key

Function jsonb_exists_key 

Source
pub fn jsonb_exists_key<'a, E>(
    expr: E,
    key: &'a str,
) -> SQLExpr<'a, PostgresValue<'a>, Boolean, NonNull, Scalar>
where E: Expr<'a, PostgresValue<'a>>,
Expand description

PostgreSQL ? operator for JSONB - does the key exist in the JSON object?

ยงExample

let data = SQL::<PostgresValue>::raw("data");
let cond = jsonb_exists_key(data, "name");
assert!(cond.to_sql().sql().contains("?"));