InsertBuilder

Type Alias InsertBuilder 

Source
pub type InsertBuilder<'a, Schema, State, Table> = QueryBuilder<'a, Schema, State, Table>;
Expand description

Builds an INSERT query specifically for PostgreSQL

Aliased Type§

pub struct InsertBuilder<'a, Schema, State, Table> {
    pub sql: SQL<'a, PostgresValue<'a>>,
    /* private fields */
}

Fields§

§sql: SQL<'a, PostgresValue<'a>>

Implementations§

Source§

impl<'a, Schema, Table> InsertBuilder<'a, Schema, InsertInitial, Table>
where Table: PostgresTable<'a>,

Source

pub fn values<I, T>( self, values: I, ) -> InsertBuilder<'a, Schema, InsertValuesSet, Table>
where I: IntoIterator<Item = Table::Insert<T>>,

Sets values to insert and transitions to ValuesSet state

Source§

impl<'a, S, T> InsertBuilder<'a, S, InsertValuesSet, T>

Source

pub fn on_conflict( self, conflict: Conflict<'a>, ) -> InsertBuilder<'a, S, InsertOnConflictSet, T>

Adds conflict resolution clause following PostgreSQL ON CONFLICT syntax

Source

pub fn on_conflict_do_nothing( self, ) -> InsertBuilder<'a, S, InsertOnConflictSet, T>

Shorthand for ON CONFLICT DO NOTHING (matches any conflict)

Source

pub fn on_conflict_do_nothing_on<C>( self, columns: C, ) -> InsertBuilder<'a, S, InsertOnConflictSet, T>
where C: ToSQL<'a, PostgresValue<'a>>,

Shorthand for ON CONFLICT (columns…) DO NOTHING

Source

pub fn returning( self, columns: impl ToSQL<'a, PostgresValue<'a>>, ) -> InsertBuilder<'a, S, InsertReturningSet, T>

Adds a RETURNING clause and transitions to ReturningSet state

Source§

impl<'a, S, T> InsertBuilder<'a, S, InsertOnConflictSet, T>

Source

pub fn returning( self, columns: impl ToSQL<'a, PostgresValue<'a>>, ) -> InsertBuilder<'a, S, InsertReturningSet, T>

Adds a RETURNING clause after ON CONFLICT