diesel::pg::expression::dsl

Function multirange_merge

Source
pub fn multirange_merge<R: MultirangeOrNullableMultirange + SingleValue, multirange>(
    multirange: multirange,
) -> multirange_merge<R, multirange>
where multirange: AsExpression<R>,
Available on crate feature postgres_backend only.
Expand description

Returns the smallest range which includes all ranges in the multirange

ยงExample

let int = diesel::select(multirange_merge::<Multirange<Integer>, _>(vec![1..3, 7..10])).get_result::<(Bound<i32>, Bound<i32>)>(connection)?;
assert_eq!((Bound::Included(1), Bound::Excluded(10)), int);

let int = diesel::select(multirange_merge::<Nullable<Multirange<Integer>>, _>(None::<Vec<std::ops::Range<i32>>>)).get_result::<Option<(Bound<i32>, Bound<i32>)>>(connection)?;
assert_eq!(None, int);