#[non_exhaustive]pub struct SelectStatement<From, Select = DefaultSelectClause<From>, Distinct = NoDistinctClause, Where = NoWhereClause, Order = NoOrderClause, LimitOffset = LimitOffsetClause<NoLimitClause, NoOffsetClause>, GroupBy = NoGroupByClause, Having = NoHavingClause, Locking = NoLockingClause> {
pub select: Select,
pub from: From,
pub distinct: Distinct,
pub where_clause: Where,
pub order: Order,
pub limit_offset: LimitOffset,
pub group_by: GroupBy,
pub having: Having,
pub locking: Locking,
}
Available on crate feature
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.Expand description
This type represents a select query
Using this type directly is only meaningful for custom backends
that need to provide a custom QueryFragment
implementation
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.select: Select
The select clause of the query
from: From
The from clause of the query
distinct: Distinct
The distinct clause of the query
where_clause: Where
The where clause of the query
order: Order
The order clause of the query
limit_offset: LimitOffset
The combined limit/offset clause of the query
group_by: GroupBy
The group by clause of the query
having: Having
The having clause of the query
locking: Locking
The locking clause of the query
Trait Implementations§
Source§impl<From, T> AppearsInFromClause<T> for SelectStatement<From>where
From: AsQuerySource,
From::QuerySource: AppearsInFromClause<T> + QuerySource,
Allow SelectStatement<From>
to act as if it were From
as long as
no other query methods have been called on it
impl<From, T> AppearsInFromClause<T> for SelectStatement<From>where
From: AsQuerySource,
From::QuerySource: AppearsInFromClause<T> + QuerySource,
Allow SelectStatement<From>
to act as if it were From
as long as
no other query methods have been called on it
Source§type Count = <<From as AsQuerySource>::QuerySource as AppearsInFromClause<T>>::Count
type Count = <<From as AsQuerySource>::QuerySource as AppearsInFromClause<T>>::Count
How many times does
Self
appear in QS
?Source§impl<ST, F, S, D, W, O, LOf, G, H, LC> AsInExpression<ST> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>
impl<ST, F, S, D, W, O, LOf, G, H, LC> AsInExpression<ST> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>
Source§type InExpression = Subselect<SelectStatement<F, S, D, W, O, LOf, G, H, LC>, ST>
type InExpression = Subselect<SelectStatement<F, S, D, W, O, LOf, G, H, LC>, ST>
Type of the expression returned by AsInExpression::as_in_expression
Source§fn as_in_expression(self) -> Self::InExpression
fn as_in_expression(self) -> Self::InExpression
Construct the diesel query dsl representation of
the
IN (values)
clause for the given typeSource§impl<'a, S, D, W, O, LOf, G, H, DB> BoxedDsl<'a, DB> for SelectStatement<NoFromClause, S, D, W, O, LOf, G, H>where
Self: AsQuery,
DB: Backend,
S: SelectClauseExpression<NoFromClause> + QueryFragment<DB> + Send + 'a,
S::Selection: ValidGrouping<G::Expressions>,
D: QueryFragment<DB> + Send + 'a,
W: Into<BoxedWhereClause<'a, DB>>,
O: Into<Option<Box<dyn QueryFragment<DB> + Send + 'a>>>,
LOf: IntoBoxedClause<'a, DB, BoxedClause = BoxedLimitOffsetClause<'a, DB>>,
G: ValidGroupByClause + QueryFragment<DB> + Send + 'a,
H: QueryFragment<DB> + Send + 'a,
impl<'a, S, D, W, O, LOf, G, H, DB> BoxedDsl<'a, DB> for SelectStatement<NoFromClause, S, D, W, O, LOf, G, H>where
Self: AsQuery,
DB: Backend,
S: SelectClauseExpression<NoFromClause> + QueryFragment<DB> + Send + 'a,
S::Selection: ValidGrouping<G::Expressions>,
D: QueryFragment<DB> + Send + 'a,
W: Into<BoxedWhereClause<'a, DB>>,
O: Into<Option<Box<dyn QueryFragment<DB> + Send + 'a>>>,
LOf: IntoBoxedClause<'a, DB, BoxedClause = BoxedLimitOffsetClause<'a, DB>>,
G: ValidGroupByClause + QueryFragment<DB> + Send + 'a,
H: QueryFragment<DB> + Send + 'a,
Source§type Output = BoxedSelectStatement<'a, <S as SelectClauseExpression<NoFromClause>>::SelectClauseSqlType, NoFromClause, DB, <G as ValidGroupByClause>::Expressions>
type Output = BoxedSelectStatement<'a, <S as SelectClauseExpression<NoFromClause>>::SelectClauseSqlType, NoFromClause, DB, <G as ValidGroupByClause>::Expressions>
The return type of
internal_into_boxed
Source§fn internal_into_boxed(self) -> Self::Output
fn internal_into_boxed(self) -> Self::Output
See the trait documentation.
Source§impl<From: Clone, Select: Clone, Distinct: Clone, Where: Clone, Order: Clone, LimitOffset: Clone, GroupBy: Clone, Having: Clone, Locking: Clone> Clone for SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>
impl<From: Clone, Select: Clone, Distinct: Clone, Where: Clone, Order: Clone, LimitOffset: Clone, GroupBy: Clone, Having: Clone, Locking: Clone> Clone for SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>
Source§fn clone(
&self,
) -> SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>
fn clone( &self, ) -> SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<F, S, D, W, O, LOf, G, H, LC> CombineDsl for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
Self: Query,
impl<F, S, D, W, O, LOf, G, H, LC> CombineDsl for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
Self: Query,
Source§type Query = SelectStatement<F, S, D, W, O, LOf, G, H, LC>
type Query = SelectStatement<F, S, D, W, O, LOf, G, H, LC>
What kind of query does this type represent?
Source§fn union<Rhs>(self, rhs: Rhs) -> Union<Self, Rhs>
fn union<Rhs>(self, rhs: Rhs) -> Union<Self, Rhs>
Combine two queries using a SQL
UNION
Read moreSource§fn union_all<Rhs>(self, rhs: Rhs) -> UnionAll<Self, Rhs>
fn union_all<Rhs>(self, rhs: Rhs) -> UnionAll<Self, Rhs>
Combine two queries using a SQL
UNION ALL
Source§fn intersect<Rhs>(self, rhs: Rhs) -> Intersect<Self, Rhs>
fn intersect<Rhs>(self, rhs: Rhs) -> Intersect<Self, Rhs>
Combine two queries using a SQL
INTERSECT
Source§fn intersect_all<Rhs>(self, rhs: Rhs) -> IntersectAll<Self, Rhs>
fn intersect_all<Rhs>(self, rhs: Rhs) -> IntersectAll<Self, Rhs>
Combine two queries using a SQL
INTERSECT ALL
Source§impl<From: Debug, Select: Debug, Distinct: Debug, Where: Debug, Order: Debug, LimitOffset: Debug, GroupBy: Debug, Having: Debug, Locking: Debug> Debug for SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>
impl<From: Debug, Select: Debug, Distinct: Debug, Where: Debug, Order: Debug, LimitOffset: Debug, GroupBy: Debug, Having: Debug, Locking: Debug> Debug for SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>
Source§impl<ST, F, S, D, W, O, LOf, G, H> DistinctDsl for SelectStatement<F, S, D, W, O, LOf, G, H>where
Self: SelectQuery<SqlType = ST>,
SelectStatement<F, S, DistinctClause, W, O, LOf, G, H>: SelectQuery<SqlType = ST>,
impl<ST, F, S, D, W, O, LOf, G, H> DistinctDsl for SelectStatement<F, S, D, W, O, LOf, G, H>where
Self: SelectQuery<SqlType = ST>,
SelectStatement<F, S, DistinctClause, W, O, LOf, G, H>: SelectQuery<SqlType = ST>,
Source§impl<F, S, D, W, O, LOf, G, H, LC, Predicate> FilterDsl<Predicate> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
Predicate: Expression + NonAggregate,
Predicate::SqlType: BoolOrNullableBool,
W: WhereAnd<Predicate>,
impl<F, S, D, W, O, LOf, G, H, LC, Predicate> FilterDsl<Predicate> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
Predicate: Expression + NonAggregate,
Predicate::SqlType: BoolOrNullableBool,
W: WhereAnd<Predicate>,
Source§impl<F, S, D, W, O, LOf, G, H, Expr> GroupByDsl<Expr> for SelectStatement<F, S, D, W, O, LOf, G, H>where
SelectStatement<F, S, D, W, O, LOf, GroupByClause<Expr>, H>: SelectQuery,
Expr: Expression + AppearsOnTable<F>,
impl<F, S, D, W, O, LOf, G, H, Expr> GroupByDsl<Expr> for SelectStatement<F, S, D, W, O, LOf, G, H>where
SelectStatement<F, S, D, W, O, LOf, GroupByClause<Expr>, H>: SelectQuery,
Expr: Expression + AppearsOnTable<F>,
Source§impl<F, S, D, W, O, LOf, G, H, LC, Tab> Insertable<Tab> for &SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
Tab: Table,
Self: Query,
<Tab::AllColumns as ValidGrouping<()>>::IsAggregate: MixedAggregates<No, Output = No>,
impl<F, S, D, W, O, LOf, G, H, LC, Tab> Insertable<Tab> for &SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
Tab: Table,
Self: Query,
<Tab::AllColumns as ValidGrouping<()>>::IsAggregate: MixedAggregates<No, Output = No>,
Source§type Values = InsertFromSelect<&SelectStatement<F, S, D, W, O, LOf, G, H, LC>, <Tab as Table>::AllColumns>
type Values = InsertFromSelect<&SelectStatement<F, S, D, W, O, LOf, G, H, LC>, <Tab as Table>::AllColumns>
The
VALUES
clause to insert these records Read moreSource§fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>
fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>
Insert
self
into a given table. Read moreSource§impl<F, S, D, W, O, LOf, G, H, LC, Tab> Insertable<Tab> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
Tab: Table,
Self: Query,
<Tab::AllColumns as ValidGrouping<()>>::IsAggregate: MixedAggregates<No, Output = No>,
impl<F, S, D, W, O, LOf, G, H, LC, Tab> Insertable<Tab> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
Tab: Table,
Self: Query,
<Tab::AllColumns as ValidGrouping<()>>::IsAggregate: MixedAggregates<No, Output = No>,
Source§type Values = InsertFromSelect<SelectStatement<F, S, D, W, O, LOf, G, H, LC>, <Tab as Table>::AllColumns>
type Values = InsertFromSelect<SelectStatement<F, S, D, W, O, LOf, G, H, LC>, <Tab as Table>::AllColumns>
The
VALUES
clause to insert these records Read moreSource§fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>
fn insert_into(self, table: T) -> InsertStatement<T, Self::Values>
Insert
self
into a given table. Read moreSource§impl<ST, F, S, D, W, O, LOf, G, H, LC> IntoArrayExpression<ST> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
ST: SqlType + TypedExpressionType,
ArraySubselect<Self, ST>: Expression<SqlType = Array<ST>>,
Self: SelectQuery<SqlType = ST>,
Available on crate feature postgres_backend
only.
impl<ST, F, S, D, W, O, LOf, G, H, LC> IntoArrayExpression<ST> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
ST: SqlType + TypedExpressionType,
ArraySubselect<Self, ST>: Expression<SqlType = Array<ST>>,
Self: SelectQuery<SqlType = ST>,
Available on crate feature
postgres_backend
only.Source§type ArrayExpression = ArraySubselect<SelectStatement<F, S, D, W, O, LOf, G, H, LC>, ST>
type ArrayExpression = ArraySubselect<SelectStatement<F, S, D, W, O, LOf, G, H, LC>, ST>
Type of the expression returned by [AsArrayExpression::as_in_expression]
Source§fn into_array_expression(self) -> Self::ArrayExpression
fn into_array_expression(self) -> Self::ArrayExpression
Construct the diesel query dsl representation of
the
ARRAY (values)
clause for the given typeSource§impl<ST, F, S, D, W, O, L, Of, G, H, LC> LimitDsl for SelectStatement<F, S, D, W, O, LimitOffsetClause<L, Of>, G, H, LC>where
Self: SelectQuery<SqlType = ST>,
SelectStatement<F, S, D, W, O, LimitOffsetClause<LimitClause<AsExprOf<i64, BigInt>>, Of>, G, H, LC>: SelectQuery<SqlType = ST>,
impl<ST, F, S, D, W, O, L, Of, G, H, LC> LimitDsl for SelectStatement<F, S, D, W, O, LimitOffsetClause<L, Of>, G, H, LC>where
Self: SelectQuery<SqlType = ST>,
SelectStatement<F, S, D, W, O, LimitOffsetClause<LimitClause<AsExprOf<i64, BigInt>>, Of>, G, H, LC>: SelectQuery<SqlType = ST>,
Source§type Output = SelectStatement<F, S, D, W, O, LimitOffsetClause<LimitClause<<i64 as AsExpression<BigInt>>::Expression>, Of>, G, H, LC>
type Output = SelectStatement<F, S, D, W, O, LimitOffsetClause<LimitClause<<i64 as AsExpression<BigInt>>::Expression>, Of>, G, H, LC>
The type returned by
.limit
Source§impl<F, S, W, O, LOf, Lock> LockingDsl<Lock> for SelectStatement<F, S, NoDistinctClause, W, O, LOf>
impl<F, S, W, O, LOf, Lock> LockingDsl<Lock> for SelectStatement<F, S, NoDistinctClause, W, O, LOf>
Source§type Output = SelectStatement<F, S, NoDistinctClause, W, O, LOf, NoGroupByClause, NoHavingClause, LockingClause<Lock>>
type Output = SelectStatement<F, S, NoDistinctClause, W, O, LOf, NoGroupByClause, NoHavingClause, LockingClause<Lock>>
The type returned by
set_lock
. See dsl::ForUpdate
and friends for
convenient access to this type.Source§impl<F, S, D, W, O, LOf, G, H, LC, LM, Modifier> ModifyLockDsl<Modifier> for SelectStatement<F, S, D, W, O, LOf, G, H, LockingClause<LC, LM>>
impl<F, S, D, W, O, LOf, G, H, LC, LM, Modifier> ModifyLockDsl<Modifier> for SelectStatement<F, S, D, W, O, LOf, G, H, LockingClause<LC, LM>>
Source§type Output = SelectStatement<F, S, D, W, O, LOf, G, H, LockingClause<LC, Modifier>>
type Output = SelectStatement<F, S, D, W, O, LOf, G, H, LockingClause<LC, Modifier>>
The type returned by
modify_lock
. See dsl::SkipLocked
and friends
for convenient access to this type.Source§fn modify_lock(self, modifier: Modifier) -> Self::Output
fn modify_lock(self, modifier: Modifier) -> Self::Output
See the trait level documentation
Source§impl<ST, F, S, D, W, O, L, Of, G, H, LC> OffsetDsl for SelectStatement<F, S, D, W, O, LimitOffsetClause<L, Of>, G, H, LC>where
Self: SelectQuery<SqlType = ST>,
SelectStatement<F, S, D, W, O, LimitOffsetClause<L, OffsetClause<AsExprOf<i64, BigInt>>>, G, H, LC>: SelectQuery<SqlType = ST>,
impl<ST, F, S, D, W, O, L, Of, G, H, LC> OffsetDsl for SelectStatement<F, S, D, W, O, LimitOffsetClause<L, Of>, G, H, LC>where
Self: SelectQuery<SqlType = ST>,
SelectStatement<F, S, D, W, O, LimitOffsetClause<L, OffsetClause<AsExprOf<i64, BigInt>>>, G, H, LC>: SelectQuery<SqlType = ST>,
Source§type Output = SelectStatement<F, S, D, W, O, LimitOffsetClause<L, OffsetClause<<i64 as AsExpression<BigInt>>::Expression>>, G, H, LC>
type Output = SelectStatement<F, S, D, W, O, LimitOffsetClause<L, OffsetClause<<i64 as AsExpression<BigInt>>::Expression>>, G, H, LC>
The type returned by
.offset
.Source§impl<F, S, D, W, O, LOf, G, H, LC, Predicate> OrFilterDsl<Predicate> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
Predicate: Expression + NonAggregate,
Predicate::SqlType: BoolOrNullableBool,
W: WhereOr<Predicate>,
impl<F, S, D, W, O, LOf, G, H, LC, Predicate> OrFilterDsl<Predicate> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
Predicate: Expression + NonAggregate,
Predicate::SqlType: BoolOrNullableBool,
W: WhereOr<Predicate>,
Source§impl<F, S, D, W, O, LOf, G, H, LC> Query for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
G: ValidGroupByClause,
S: SelectClauseExpression<F>,
S::Selection: ValidGrouping<G::Expressions>,
W: ValidWhereClause<F>,
impl<F, S, D, W, O, LOf, G, H, LC> Query for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
G: ValidGroupByClause,
S: SelectClauseExpression<F>,
S::Selection: ValidGrouping<G::Expressions>,
W: ValidWhereClause<F>,
Source§type SqlType = <S as SelectClauseExpression<F>>::SelectClauseSqlType
type SqlType = <S as SelectClauseExpression<F>>::SelectClauseSqlType
The SQL type that this query represents. Read more
Source§impl<F, S, D, W, O, LOf, G, H, LC> QueryDsl for SelectStatement<F, S, D, W, O, LOf, G, H, LC>
impl<F, S, D, W, O, LOf, G, H, LC> QueryDsl for SelectStatement<F, S, D, W, O, LOf, G, H, LC>
Source§fn distinct(self) -> Distinct<Self>where
Self: DistinctDsl,
fn distinct(self) -> Distinct<Self>where
Self: DistinctDsl,
Adds the
DISTINCT
keyword to a query. Read moreSource§fn distinct_on<Expr>(self, expr: Expr) -> DistinctOn<Self, Expr>where
Self: DistinctOnDsl<Expr>,
fn distinct_on<Expr>(self, expr: Expr) -> DistinctOn<Self, Expr>where
Self: DistinctOnDsl<Expr>,
Available on crate feature
postgres_backend
only.Adds the
DISTINCT ON
clause to a query. Read moreSource§fn select<Selection>(self, selection: Selection) -> Select<Self, Selection>where
Selection: Expression,
Self: SelectDsl<Selection>,
fn select<Selection>(self, selection: Selection) -> Select<Self, Selection>where
Selection: Expression,
Self: SelectDsl<Selection>,
Adds a
SELECT
clause to the query. Read moreSource§fn count(self) -> Select<Self, CountStar>
fn count(self) -> Select<Self, CountStar>
Get the count of a query. This is equivalent to
.select(count_star())
Read moreSource§fn inner_join<Rhs>(self, rhs: Rhs) -> InnerJoin<Self, Rhs>where
Self: JoinWithImplicitOnClause<Rhs, Inner>,
fn inner_join<Rhs>(self, rhs: Rhs) -> InnerJoin<Self, Rhs>where
Self: JoinWithImplicitOnClause<Rhs, Inner>,
Join two tables using a SQL
INNER JOIN
. Read moreSource§fn left_outer_join<Rhs>(self, rhs: Rhs) -> LeftJoin<Self, Rhs>where
Self: JoinWithImplicitOnClause<Rhs, LeftOuter>,
fn left_outer_join<Rhs>(self, rhs: Rhs) -> LeftJoin<Self, Rhs>where
Self: JoinWithImplicitOnClause<Rhs, LeftOuter>,
Join two tables using a SQL
LEFT OUTER JOIN
. Read moreSource§fn left_join<Rhs>(self, rhs: Rhs) -> LeftJoin<Self, Rhs>where
Self: JoinWithImplicitOnClause<Rhs, LeftOuter>,
fn left_join<Rhs>(self, rhs: Rhs) -> LeftJoin<Self, Rhs>where
Self: JoinWithImplicitOnClause<Rhs, LeftOuter>,
Alias for
left_outer_join
.Source§fn filter<Predicate>(self, predicate: Predicate) -> Filter<Self, Predicate>where
Self: FilterDsl<Predicate>,
fn filter<Predicate>(self, predicate: Predicate) -> Filter<Self, Predicate>where
Self: FilterDsl<Predicate>,
Adds to the
WHERE
clause of a query. Read moreSource§fn or_filter<Predicate>(self, predicate: Predicate) -> OrFilter<Self, Predicate>where
Self: OrFilterDsl<Predicate>,
fn or_filter<Predicate>(self, predicate: Predicate) -> OrFilter<Self, Predicate>where
Self: OrFilterDsl<Predicate>,
Source§fn find<PK>(self, id: PK) -> Find<Self, PK>where
Self: FindDsl<PK>,
fn find<PK>(self, id: PK) -> Find<Self, PK>where
Self: FindDsl<PK>,
Attempts to find a single record from the given table by primary key. Read more
Source§fn order<Expr>(self, expr: Expr) -> Order<Self, Expr>where
Expr: Expression,
Self: OrderDsl<Expr>,
fn order<Expr>(self, expr: Expr) -> Order<Self, Expr>where
Expr: Expression,
Self: OrderDsl<Expr>,
Sets the order clause of a query. Read more
Source§fn order_by<Expr>(self, expr: Expr) -> OrderBy<Self, Expr>where
Expr: Expression,
Self: OrderDsl<Expr>,
fn order_by<Expr>(self, expr: Expr) -> OrderBy<Self, Expr>where
Expr: Expression,
Self: OrderDsl<Expr>,
Alias for
order
Source§fn then_order_by<Order>(self, order: Order) -> ThenOrderBy<Self, Order>where
Self: ThenOrderDsl<Order>,
fn then_order_by<Order>(self, order: Order) -> ThenOrderBy<Self, Order>where
Self: ThenOrderDsl<Order>,
Appends to the
ORDER BY
clause of this SQL query. Read moreSource§fn limit(self, limit: i64) -> Limit<Self>where
Self: LimitDsl,
fn limit(self, limit: i64) -> Limit<Self>where
Self: LimitDsl,
Sets the limit clause of the query. Read more
Source§fn offset(self, offset: i64) -> Offset<Self>where
Self: OffsetDsl,
fn offset(self, offset: i64) -> Offset<Self>where
Self: OffsetDsl,
Sets the offset clause of the query. Read more
Source§fn group_by<GB>(self, group_by: GB) -> GroupBy<Self, GB>where
GB: Expression,
Self: GroupByDsl<GB>,
fn group_by<GB>(self, group_by: GB) -> GroupBy<Self, GB>where
GB: Expression,
Self: GroupByDsl<GB>,
Sets the
group by
clause of a query. Read moreSource§fn having<Predicate>(self, predicate: Predicate) -> Having<Self, Predicate>where
Self: HavingDsl<Predicate>,
fn having<Predicate>(self, predicate: Predicate) -> Having<Self, Predicate>where
Self: HavingDsl<Predicate>,
Adds to the
HAVING
clause of a query. Read moreSource§fn for_update(self) -> ForUpdate<Self>where
Self: LockingDsl<ForUpdate>,
fn for_update(self) -> ForUpdate<Self>where
Self: LockingDsl<ForUpdate>,
Adds
FOR UPDATE
to the end of the select statement. Read moreSource§fn for_no_key_update(self) -> ForNoKeyUpdate<Self>where
Self: LockingDsl<ForNoKeyUpdate>,
fn for_no_key_update(self) -> ForNoKeyUpdate<Self>where
Self: LockingDsl<ForNoKeyUpdate>,
Adds
FOR NO KEY UPDATE
to the end of the select statement. Read moreAdds
FOR SHARE
to the end of the select statement. Read moreAdds
FOR KEY SHARE
to the end of the select statement. Read moreSource§fn skip_locked(self) -> SkipLocked<Self>where
Self: ModifyLockDsl<SkipLocked>,
fn skip_locked(self) -> SkipLocked<Self>where
Self: ModifyLockDsl<SkipLocked>,
Source§fn no_wait(self) -> NoWait<Self>where
Self: ModifyLockDsl<NoWait>,
fn no_wait(self) -> NoWait<Self>where
Self: ModifyLockDsl<NoWait>,
Source§fn into_boxed<'a, DB>(self) -> IntoBoxed<'a, Self, DB>
fn into_boxed<'a, DB>(self) -> IntoBoxed<'a, Self, DB>
Boxes the pieces of a query into a single type. Read more
Source§fn single_value(self) -> SingleValue<Self>where
Self: SingleValueDsl,
fn single_value(self) -> SingleValue<Self>where
Self: SingleValueDsl,
Wraps this select statement in parenthesis, allowing it to be used
as an expression. Read more
Source§fn nullable(self) -> NullableSelect<Self>where
Self: SelectNullableDsl,
fn nullable(self) -> NullableSelect<Self>where
Self: SelectNullableDsl,
Coerce the SQL type of the select clause to it’s nullable equivalent. Read more
Source§impl<F, S, D, W, O, LOf, G, H, LC, DB> QueryFragment<DB> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>
impl<F, S, D, W, O, LOf, G, H, LC, DB> QueryFragment<DB> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>
Source§fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>
fn walk_ast<'b>(&'b self, pass: AstPass<'_, 'b, DB>) -> QueryResult<()>
Walk over this
QueryFragment
for all passes. Read moreSource§fn to_sql(&self, out: &mut DB::QueryBuilder, backend: &DB) -> QueryResult<()>
fn to_sql(&self, out: &mut DB::QueryBuilder, backend: &DB) -> QueryResult<()>
Available on crate feature
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.Converts this
QueryFragment
to its SQL representation. Read moreSource§fn collect_binds<'b>(
&'b self,
out: &mut DB::BindCollector<'b>,
metadata_lookup: &mut DB::MetadataLookup,
backend: &'b DB,
) -> QueryResult<()>
fn collect_binds<'b>( &'b self, out: &mut DB::BindCollector<'b>, metadata_lookup: &mut DB::MetadataLookup, backend: &'b DB, ) -> QueryResult<()>
Available on crate feature
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.Serializes all bind parameters in this query. Read more
Source§fn is_safe_to_cache_prepared(&self, backend: &DB) -> QueryResult<bool>
fn is_safe_to_cache_prepared(&self, backend: &DB) -> QueryResult<bool>
Available on crate feature
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.Is this query safe to store in the prepared statement cache? Read more
Source§impl<F, S, D, W, O, LOf, G, H, LC, DB> QueryFragment<DB, AnsiSqlSelectStatement> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
DB: Backend<SelectStatementSyntax = AnsiSqlSelectStatement>,
S: QueryFragment<DB>,
F: QueryFragment<DB>,
D: QueryFragment<DB>,
W: QueryFragment<DB>,
O: QueryFragment<DB>,
LOf: QueryFragment<DB>,
G: QueryFragment<DB>,
H: QueryFragment<DB>,
LC: QueryFragment<DB>,
impl<F, S, D, W, O, LOf, G, H, LC, DB> QueryFragment<DB, AnsiSqlSelectStatement> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
DB: Backend<SelectStatementSyntax = AnsiSqlSelectStatement>,
S: QueryFragment<DB>,
F: QueryFragment<DB>,
D: QueryFragment<DB>,
W: QueryFragment<DB>,
O: QueryFragment<DB>,
LOf: QueryFragment<DB>,
G: QueryFragment<DB>,
H: QueryFragment<DB>,
LC: QueryFragment<DB>,
Source§fn walk_ast<'b>(&'b self, out: AstPass<'_, 'b, DB>) -> QueryResult<()>
fn walk_ast<'b>(&'b self, out: AstPass<'_, 'b, DB>) -> QueryResult<()>
Walk over this
QueryFragment
for all passes. Read moreSource§fn to_sql(&self, out: &mut DB::QueryBuilder, backend: &DB) -> QueryResult<()>
fn to_sql(&self, out: &mut DB::QueryBuilder, backend: &DB) -> QueryResult<()>
Available on crate feature
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.Converts this
QueryFragment
to its SQL representation. Read moreSource§fn collect_binds<'b>(
&'b self,
out: &mut DB::BindCollector<'b>,
metadata_lookup: &mut DB::MetadataLookup,
backend: &'b DB,
) -> QueryResult<()>
fn collect_binds<'b>( &'b self, out: &mut DB::BindCollector<'b>, metadata_lookup: &mut DB::MetadataLookup, backend: &'b DB, ) -> QueryResult<()>
Available on crate feature
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.Serializes all bind parameters in this query. Read more
Source§fn is_safe_to_cache_prepared(&self, backend: &DB) -> QueryResult<bool>
fn is_safe_to_cache_prepared(&self, backend: &DB) -> QueryResult<bool>
Available on crate feature
i-implement-a-third-party-backend-and-opt-into-breaking-changes
only.Is this query safe to store in the prepared statement cache? Read more
Source§impl<From: QueryId, Select: QueryId, Distinct: QueryId, Where: QueryId, Order: QueryId, LimitOffset: QueryId, GroupBy: QueryId, Having: QueryId, Locking: QueryId> QueryId for SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>
impl<From: QueryId, Select: QueryId, Distinct: QueryId, Where: QueryId, Order: QueryId, LimitOffset: QueryId, GroupBy: QueryId, Having: QueryId, Locking: QueryId> QueryId for SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>
Source§const HAS_STATIC_QUERY_ID: bool = _
const HAS_STATIC_QUERY_ID: bool = _
Can the SQL generated by
Self
be uniquely identified by its type? Read moreSource§type QueryId = SelectStatement<<From as QueryId>::QueryId, <Select as QueryId>::QueryId, <Distinct as QueryId>::QueryId, <Where as QueryId>::QueryId, <Order as QueryId>::QueryId, <LimitOffset as QueryId>::QueryId, <GroupBy as QueryId>::QueryId, <Having as QueryId>::QueryId, <Locking as QueryId>::QueryId>
type QueryId = SelectStatement<<From as QueryId>::QueryId, <Select as QueryId>::QueryId, <Distinct as QueryId>::QueryId, <Where as QueryId>::QueryId, <Order as QueryId>::QueryId, <LimitOffset as QueryId>::QueryId, <GroupBy as QueryId>::QueryId, <Having as QueryId>::QueryId, <Locking as QueryId>::QueryId>
A type which uniquely represents
Self
in a SQL query. Read moreSource§impl<From> QuerySource for SelectStatement<From>where
From: AsQuerySource,
<From::QuerySource as QuerySource>::DefaultSelection: SelectableExpression<Self>,
impl<From> QuerySource for SelectStatement<From>where
From: AsQuerySource,
<From::QuerySource as QuerySource>::DefaultSelection: SelectableExpression<Self>,
Source§type FromClause = <<From as AsQuerySource>::QuerySource as QuerySource>::FromClause
type FromClause = <<From as AsQuerySource>::QuerySource as QuerySource>::FromClause
The type returned by
from_clause
Source§type DefaultSelection = <<From as AsQuerySource>::QuerySource as QuerySource>::DefaultSelection
type DefaultSelection = <<From as AsQuerySource>::QuerySource as QuerySource>::DefaultSelection
The type returned by
default_selection
Source§fn from_clause(&self) -> <From::QuerySource as QuerySource>::FromClause
fn from_clause(&self) -> <From::QuerySource as QuerySource>::FromClause
The actual
FROM
clause of this type. This is typically only called in
QueryFragment
implementations.Source§fn default_selection(&self) -> Self::DefaultSelection
fn default_selection(&self) -> Self::DefaultSelection
The default select clause of this type, which should be used if no
select clause was explicitly specified. This should always be a tuple of
all the desired columns, not
star
Source§impl<F, S, D, W, O, LOf, G, H, LC, Conn> RunQueryDsl<Conn> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>
impl<F, S, D, W, O, LOf, G, H, LC, Conn> RunQueryDsl<Conn> for SelectStatement<F, S, D, W, O, LOf, G, H, LC>
Source§fn execute(self, conn: &mut Conn) -> QueryResult<usize>where
Conn: Connection,
Self: ExecuteDsl<Conn>,
fn execute(self, conn: &mut Conn) -> QueryResult<usize>where
Conn: Connection,
Self: ExecuteDsl<Conn>,
Executes the given command, returning the number of rows affected. Read more
Source§fn load<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
fn load<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
Source§fn load_iter<'conn, 'query: 'conn, U, B>(
self,
conn: &'conn mut Conn,
) -> QueryResult<Self::RowIter<'conn>>where
U: 'conn,
Self: LoadQuery<'query, Conn, U, B> + 'conn,
fn load_iter<'conn, 'query: 'conn, U, B>(
self,
conn: &'conn mut Conn,
) -> QueryResult<Self::RowIter<'conn>>where
U: 'conn,
Self: LoadQuery<'query, Conn, U, B> + 'conn,
Source§fn get_result<'query, U>(self, conn: &mut Conn) -> QueryResult<U>where
Self: LoadQuery<'query, Conn, U>,
fn get_result<'query, U>(self, conn: &mut Conn) -> QueryResult<U>where
Self: LoadQuery<'query, Conn, U>,
Runs the command, and returns the affected row. Read more
Source§fn get_results<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
fn get_results<'query, U>(self, conn: &mut Conn) -> QueryResult<Vec<U>>where
Self: LoadQuery<'query, Conn, U>,
Runs the command, returning an
Vec
with the affected rows. Read moreSource§impl<S, D, W, O, LOf, G, H, LC, Selection> SelectDsl<Selection> for SelectStatement<NoFromClause, S, D, W, O, LOf, G, H, LC>where
G: ValidGroupByClause,
Selection: SelectableExpression<NoFromClause> + ValidGrouping<G::Expressions>,
SelectStatement<NoFromClause, SelectClause<Selection>, D, W, O, LOf, G, H, LC>: SelectQuery,
impl<S, D, W, O, LOf, G, H, LC, Selection> SelectDsl<Selection> for SelectStatement<NoFromClause, S, D, W, O, LOf, G, H, LC>where
G: ValidGroupByClause,
Selection: SelectableExpression<NoFromClause> + ValidGrouping<G::Expressions>,
SelectStatement<NoFromClause, SelectClause<Selection>, D, W, O, LOf, G, H, LC>: SelectQuery,
Source§type Output = SelectStatement<NoFromClause, SelectClause<Selection>, D, W, O, LOf, G, H, LC>
type Output = SelectStatement<NoFromClause, SelectClause<Selection>, D, W, O, LOf, G, H, LC>
The type returned by
.select
Source§impl<F, S, D, W, O, LOf, G, H> SelectNullableDsl for SelectStatement<F, SelectClause<S>, D, W, O, LOf, G, H>
impl<F, S, D, W, O, LOf, G, H> SelectNullableDsl for SelectStatement<F, SelectClause<S>, D, W, O, LOf, G, H>
Source§impl<F, S, D, W, O, LOf, G, H, LC> SelectQuery for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
S: SelectClauseExpression<F>,
O: ValidOrderingForDistinct<D>,
impl<F, S, D, W, O, LOf, G, H, LC> SelectQuery for SelectStatement<F, S, D, W, O, LOf, G, H, LC>where
S: SelectClauseExpression<F>,
O: ValidOrderingForDistinct<D>,
Source§type SqlType = <S as SelectClauseExpression<F>>::SelectClauseSqlType
type SqlType = <S as SelectClauseExpression<F>>::SelectClauseSqlType
The SQL type of the
SELECT
clauseSource§impl<F, S, D, W, LOf, G, LC, Expr> ThenOrderDsl<Expr> for SelectStatement<F, S, D, W, NoOrderClause, LOf, G, LC>where
Expr: Expression,
Self: OrderDsl<Expr>,
impl<F, S, D, W, LOf, G, LC, Expr> ThenOrderDsl<Expr> for SelectStatement<F, S, D, W, NoOrderClause, LOf, G, LC>where
Expr: Expression,
Self: OrderDsl<Expr>,
Source§type Output = <SelectStatement<F, S, D, W, NoOrderClause, LOf, G, LC> as OrderDsl<Expr>>::Output
type Output = <SelectStatement<F, S, D, W, NoOrderClause, LOf, G, LC> as OrderDsl<Expr>>::Output
The type returned by
.then_order_by
.Source§fn then_order_by(self, expr: Expr) -> Self::Output
fn then_order_by(self, expr: Expr) -> Self::Output
See the trait documentation.
impl<From: Copy, Select: Copy, Distinct: Copy, Where: Copy, Order: Copy, LimitOffset: Copy, GroupBy: Copy, Having: Copy, Locking: Copy> Copy for SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>
Auto Trait Implementations§
impl<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking> Freeze for SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>
impl<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking> RefUnwindSafe for SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>where
Select: RefUnwindSafe,
From: RefUnwindSafe,
Distinct: RefUnwindSafe,
Where: RefUnwindSafe,
Order: RefUnwindSafe,
LimitOffset: RefUnwindSafe,
GroupBy: RefUnwindSafe,
Having: RefUnwindSafe,
Locking: RefUnwindSafe,
impl<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking> Send for SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>
impl<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking> Sync for SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>
impl<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking> Unpin for SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>
impl<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking> UnwindSafe for SelectStatement<From, Select, Distinct, Where, Order, LimitOffset, GroupBy, Having, Locking>where
Select: UnwindSafe,
From: UnwindSafe,
Distinct: UnwindSafe,
Where: UnwindSafe,
Order: UnwindSafe,
LimitOffset: UnwindSafe,
GroupBy: UnwindSafe,
Having: UnwindSafe,
Locking: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
Source§impl<Conn, DB, T> ExecuteDsl<Conn, DB> for T
impl<Conn, DB, T> ExecuteDsl<Conn, DB> for T
Source§impl<T> IntoSql for T
impl<T> IntoSql for T
Source§impl<T> JoinOnDsl for Twhere
T: QuerySource,
impl<T> JoinOnDsl for Twhere
T: QuerySource,
Source§impl<T, DB> QueryFragmentForCachedStatement<DB> for T
impl<T, DB> QueryFragmentForCachedStatement<DB> for T
Source§impl<T> SingleValueDsl for T
impl<T> SingleValueDsl for T
Source§type Output = Grouped<Subselect<<T as LimitDsl>::Output, <<T as SelectQuery>::SqlType as IntoNullable>::Nullable>>
type Output = Grouped<Subselect<<T as LimitDsl>::Output, <<T as SelectQuery>::SqlType as IntoNullable>::Nullable>>
The type returned by
.single_value
.Source§fn single_value(self) -> <T as SingleValueDsl>::Output
fn single_value(self) -> <T as SingleValueDsl>::Output
See the trait documentation.