Skip to main content

InsertRow

Trait InsertRow 

Source
pub trait InsertRow: Sealed {
    type Table: Table;
    type Values: InsertValues;

    // Required method
    fn into_values(self) -> Self::Values;
}
Expand description

Implemented by the #[derive(Table)]-generated *Insert struct for each table. One list of (column, value) pairs rather than a name list beside a value list, for the reason select::AllColumns carries one list: the seal is #[doc(hidden)] pub — the derive has to write it in the schema’s own crate — so two lists that have to line up position for position could be made not to, and INSERT INTO t (a, b, c) VALUES ($1) is malformed whatever the table looks like. update::UpdateRow::sets has always had this shape.

Required Associated Types§

Source

type Table: Table

Source

type Values: InsertValues

This row’s columns and values as one chain: the keys spell the statement’s header, the cells carry what goes under them. One type, because two lists reconciled at render time is the shape that made every earlier version of this trait able to produce SQL malformed for any table, or to drop a value silently — a COLUMNS const beside positional values, then pairs matched against the first row’s names, then pairs matched against a declared header. A chain can carry neither a surplus cell nor a missing one.

Required Methods§

Source

fn into_values(self) -> Self::Values

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§