InsertDyn

Struct InsertDyn 

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

A dynamic INSERT statement builder using string-based column names.

For compile-time validated queries, use Insert from builder::typed.

Implementations§

Source§

impl InsertDyn<NoTable, NoValues>

Source

pub fn new() -> Self

Creates a new INSERT builder.

Source§

impl<Values> InsertDyn<NoTable, Values>

Source

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

Specifies the table to insert into.

Source§

impl<Values> InsertDyn<HasTable, Values>

Source

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

Specifies the columns to insert into.

Source§

impl InsertDyn<HasTable, NoValues>

Source

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

Adds a row of values to insert.

Source

pub fn values_many<T: ToSqlValue>( self, rows: Vec<Vec<T>>, ) -> InsertDyn<HasTable, HasValues>

Adds multiple rows of values to insert.

Source§

impl InsertDyn<HasTable, HasValues>

Source

pub fn and_values<T: ToSqlValue>(self, vals: Vec<T>) -> Self

Adds another row of values.

Source

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

Builds the INSERT statement and returns SQL with parameters.

Source

pub fn build_sql(self) -> String

Builds the INSERT statement and returns only the SQL string.

Warning: Parameters are NOT inlined. Use build() to get parameters.

Trait Implementations§

Source§

impl Default for InsertDyn<NoTable, NoValues>

Source§

fn default() -> Self

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

Auto Trait Implementations§

§

impl<Table, Values> Freeze for InsertDyn<Table, Values>

§

impl<Table, Values> RefUnwindSafe for InsertDyn<Table, Values>
where Table: RefUnwindSafe, Values: RefUnwindSafe,

§

impl<Table, Values> Send for InsertDyn<Table, Values>
where Table: Send, Values: Send,

§

impl<Table, Values> Sync for InsertDyn<Table, Values>
where Table: Sync, Values: Sync,

§

impl<Table, Values> Unpin for InsertDyn<Table, Values>
where Table: Unpin, Values: Unpin,

§

impl<Table, Values> UnwindSafe for InsertDyn<Table, Values>
where Table: UnwindSafe, Values: 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.