Skip to main content

json_get_idx

Function json_get_idx 

Source
pub fn json_get_idx<'a, E>(
    expr: E,
    index: i32,
) -> SQLExpr<'a, PostgresValue<'a>, Json, Null, Scalar>
where E: Expr<'a, PostgresValue<'a>>,
Expand description

PostgreSQL -> operator with integer index - get JSON array element.

ยงExample

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