Skip to main content

AsQuery

Trait AsQuery 

Source
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§

Source

type SqlType

The SQL type of Self::Query

Source

type Query: Query<SqlType = Self::SqlType>

What kind of query does this type represent?

Required Methods§

Source

fn as_query(self) -> Self::Query

Converts a type which semantically represents a SQL query into the actual query being executed. See the trait level docs for more.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

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.
Source§

impl<S> AsQuery for Alias<S>

Source§

impl<S> AsQuery for Only<S>

Available on crate feature postgres_backend only.
Source§

impl<T, U, Op> AsQuery for InsertStatement<T, U, Op, NoReturningClause>

Source§

impl<T, U, V> AsQuery for UpdateStatement<T, U, V, NoReturningClause>

Source§

impl<T, U> AsQuery for DeleteStatement<T, U, NoReturningClause>

Source§

impl<T: Query> AsQuery for T