[][src]Trait diesel::prelude::PgRangeExpressionMethods

pub trait PgRangeExpressionMethods: Expression + Sized {
    fn contains<T>(self, other: T) -> Contains<Self, T::Expression>
    where
        Self::SqlType: RangeHelper,
        T: AsExpression<<Self::SqlType as RangeHelper>::Inner>
, { ... } }

PostgreSQL specific methods present on range expressions.

Provided methods

fn contains<T>(self, other: T) -> Contains<Self, T::Expression> where
    Self::SqlType: RangeHelper,
    T: AsExpression<<Self::SqlType as RangeHelper>::Inner>, 

Creates a PostgreSQL @> expression.

This operator returns whether a range contains an specific element

Example

diesel::insert_into(posts)
    .values(versions.eq((Bound::Included(5), Bound::Unbounded)))
    .execute(&conn)?;

let cool_posts = posts.select(id)
    .filter(versions.contains(42))
    .load::<i32>(&conn)?;
assert_eq!(vec![1], cool_posts);

let amazing_posts = posts.select(id)
    .filter(versions.contains(1))
    .load::<i32>(&conn)?;
assert!(amazing_posts.is_empty());
Loading content...

Implementors

impl<T, ST> PgRangeExpressionMethods for T where
    T: Expression<SqlType = Range<ST>>, 
[src]

Loading content...