pub struct InsertQuery {
pub with: With,
pub table: TableRef,
pub overriding: Option<Overriding>,
pub values: Values,
pub conflict: Conflict,
pub returning: Returning,
}Expand description
A PostgreSQL INSERT.
From https://www.postgresql.org/docs/17/sql-insert.html:
[ WITH [ RECURSIVE ] with_query [, ...] ]
INSERT INTO table_name [ AS alias ] [ ( column_name [, ...] ) ]
[ OVERRIDING { SYSTEM | USER } VALUE ]
{ DEFAULT VALUES | VALUES ( { expression | DEFAULT } [, ...] ) [, ...] | query }
[ ON CONFLICT [ conflict_target ] conflict_action ]
[ RETURNING … ]The row source is one of three alternatives, and DEFAULT VALUES is the one
Values cannot represent — an absent clause has to render nothing, and the
spelling is not shared with MySQL anyway. So an empty Values is what
DEFAULT VALUES is here, and this query writes the keywords itself.
Fields§
§with: WithWITH ….
table: TableRefThe target: table, optional alias, and the insert column list.
overriding: Option<Overriding>OVERRIDING … VALUE.
values: ValuesThe rows, or the query to insert the results of. Empty means
DEFAULT VALUES.
conflict: ConflictON CONFLICT ….
returning: ReturningRETURNING ….
Implementations§
Source§impl InsertQuery
impl InsertQuery
Sourcepub fn new() -> InsertQuery
pub fn new() -> InsertQuery
An INSERT with nothing set yet.
Sourcepub fn apply(&mut self, mods: impl Mod<InsertQuery>)
pub fn apply(&mut self, mods: impl Mod<InsertQuery>)
Apply more mods to an existing query.
Trait Implementations§
Source§impl Clone for InsertQuery
impl Clone for InsertQuery
Source§fn clone(&self) -> InsertQuery
fn clone(&self) -> InsertQuery
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for InsertQuery
impl Debug for InsertQuery
Source§impl Default for InsertQuery
impl Default for InsertQuery
Source§fn default() -> InsertQuery
fn default() -> InsertQuery
Returns the “default value” for a type. Read more
Source§impl Expression for InsertQuery
impl Expression for InsertQuery
Source§impl HasConflict for InsertQuery
impl HasConflict for InsertQuery
Source§fn conflict_mut(&mut self) -> &mut Conflict
fn conflict_mut(&mut self) -> &mut Conflict
The conflict slot to modify.
Source§impl HasReturning for InsertQuery
impl HasReturning for InsertQuery
Source§fn returning_mut(&mut self) -> &mut Returning
fn returning_mut(&mut self) -> &mut Returning
The
RETURNING clause to modify.Source§impl HasTableRef for InsertQuery
impl HasTableRef for InsertQuery
Source§fn table_ref_mut(&mut self) -> &mut TableRef
fn table_ref_mut(&mut self) -> &mut TableRef
The table reference to modify.
Source§impl HasValues for InsertQuery
impl HasValues for InsertQuery
Source§fn values_mut(&mut self) -> &mut Values
fn values_mut(&mut self) -> &mut Values
The row source to modify.
Source§impl HasWith for InsertQuery
impl HasWith for InsertQuery
Source§impl IntoExprList for InsertQuery
impl IntoExprList for InsertQuery
Source§fn into_expr_list(self) -> Vec<Expr>
fn into_expr_list(self) -> Vec<Expr>
Perform the conversion.
Source§impl Query for InsertQuery
impl Query for InsertQuery
Source§impl<H, L, M> QueryExtensions<H, L, M> for InsertQuery
impl<H, L, M> QueryExtensions<H, L, M> for InsertQuery
Auto Trait Implementations§
impl !RefUnwindSafe for InsertQuery
impl !UnwindSafe for InsertQuery
impl Freeze for InsertQuery
impl Send for InsertQuery
impl Sync for InsertQuery
impl Unpin for InsertQuery
impl UnsafeUnpin for InsertQuery
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