Trait diesel::query_dsl::CombineDsl[][src]

pub trait CombineDsl {
    type Query: Query;
    fn union<Rhs>(self, rhs: Rhs) -> Union<Self, Rhs>
    where
        Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>
;
fn union_all<Rhs>(self, rhs: Rhs) -> UnionAll<Self, Rhs>
    where
        Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>
;
fn intersect<Rhs>(self, rhs: Rhs) -> Intersect<Self, Rhs>
    where
        Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>
;
fn intersect_all<Rhs>(self, rhs: Rhs) -> IntersectAll<Self, Rhs>
    where
        Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>
;
fn except<Rhs>(self, rhs: Rhs) -> Except<Self, Rhs>
    where
        Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>
;
fn except_all<Rhs>(self, rhs: Rhs) -> ExceptAll<Self, Rhs>
    where
        Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>
; }

Extension trait to combine queries using a combinator like UNION, INTERSECT or EXPECT with or without ALL rule for duplicates

Associated Types

type Query: Query[src]

What kind of query does this type represent?

Loading content...

Required methods

fn union<Rhs>(self, rhs: Rhs) -> Union<Self, Rhs> where
    Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>, 
[src]

Combine two queries using a SQL UNION

Examples

let data = users.select(user_name.nullable())
    .union(animals.select(animal_name).filter(animal_name.is_not_null()))
    .load(connection);

let expected_data = vec![
    Some(String::from("Jack")),
    Some(String::from("Sean")),
    Some(String::from("Tess")),
];
assert_eq!(Ok(expected_data), data);

fn union_all<Rhs>(self, rhs: Rhs) -> UnionAll<Self, Rhs> where
    Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>, 
[src]

Combine two queries using a SQL UNION ALL

fn intersect<Rhs>(self, rhs: Rhs) -> Intersect<Self, Rhs> where
    Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>, 
[src]

Combine two queries using a SQL INTERSECT

fn intersect_all<Rhs>(self, rhs: Rhs) -> IntersectAll<Self, Rhs> where
    Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>, 
[src]

Combine two queries using a SQL INTERSECT ALL

fn except<Rhs>(self, rhs: Rhs) -> Except<Self, Rhs> where
    Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>, 
[src]

Combine two queries using a SQL EXCEPT

fn except_all<Rhs>(self, rhs: Rhs) -> ExceptAll<Self, Rhs> where
    Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>, 
[src]

Combine two queries using a SQL EXCEPT ALL

Loading content...

Implementors

impl<T: Table> CombineDsl for T[src]

type Query = T::Query

Loading content...