Trait rocket_db_pools::diesel::prelude::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§
Required Methods§
sourcefn union<Rhs>(
self,
rhs: Rhs,
) -> CombinationClause<Union, Distinct, Self::Query, <Rhs as AsQuery>::Query>
fn union<Rhs>( self, rhs: Rhs, ) -> CombinationClause<Union, Distinct, Self::Query, <Rhs as AsQuery>::Query>
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);
sourcefn union_all<Rhs>(
self,
rhs: Rhs,
) -> CombinationClause<Union, All, Self::Query, <Rhs as AsQuery>::Query>
fn union_all<Rhs>( self, rhs: Rhs, ) -> CombinationClause<Union, All, Self::Query, <Rhs as AsQuery>::Query>
Combine two queries using a SQL UNION ALL
sourcefn intersect<Rhs>(
self,
rhs: Rhs,
) -> CombinationClause<Intersect, Distinct, Self::Query, <Rhs as AsQuery>::Query>
fn intersect<Rhs>( self, rhs: Rhs, ) -> CombinationClause<Intersect, Distinct, Self::Query, <Rhs as AsQuery>::Query>
Combine two queries using a SQL INTERSECT
sourcefn intersect_all<Rhs>(
self,
rhs: Rhs,
) -> CombinationClause<Intersect, All, Self::Query, <Rhs as AsQuery>::Query>
fn intersect_all<Rhs>( self, rhs: Rhs, ) -> CombinationClause<Intersect, All, Self::Query, <Rhs as AsQuery>::Query>
Combine two queries using a SQL INTERSECT ALL
Object Safety§
This trait is not object safe.