Struct grafbase_sql_ast::ast::Insert
source · pub struct Insert<'a> { /* private fields */ }
Expand description
A builder for an INSERT
statement.
Implementations§
source§impl<'a> Insert<'a>
impl<'a> Insert<'a>
sourcepub fn single_into<T>(table: T) -> SingleRowInsert<'a>where
T: Into<Table<'a>>,
pub fn single_into<T>(table: T) -> SingleRowInsert<'a>where T: Into<Table<'a>>,
Creates a new single row INSERT
statement for the given table.
let query = Insert::single_into("users");
let (sql, _) = renderer::Postgres::build(query);
assert_eq!(r#"INSERT INTO "users" DEFAULT VALUES"#, sql);
pub fn single() -> SingleRowInsert<'a>
sourcepub fn multi_into<T, K, I>(table: T, columns: I) -> MultiRowInsert<'a>where
T: Into<Table<'a>>,
K: Into<Column<'a>>,
I: IntoIterator<Item = K>,
pub fn multi_into<T, K, I>(table: T, columns: I) -> MultiRowInsert<'a>where T: Into<Table<'a>>, K: Into<Column<'a>>, I: IntoIterator<Item = K>,
Creates a new multi row INSERT
statement for the given table.
pub fn multi<K, I>(columns: I) -> MultiRowInsert<'a>where K: Into<Column<'a>>, I: IntoIterator<Item = K>,
pub fn expression_into<T, I, K, E>(table: T, columns: I, expression: E) -> Selfwhere T: Into<Table<'a>>, I: IntoIterator<Item = K>, K: Into<Column<'a>>, E: Into<Expression<'a>>,
sourcepub fn on_conflict(self, on_conflict: OnConflict<'a>) -> Self
pub fn on_conflict(self, on_conflict: OnConflict<'a>) -> Self
Sets the conflict resolution strategy.
sourcepub fn returning<K, I>(self, columns: I) -> Selfwhere
K: Into<Column<'a>>,
I: IntoIterator<Item = K>,
pub fn returning<K, I>(self, columns: I) -> Selfwhere K: Into<Column<'a>>, I: IntoIterator<Item = K>,
Sets the returned columns.
Trait Implementations§
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<SingleRowInsert<'a>> for Insert<'a>
impl<'a> From<SingleRowInsert<'a>> for Insert<'a>
source§fn from(insert: SingleRowInsert<'a>) -> Self
fn from(insert: SingleRowInsert<'a>) -> Self
Converts to this type from the input type.
source§impl<'a> PartialEq<Insert<'a>> for Insert<'a>
impl<'a> PartialEq<Insert<'a>> for Insert<'a>
impl<'a> StructuralPartialEq for Insert<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for Insert<'a>
impl<'a> Send for Insert<'a>
impl<'a> Sync for Insert<'a>
impl<'a> Unpin for Insert<'a>
impl<'a> UnwindSafe for Insert<'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