pub fn json_get_text_idx<'a, E>(
expr: E,
index: i32,
) -> SQLExpr<'a, PostgresValue<'a>, Text, Null, E::Aggregate, E::Sources>Expand description
Gets an array element by zero-based index as text (->>).
The operand must be json or jsonb (JsonType). The result is NULL
when the index is out of range.
ยงExamples
use drizzle_postgres::expr::json_get_text_idx;
use drizzle_core::{ToSQL, expr::raw_non_null};
use drizzle_postgres::values::PostgresValue;
use drizzle_types::postgres::types::Jsonb;
let data = raw_non_null::<PostgresValue, Jsonb>("data");
let first = json_get_text_idx(data, 0);
assert_eq!(first.to_sql().sql(), "data ->> CAST ($1 AS INTEGER)");