pub enum Conflict<'a, T: IntoIterator<Item: ToSQL<'a, SQLiteValue<'a>>> = Vec<SQL<'a, SQLiteValue<'a>>>> {
Ignore {
target: Option<T>,
},
Update {
target: T,
set: Box<SQL<'a, SQLiteValue<'a>>>,
target_where: Box<Option<SQL<'a, SQLiteValue<'a>>>>,
set_where: Box<Option<SQL<'a, SQLiteValue<'a>>>>,
},
}Expand description
Conflict resolution strategies
Variants§
Ignore
Do nothing on conflict - ON CONFLICT DO NOTHING
Update
Update on conflict - ON CONFLICT DO UPDATE
Fields
§
target: TTarget columns that trigger the conflict
§
set: Box<SQL<'a, SQLiteValue<'a>>>SET clause for what to update
§
target_where: Box<Option<SQL<'a, SQLiteValue<'a>>>>Optional WHERE clause for the conflict target (partial indexes) This goes after the target: ON CONFLICT (col) WHERE condition
§
set_where: Box<Option<SQL<'a, SQLiteValue<'a>>>>Optional WHERE clause for the update (conditional updates) This goes after the SET: DO UPDATE SET col = val WHERE condition
Implementations§
Source§impl<'a, T> Conflict<'a, T>
impl<'a, T> Conflict<'a, T>
pub fn update<S, TW, SW>(
target: T,
set: S,
target_where: Option<TW>,
set_where: Option<SW>,
) -> Selfwhere
S: ToSQL<'a, SQLiteValue<'a>>,
TW: ToSQL<'a, SQLiteValue<'a>>,
SW: ToSQL<'a, SQLiteValue<'a>>,
Trait Implementations§
Source§impl<'a, T: Clone + IntoIterator<Item: ToSQL<'a, SQLiteValue<'a>>>> Clone for Conflict<'a, T>
impl<'a, T: Clone + IntoIterator<Item: ToSQL<'a, SQLiteValue<'a>>>> Clone for Conflict<'a, T>
Source§impl<'a, T: Debug + IntoIterator<Item: ToSQL<'a, SQLiteValue<'a>>>> Debug for Conflict<'a, T>
impl<'a, T: Debug + IntoIterator<Item: ToSQL<'a, SQLiteValue<'a>>>> Debug for Conflict<'a, T>
Auto Trait Implementations§
impl<'a, T> Freeze for Conflict<'a, T>where
T: Freeze,
impl<'a, T = Vec<SQL<'a, SQLiteValue<'a>>>> !RefUnwindSafe for Conflict<'a, T>
impl<'a, T> Send for Conflict<'a, T>where
T: Send,
impl<'a, T> Sync for Conflict<'a, T>where
T: Sync,
impl<'a, T> Unpin for Conflict<'a, T>where
T: Unpin,
impl<'a, T = Vec<SQL<'a, SQLiteValue<'a>>>> !UnwindSafe for Conflict<'a, T>
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