Skip to main content

MergeBuilder

Struct MergeBuilder 

Source
pub struct MergeBuilder { /* private fields */ }
Expand description

Fluent builder for constructing MERGE INTO statements.

Created by the merge_into() entry-point function.

Implementations§

Source§

impl MergeBuilder

Source

pub fn using(self, source: &str, on: Expr) -> Self

Set the source table and ON join condition.

Source

pub fn when_matched_update(self, assignments: Vec<(&str, Expr)>) -> Self

Add a WHEN MATCHED THEN UPDATE SET clause.

Source

pub fn when_matched_update_where( self, condition: Expr, assignments: Vec<(&str, Expr)>, ) -> Self

Add a WHEN MATCHED THEN UPDATE SET clause with an additional condition.

Source

pub fn when_matched_delete(self) -> Self

Add a WHEN MATCHED THEN DELETE clause.

Source

pub fn when_not_matched_insert( self, columns: &[&str], values: Vec<Expr>, ) -> Self

Add a WHEN NOT MATCHED THEN INSERT (cols) VALUES (vals) clause.

Source

pub fn build(self) -> Expression

Consume this builder and produce the final Expression::Merge AST node.

Source

pub fn to_sql(self) -> String

Consume this builder, generate, and return the SQL string.

Auto Trait Implementations§

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.