pub trait AsQuery {
type SqlType;
type Query: Query<SqlType = Self::SqlType>;
// Required method
fn as_query(self) -> Self::Query;
}
Expand description
Types that can be converted into a complete, typed SQL query.
This is used internally to automatically add the right select clause when
none is specified, or to automatically add RETURNING *
in certain contexts.
A type which implements this trait is guaranteed to be valid for execution.
Required Associated Types§
Required Methods§
Implementors§
Source§impl<S> AsQuery for Alias<S>where
S: AliasSource,
S::Target: AsQuery,
Self: QuerySource,
<Self as QuerySource>::DefaultSelection: ValidGrouping<()>,
impl<S> AsQuery for Alias<S>where
S: AliasSource,
S::Target: AsQuery,
Self: QuerySource,
<Self as QuerySource>::DefaultSelection: ValidGrouping<()>,
type SqlType = <<Alias<S> as QuerySource>::DefaultSelection as Expression>::SqlType
type Query = SelectStatement<FromClause<Alias<S>>>
Source§impl<S> AsQuery for Only<S>where
S: Table + Clone,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Only<S>>,
Available on crate feature postgres_backend
only.
impl<S> AsQuery for Only<S>where
S: Table + Clone,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Only<S>>,
Available on crate feature
postgres_backend
only.type SqlType = <<Only<S> as QuerySource>::DefaultSelection as Expression>::SqlType
type Query = SelectStatement<FromClause<Only<S>>>
Source§impl<S, TSM> AsQuery for Tablesample<S, TSM>where
S: Table + Clone,
TSM: TablesampleMethod,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Tablesample<S, TSM>>,
Available on crate feature postgres_backend
only.
impl<S, TSM> AsQuery for Tablesample<S, TSM>where
S: Table + Clone,
TSM: TablesampleMethod,
<S as QuerySource>::DefaultSelection: ValidGrouping<()> + SelectableExpression<Tablesample<S, TSM>>,
Available on crate feature
postgres_backend
only.