Skip to main content

json_get_text

Function json_get_text 

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

PostgreSQL ->> operator - get JSON object field as text.

ยงExample

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