fn overlaps_with<T>(self, other: T) -> dsl::OverlapsWith<Self, T>
    where
        Self::SqlType: SqlType,
        T: AsExpression<Self::SqlType>,
    {
        Grouped(OverlapsWith::new(self, other.as_expression()))
    }
/// Creates a PostgreSQL `&&` expression.
///
/// This operator returns whether two arrays have common elements.
///
/// # Example
///
/// ```rust
/// # include!("../../doctest_setup.rs");
/// #
/// # table! {
/// #     posts {
/// #         id -> Integer,
/// #         tags -> Array<VarChar>,
/// #     }
/// # }
/// #
/// # fn main() {
/// #     run_test().unwrap();
/// # }
/// #
/// # fn run_test() -> QueryResult<()> {
/// #     use self::posts::dsl::*;
/// #     let conn = &mut establish_connection();
/// #     conn.execute("DROP TABLE IF EXISTS posts").unwrap();
/// #     conn.execute("CREATE TABLE posts (id SERIAL PRIMARY KEY, tags TEXT[] NOT NULL)").unwrap();
/// #
/// diesel::insert_into(posts)
///     .values(&vec![
///         tags.eq(vec!["cool", "awesome"]),
///         tags.eq(vec!["awesome", "great"]),
///         tags.eq(vec!["cool", "great"]),
///     ])
///     .execute(conn)?;
///
/// let data = posts.select(id)
///     .filter(tags.overlaps_with(vec!["horrid", "cool"]))
///     .load::<i32>(conn)?;
/// assert_eq!(vec![1, 3], data);
///
/// let data = posts.select(id)
///     .filter(tags.overlaps_with(vec!["cool", "great"]))
///     .load::<i32>(conn)?;
/// assert_eq!(vec![1, 2, 3], data);
///
/// let data = posts.select(id)
///     .filter(tags.overlaps_with(vec!["horrid"]))
///     .load::<i32>(conn)?;
/// assert!(data.is_empty());
/// #     Ok(())
/// # }
/// ```
Creates a PostgreSQL `&&` expression.
This operator returns whether two arrays have common elements.
Creates a PostgreSQL ` && ` expression . This operator returns whether two arrays have common elements .
fn overlaps_with<T>(self, other: T) -> dsl::OverlapsWith<Self, T>
    where
        Self::SqlType: SqlType,
        T: AsExpression<Self::SqlType>,
    {
        Grouped(OverlapsWith::new(self, other.as_expression()))
    }
fn overlaps_with < T > ( self , other : T ) -> dsl :: OverlapsWith < Self , T > where Self :: SqlType : SqlType , T : AsExpression < Self :: SqlType > , { Grouped ( OverlapsWith :: new ( self , other . as_expression ( ) ) ) }
Creates a PostgreSQL `&&` expression.
Creates a PostgreSQL ` && ` expression .
self
other
T
self
other
T
example
None
include!("../../doctest_setup.rs");
None
table! {
None
posts {
None
id -> integer,
None
tags -> array<varchar>,
None
}
None
}
None
fn main() {
None
run_test().unwrap();
None
}
None
fn run_test() -> queryresult<()> {
None
use self::posts::dsl::*;
None
let conn = &mut establish_connection();
None
conn.execute("drop table if exists posts").unwrap();
None
conn.execute("create table posts (id serial primary key, tags text[] not null)").unwrap();


let data = posts.select(id)
.filter(tags.overlaps_with(vec!["horrid", "cool"]))
.load::(conn)?;
assert_eq!(vec![1, 3], data).

let data = posts.select(id)
.filter(tags.overlaps_with(vec!["cool", "great"]))
.load::(conn)?;
assert_eq!(vec![1, 2, 3], data).

let data = posts.select(id)
.filter(tags.overlaps_with(vec!["horrid"]))
.load::(conn)?;
assert!(data.is_empty()).
let data = posts . select ( id ) . filter ( tags . overlaps_with ( vec! [ " horrid " " cool " ] )) . load :: ( conn ) ? ; assert_eq! ( vec! [ 1 3 ] data ) . let data = posts . select ( id ) . filter ( tags . overlaps_with ( vec! [ " cool " " great " ] )) . load :: ( conn ) ? ; assert_eq! ( vec! [ 1 2 3 ] data ) . let data = posts . select ( id ) . filter ( tags . overlaps_with ( vec! [ " horrid " ] )) . load :: ( conn ) ? ; assert! ( data . is_empty () ) .
ok(())
None
}
None