Struct grafbase_sql_ast::ast::MultiRowInsert
source · pub struct MultiRowInsert<'a> { /* private fields */ }
Expand description
A builder for an INSERT
statement for multiple rows.
Implementations§
source§impl<'a> MultiRowInsert<'a>
impl<'a> MultiRowInsert<'a>
sourcepub fn values<V>(&mut self, values: V)
pub fn values<V>(&mut self, values: V)
Adds multiple new rows to be inserted.
let mut query = Insert::multi_into("users", vec!["foo"]);
query.values(vec![1]);
query.values(vec![2]);
let (sql, params) = renderer::Postgres::build(query);
assert_eq!(r#"INSERT INTO "users" ("foo") VALUES ($1), ($2)"#, sql);
assert_eq!(
vec![
Value::from(1),
Value::from(2),
], params);
sourcepub fn extend(&mut self, other: SingleRowInsert<'a>) -> Result<()>
pub fn extend(&mut self, other: SingleRowInsert<'a>) -> Result<()>
Extend the insert statement with a single row insert.
Both inserts must be to the same table and must include the same columns.
Trait Implementations§
source§impl<'a> Clone for MultiRowInsert<'a>
impl<'a> Clone for MultiRowInsert<'a>
source§fn clone(&self) -> MultiRowInsert<'a>
fn clone(&self) -> MultiRowInsert<'a>
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl<'a> Debug for MultiRowInsert<'a>
impl<'a> Debug for MultiRowInsert<'a>
source§impl<'a> From<MultiRowInsert<'a>> for Insert<'a>
impl<'a> From<MultiRowInsert<'a>> for Insert<'a>
source§fn from(insert: MultiRowInsert<'a>) -> Self
fn from(insert: MultiRowInsert<'a>) -> Self
Converts to this type from the input type.
source§impl<'a> From<MultiRowInsert<'a>> for Query<'a>
impl<'a> From<MultiRowInsert<'a>> for Query<'a>
source§fn from(insert: MultiRowInsert<'a>) -> Query<'a>
fn from(insert: MultiRowInsert<'a>) -> Query<'a>
Converts to this type from the input type.
source§impl<'a> PartialEq for MultiRowInsert<'a>
impl<'a> PartialEq for MultiRowInsert<'a>
source§fn eq(&self, other: &MultiRowInsert<'a>) -> bool
fn eq(&self, other: &MultiRowInsert<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.impl<'a> StructuralPartialEq for MultiRowInsert<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for MultiRowInsert<'a>
impl<'a> Send for MultiRowInsert<'a>
impl<'a> Sync for MultiRowInsert<'a>
impl<'a> Unpin for MultiRowInsert<'a>
impl<'a> UnwindSafe for MultiRowInsert<'a>
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