diesel::pg::expression::dsl

Function upper_inc

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

Returns true if the range’s upper bound is inclusive

§Example

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

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

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