Function diesel::pg::expression::functions::array_ndims

source ·
pub fn array_ndims<Arr: ArrayOrNullableArray + SingleValue + MaybeNullableValue<Integer>, arr>(
    arr: arr,
) -> array_ndims<Arr, arr>
where arr: AsExpression<Arr>,
Available on crate feature postgres_backend only.
Expand description

Returns the number of dimensions of the array

§Example


 // diesel currently only supports 1D arrays
let dims = diesel::select(array_ndims::<Array<Integer>, _>(vec![1, 2]))
    .get_result::<i32>(connection)?;
assert_eq!(1, dims);

let dims = diesel::select(array_ndims::<Nullable<Array<Integer>>, _>(None::<Vec<i32>>))
    .get_result::<Option<i32>>(connection)?;
assert_eq!(None, dims);