pub struct Insert<D, R: InsertRow> { /* private fields */ }Implementations§
Source§impl<D, R: InsertRow + Insertable> Insert<D, R>
impl<D, R: InsertRow + Insertable> Insert<D, R>
Sourcepub fn values_all(self, rows: impl IntoIterator<Item = R>) -> Self
pub fn values_all(self, rows: impl IntoIterator<Item = R>) -> Self
The same for a collection. Infallible, unlike the seed’s: this
statement already has a row, so an empty collection adds nothing
rather than describing an INSERT with nothing in it.
Source§impl<D: Dialect, R: InsertRow> Insert<D, R>
impl<D: Dialect, R: InsertRow> Insert<D, R>
Sourcepub fn on_conflict_do_nothing(
self,
target: impl ConflictTarget<R::Table>,
) -> Selfwhere
D: SupportsOnConflict,
pub fn on_conflict_do_nothing(
self,
target: impl ConflictTarget<R::Table>,
) -> Selfwhere
D: SupportsOnConflict,
ON CONFLICT (..) DO NOTHING.
Sourcepub fn on_conflict_do_update(
self,
target: impl ConflictTarget<R::Table>,
set: Assignments<R::Table>,
) -> Selfwhere
D: SupportsOnConflict,
pub fn on_conflict_do_update(
self,
target: impl ConflictTarget<R::Table>,
set: Assignments<R::Table>,
) -> Selfwhere
D: SupportsOnConflict,
ON CONFLICT (..) DO UPDATE SET .., taking the same Assignments
an UPDATE sets.
Trait Implementations§
Source§impl<D: Dialect, R: InsertRow> Statement for Insert<D, R>
impl<D: Dialect, R: InsertRow> Statement for Insert<D, R>
type Dialect = D
type Table = <R as InsertRow>::Table
Source§fn to_sql(&self, _dialect: Self::Dialect) -> (String, Vec<Value>)
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>,
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.Auto Trait Implementations§
impl<D, R> Freeze for Insert<D, R>
impl<D, R> RefUnwindSafe for Insert<D, R>where
Option<ConflictClause<<R as InsertRow>::Table>>: RefUnwindSafe,
PhantomData<fn() -> (D, R)>: RefUnwindSafe,
impl<D, R> Send for Insert<D, R>
impl<D, R> Sync for Insert<D, R>
impl<D, R> Unpin for Insert<D, R>
impl<D, R> UnsafeUnpin for Insert<D, R>where
Option<ConflictClause<<R as InsertRow>::Table>>: UnsafeUnpin,
PhantomData<fn() -> (D, R)>: UnsafeUnpin,
impl<D, R> UnwindSafe for Insert<D, R>where
Option<ConflictClause<<R as InsertRow>::Table>>: UnwindSafe,
PhantomData<fn() -> (D, R)>: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more