diesel::pg::expression::dsl

Function upper_inf

Source
pub fn upper_inf<R: MultirangeOrRangeMaybeNullable + SingleValue + MaybeNullableValue<Bool>, range>(
    range: range,
) -> upper_inf<R, range>
where range: AsExpression<R>,
Available on crate feature postgres_backend only.
Expand description

Returns true if the range’s upper bound is unbounded

§Example

let int = diesel::select(upper_inf::<Range<Integer>,  _>(1..5)).get_result::<bool>(connection)?;
assert_eq!(false, int);

let int = diesel::select(upper_inf::<Range<Integer>,  _>(1..)).get_result::<bool>(connection)?;
assert_eq!(true, int);

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

let int = diesel::select(upper_inf::<Multirange<Integer>, _>(vec![5..7])).get_result::<bool>(connection)?;
assert_eq!(false, int);