Skip to main content

json_get

Function json_get 

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

PostgreSQL -> operator - get JSON object field by key, returns JSON.

ยงExample

let data = SQL::<PostgresValue>::raw("data");
let field = json_get(data, "name");
assert!(field.to_sql().sql().contains("->"));