pub struct OnConflictBuilder<'a, S, T> { /* private fields */ }Expand description
Intermediate builder for typed ON CONFLICT clause construction.
Created by InsertBuilder::on_conflict(). Call do_nothing()
or do_update() to complete the clause.
Implementations§
Source§impl<'a, S, T> OnConflictBuilder<'a, S, T>
impl<'a, S, T> OnConflictBuilder<'a, S, T>
Sourcepub fn where<E>(self, condition: E) -> Self
pub fn where<E>(self, condition: E) -> Self
Adds a WHERE clause to the conflict target for partial index matching.
Generates: ON CONFLICT (col) WHERE condition DO ...
Sourcepub fn do_nothing(self) -> InsertBuilder<'a, S, InsertOnConflictSet, T>
pub fn do_nothing(self) -> InsertBuilder<'a, S, InsertOnConflictSet, T>
Resolves the conflict by doing nothing (ignoring the conflicting row).
Generates: ON CONFLICT (col1, col2) DO NOTHING
Sourcepub fn do_update(
self,
set: impl ToSQL<'a, SQLiteValue<'a>>,
) -> InsertBuilder<'a, S, InsertDoUpdateSet, T>
pub fn do_update( self, set: impl ToSQL<'a, SQLiteValue<'a>>, ) -> InsertBuilder<'a, S, InsertDoUpdateSet, T>
Resolves the conflict by updating the existing row.
The set parameter accepts any ToSQL value, typically an UpdateModel
which generates the SET clause assignments.
Generates: ON CONFLICT (col1, col2) DO UPDATE SET ...
Chain .r#where(condition) to add a conditional update filter.
Trait Implementations§
Auto Trait Implementations§
impl<'a, S, T> Freeze for OnConflictBuilder<'a, S, T>
impl<'a, S, T> RefUnwindSafe for OnConflictBuilder<'a, S, T>where
S: RefUnwindSafe,
T: RefUnwindSafe,
impl<'a, S, T> Send for OnConflictBuilder<'a, S, T>
impl<'a, S, T> Sync for OnConflictBuilder<'a, S, T>
impl<'a, S, T> Unpin for OnConflictBuilder<'a, S, T>
impl<'a, S, T> UnsafeUnpin for OnConflictBuilder<'a, S, T>
impl<'a, S, T> UnwindSafe for OnConflictBuilder<'a, S, T>where
S: UnwindSafe,
T: 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