Skip to main content

Statement

Trait Statement 

Source
pub trait Statement: Sealed {
    type Dialect: Dialect;
    type Table: Table;

    // Provided methods
    fn to_sql(&self, _dialect: Self::Dialect) -> (String, Vec<Value>) { ... }
    fn returning<Sel, Idx>(self, sel: Sel) -> Returning<Self, Sel>
       where Self: Sized,
             Self::Dialect: SupportsReturning,
             Sel: Selection<WrittenTable<Self::Table>, Idx> { ... }
}
Expand description

A statement that writes to a single table. Sealed: the three writing statements are the whole set, and Returning is defined against this rather than against each of them.

Required Associated Types§

Provided Methods§

Source

fn to_sql(&self, _dialect: Self::Dialect) -> (String, Vec<Value>)

The dialect is an argument for the reason Select::to_sql’s is.

Source

fn returning<Sel, Idx>(self, sel: Sel) -> Returning<Self, Sel>
where Self: Sized, Self::Dialect: SupportsReturning, Sel: Selection<WrittenTable<Self::Table>, Idx>,

RETURNING, on whichever of the three this is — the clause is the same clause. A distinct type rather than Self with a flag set: the execution layer needs Sel’s concrete type to know what to decode a returned row into, and an optional field would erase it.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§

Source§

impl<D: Dialect, R: InsertRow> Statement for Insert<D, R>

Source§

impl<D: Dialect, T: Table> Statement for Delete<D, T>

Source§

impl<D: Dialect, T: Table> Statement for Update<D, T>