Skip to main content

CombineDsl

Trait CombineDsl 

Source
pub trait CombineDsl {
    type Query: Query;

    // Required methods
    fn union<Rhs>(
        self,
        rhs: Rhs,
    ) -> CombinationClause<Union, Distinct, Self::Query, <Rhs as AsQuery>::Query>
       where Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>;
    fn union_all<Rhs>(
        self,
        rhs: Rhs,
    ) -> CombinationClause<Union, All, Self::Query, <Rhs as AsQuery>::Query>
       where Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>;
    fn intersect<Rhs>(
        self,
        rhs: Rhs,
    ) -> CombinationClause<Intersect, Distinct, Self::Query, <Rhs as AsQuery>::Query>
       where Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>;
    fn intersect_all<Rhs>(
        self,
        rhs: Rhs,
    ) -> CombinationClause<Intersect, All, Self::Query, <Rhs as AsQuery>::Query>
       where Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>;
    fn except<Rhs>(
        self,
        rhs: Rhs,
    ) -> CombinationClause<Except, Distinct, Self::Query, <Rhs as AsQuery>::Query>
       where Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>;
    fn except_all<Rhs>(
        self,
        rhs: Rhs,
    ) -> CombinationClause<Except, All, Self::Query, <Rhs as AsQuery>::Query>
       where Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>;
}
Expand description

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

Required Associated Types§

Source

type Query: Query

What kind of query does this type represent?

Required Methods§

Source

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

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);
Source

fn union_all<Rhs>( self, rhs: Rhs, ) -> CombinationClause<Union, All, Self::Query, <Rhs as AsQuery>::Query>
where Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>,

Combine two queries using a SQL UNION ALL

Source

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

Combine two queries using a SQL INTERSECT

Source

fn intersect_all<Rhs>( self, rhs: Rhs, ) -> CombinationClause<Intersect, All, Self::Query, <Rhs as AsQuery>::Query>
where Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>,

Combine two queries using a SQL INTERSECT ALL

Source

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

Combine two queries using a SQL EXCEPT

Source

fn except_all<Rhs>( self, rhs: Rhs, ) -> CombinationClause<Except, All, Self::Query, <Rhs as AsQuery>::Query>
where Rhs: AsQuery<SqlType = <Self::Query as Query>::SqlType>,

Combine two queries using a SQL EXCEPT ALL

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F, S, D, W, O, LOf, G, H, LC> CombineDsl for SelectStatement<F, S, D, W, O, LOf, G, H, LC>
where SelectStatement<F, S, D, W, O, LOf, G, H, LC>: Query,

Source§

type Query = SelectStatement<F, S, D, W, O, LOf, G, H, LC>

Source§

impl<S> CombineDsl for Alias<S>

Source§

impl<ST, QS, DB, GB> CombineDsl for BoxedCloneSelectStatement<'_, ST, QS, DB, GB>
where BoxedCloneSelectStatement<'_, ST, QS, DB, GB>: Query,

Source§

type Query = BoxedCloneSelectStatement<'_, ST, QS, DB, GB>

Source§

impl<ST, QS, DB, GB> CombineDsl for BoxedSelectStatement<'_, ST, QS, DB, GB>
where BoxedSelectStatement<'_, ST, QS, DB, GB>: Query,

Source§

type Query = BoxedSelectStatement<'_, ST, QS, DB, GB>

Source§

impl<T> CombineDsl for T
where T: QueryRelation,

Source§

type Query = <T as AsQuery>::Query