UpsertBuilder

Struct UpsertBuilder 

Source
pub struct UpsertBuilder<Table, Values, Conflict> { /* private fields */ }
Expand description

A type-safe UPSERT (INSERT … ON CONFLICT) builder for SQLite.

Implementations§

Source§

impl UpsertBuilder<NoTable, NoValues, NoConflict>

Source

pub fn new() -> Self

Creates a new UPSERT builder.

Source§

impl<Values, Conflict> UpsertBuilder<NoTable, Values, Conflict>

Source

pub fn into_table( self, table: &str, ) -> UpsertBuilder<HasTable, Values, Conflict>

Specifies the table to insert into.

Source§

impl<Values, Conflict> UpsertBuilder<HasTable, Values, Conflict>

Source

pub fn columns(self, cols: &[&str]) -> Self

Specifies the columns to insert into.

Source§

impl<Conflict> UpsertBuilder<HasTable, NoValues, Conflict>

Source

pub fn values<T: ToSqlValue>( self, vals: Vec<T>, ) -> UpsertBuilder<HasTable, HasValues, Conflict>

Adds values to insert.

Source§

impl UpsertBuilder<HasTable, HasValues, NoConflict>

Source

pub fn on_conflict( self, cols: &[&str], ) -> UpsertBuilder<HasTable, HasValues, HasConflict>

Specifies the conflict target columns.

Source§

impl UpsertBuilder<HasTable, HasValues, HasConflict>

Source

pub fn do_nothing(self) -> Self

Sets DO NOTHING action.

Source

pub fn do_update(self, cols: &[&str]) -> Self

Sets DO UPDATE with specified columns.

Source

pub fn build(self) -> (String, Vec<SqlValue>)

Builds the UPSERT statement and returns SQL with parameters.

Source

pub fn build_sql(self) -> String

Builds the UPSERT statement and returns only the SQL string.

Trait Implementations§

Source§

impl Default for UpsertBuilder<NoTable, NoValues, NoConflict>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<Table, Values, Conflict> Freeze for UpsertBuilder<Table, Values, Conflict>

§

impl<Table, Values, Conflict> RefUnwindSafe for UpsertBuilder<Table, Values, Conflict>
where Table: RefUnwindSafe, Values: RefUnwindSafe, Conflict: RefUnwindSafe,

§

impl<Table, Values, Conflict> Send for UpsertBuilder<Table, Values, Conflict>
where Table: Send, Values: Send, Conflict: Send,

§

impl<Table, Values, Conflict> Sync for UpsertBuilder<Table, Values, Conflict>
where Table: Sync, Values: Sync, Conflict: Sync,

§

impl<Table, Values, Conflict> Unpin for UpsertBuilder<Table, Values, Conflict>
where Table: Unpin, Values: Unpin, Conflict: Unpin,

§

impl<Table, Values, Conflict> UnwindSafe for UpsertBuilder<Table, Values, Conflict>
where Table: UnwindSafe, Values: UnwindSafe, Conflict: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.