Struct scooby::postgres::statements::OnConflictClauseBuilder
source · pub struct OnConflictClauseBuilder<V: Values> { /* private fields */ }
Expand description
Intermediate structure to ensure that an action for an ON CONFLICT
clause is specified:
do_nothing
to add aDO NOTHING
actiondo_update_set
to addDO UPDATE SET ...
action
Implementations§
source§impl<V: Values> OnConflictClauseBuilder<V>
impl<V: Values> OnConflictClauseBuilder<V>
sourcepub fn do_nothing(self) -> InsertInto<V>
pub fn do_nothing(self) -> InsertInto<V>
Add a DO NOTHING
action to this ON CONFLICT
clause.
Returns back to the InsertInto
statement.
use scooby::postgres::insert_into;
let sql = insert_into("Dummy")
.values(["a"])
.on_conflict()
.do_nothing()
.to_string();
assert_eq!(sql, "INSERT INTO Dummy VALUES (a) ON CONFLICT DO NOTHING");
sourcepub fn do_update_set(
self,
pairs: impl IntoIteratorOfSameType<ColumnValuePair>
) -> InsertInto<V>
pub fn do_update_set( self, pairs: impl IntoIteratorOfSameType<ColumnValuePair> ) -> InsertInto<V>
Add a DO UPDATE SET
action to this ON CONFLICT
clause
Returns back to the InsertInto
statement.
use scooby::postgres::insert_into;
let sql = insert_into("Dummy")
.values(["a"])
.on_conflict()
.do_update_set([("b", "c")])
.to_string();
assert_eq!(sql, "INSERT INTO Dummy VALUES (a) ON CONFLICT DO UPDATE SET b = c");
Auto Trait Implementations§
impl<V> RefUnwindSafe for OnConflictClauseBuilder<V>where V: RefUnwindSafe,
impl<V> Send for OnConflictClauseBuilder<V>where V: Send,
impl<V> Sync for OnConflictClauseBuilder<V>where V: Sync,
impl<V> Unpin for OnConflictClauseBuilder<V>where V: Unpin,
impl<V> UnwindSafe for OnConflictClauseBuilder<V>where V: 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