pub struct UpsertBuilder<T> { /* private fields */ }Expand description
Builder for UPSERT (INSERT … ON CONFLICT DO UPDATE) queries.
Implements Modifiable. Call .select() for RETURNING clause.
Implementations§
Source§impl<T> UpsertBuilder<T>
impl<T> UpsertBuilder<T>
Sourcepub fn on_conflict(self, columns: &[&str]) -> UpsertBuilder<T>
pub fn on_conflict(self, columns: &[&str]) -> UpsertBuilder<T>
Set the conflict columns for ON CONFLICT.
Sourcepub fn on_conflict_constraint(self, constraint: &str) -> UpsertBuilder<T>
pub fn on_conflict_constraint(self, constraint: &str) -> UpsertBuilder<T>
Set a constraint name for ON CONFLICT ON CONSTRAINT.
Sourcepub fn ignore_duplicates(self) -> UpsertBuilder<T>
pub fn ignore_duplicates(self) -> UpsertBuilder<T>
Use ON CONFLICT DO NOTHING instead of DO UPDATE.
When set, duplicate rows are silently ignored instead of updated.
Sourcepub fn schema(self, schema: &str) -> UpsertBuilder<T>
pub fn schema(self, schema: &str) -> UpsertBuilder<T>
Override the schema for this query.
Generates "schema"."table" instead of the default schema.
Sourcepub fn select(self) -> UpsertBuilder<T>
pub fn select(self) -> UpsertBuilder<T>
Add RETURNING * clause.
Sourcepub fn select_columns(self, columns: &str) -> UpsertBuilder<T>
pub fn select_columns(self, columns: &str) -> UpsertBuilder<T>
Add RETURNING with specific columns.
Source§impl<T> UpsertBuilder<T>where
T: DeserializeOwned + Send,
impl<T> UpsertBuilder<T>where
T: DeserializeOwned + Send,
Sourcepub async fn execute(self) -> SupabaseResponse<T>
pub async fn execute(self) -> SupabaseResponse<T>
Execute the UPSERT query.
Trait Implementations§
Source§impl<T> Modifiable for UpsertBuilder<T>
impl<T> Modifiable for UpsertBuilder<T>
Source§fn order(self, column: &str, direction: OrderDirection) -> Self
fn order(self, column: &str, direction: OrderDirection) -> Self
Order by a column.
Source§fn order_with_nulls(
self,
column: &str,
direction: OrderDirection,
nulls: NullsPosition,
) -> Self
fn order_with_nulls( self, column: &str, direction: OrderDirection, nulls: NullsPosition, ) -> Self
Order by a column with explicit nulls positioning.
Source§fn range(self, from: i64, to: i64) -> Self
fn range(self, from: i64, to: i64) -> Self
Set the range of rows to return (offset..offset+limit).
Source§fn maybe_single(self) -> Self
fn maybe_single(self) -> Self
Expect zero or one row. Returns error if >1 rows.
Source§fn count_option(self, option: CountOption) -> Self
fn count_option(self, option: CountOption) -> Self
Request a row count with a specific counting strategy.
Auto Trait Implementations§
impl<T> Freeze for UpsertBuilder<T>
impl<T> !RefUnwindSafe for UpsertBuilder<T>
impl<T> Send for UpsertBuilder<T>where
T: Send,
impl<T> Sync for UpsertBuilder<T>where
T: Sync,
impl<T> Unpin for UpsertBuilder<T>where
T: Unpin,
impl<T> !UnwindSafe for UpsertBuilder<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