pub enum Conflict<'a> {
DoNothing {
target: Option<ConflictTarget<'a>>,
},
DoUpdate {
target: ConflictTarget<'a>,
set: SQL<'a, PostgresValue<'a>>,
where_clause: Option<SQL<'a, PostgresValue<'a>>>,
},
}Expand description
Conflict resolution strategies for PostgreSQL
Variants§
DoNothing
Do nothing on conflict - ON CONFLICT DO NOTHING or ON CONFLICT (target) DO NOTHING
Fields
§
target: Option<ConflictTarget<'a>>Optional target specification. If None, matches any conflict
DoUpdate
Update on conflict - ON CONFLICT (target) DO UPDATE SET …
Fields
§
target: ConflictTarget<'a>Required target specification for DO UPDATE
§
set: SQL<'a, PostgresValue<'a>>SET clause assignments (can use EXCLUDED.column to reference proposed values)
§
where_clause: Option<SQL<'a, PostgresValue<'a>>>Optional WHERE clause for conditional updates Applied after SET: DO UPDATE SET … WHERE condition
Implementations§
Source§impl<'a> Conflict<'a>
impl<'a> Conflict<'a>
Sourcepub fn do_nothing_on_columns<T>(columns: T) -> Selfwhere
T: ToSQL<'a, PostgresValue<'a>>,
pub fn do_nothing_on_columns<T>(columns: T) -> Selfwhere
T: ToSQL<'a, PostgresValue<'a>>,
Create a DO NOTHING conflict resolution with specific columns
Sourcepub fn do_nothing_on_constraint(constraint_name: String) -> Self
pub fn do_nothing_on_constraint(constraint_name: String) -> Self
Create a DO NOTHING conflict resolution with a constraint name
Sourcepub fn do_update<S, W>(
target: ConflictTarget<'a>,
set: S,
where_clause: Option<W>,
) -> Self
pub fn do_update<S, W>( target: ConflictTarget<'a>, set: S, where_clause: Option<W>, ) -> Self
Create a DO UPDATE conflict resolution
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Conflict<'a>
impl<'a> !RefUnwindSafe for Conflict<'a>
impl<'a> Send for Conflict<'a>
impl<'a> Sync for Conflict<'a>
impl<'a> Unpin for Conflict<'a>
impl<'a> !UnwindSafe for Conflict<'a>
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