diesel::pg::expression::dsl

Function array_lower

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

Returns the lower bound of the requested array

This function returns null for dimensions that do not exist

ยงExample

let result = diesel::select(array_lower::<Array<Integer>, _, _>(vec![1, 2, 3], 1))
    .get_result::<Option<i32>>(connection)?;
assert_eq!(Some(1), result);

// the array has only one dimension
let result = diesel::select(array_lower::<Array<Integer>, _, _>(vec![1, 2, 3], 2))
    .get_result::<Option<i32>>(connection)?;
assert_eq!(None, result);