diesel::pg::expression::dsl

Function array_dims

Source
pub fn array_dims<Arr: ArrayOrNullableArray + SingleValue, arr>(
    arr: arr,
) -> array_dims<Arr, arr>
where arr: AsExpression<Arr>,
Available on crate feature postgres_backend only.
Expand description

Returns a text representation of the array’s dimensions

§Example


let dims = diesel::select(array_dims::<Array<Integer>,_>(vec![1,2]))
    .get_result::<String>(connection)?;
assert!(String::from("[1:2]").eq(&dims));

let dims = diesel::select(array_dims::<Array<Nullable<Integer>>,_>(vec![None::<i32>,Some(2)]))
    .get_result::<String>(connection)?;
assert!(String::from("[1:2]").eq(&dims));

let dims = diesel::select(array_dims::<Array<Nullable<Integer>>,_>(vec![None::<i32>]))
    .get_result::<String>(connection)?;
assert!(String::from("[1:1]").eq(&dims));