Struct Insert
pub struct Insert {
pub target: InsertTarget,
pub source: Query,
pub returning: Option<Returning>,
}Expand description
An INSERT statement that creates new records.
Combines an InsertTarget (where to insert), a Query source
(the values to insert), and an optional Returning clause.
§Examples
ⓘ
use toasty_core::stmt::{Insert, InsertTarget, Query, Values, Expr};
use toasty_core::schema::app::ModelId;
let insert = Insert {
target: InsertTarget::Model(ModelId(0)),
source: Query::values(Values::new(vec![Expr::null()])),
returning: None,
};
assert!(insert.target.is_model());Fields§
§target: InsertTargetThe target to insert into (model, table, or scoped query).
source: QueryThe source query providing values to insert.
returning: Option<Returning>Optional RETURNING clause to return data from the insertion.
Implementations§
Trait Implementations§
§impl<'a, T> IntoExprTarget<'a, T> for &'a Insertwhere
T: Resolve,
impl<'a, T> IntoExprTarget<'a, T> for &'a Insertwhere
T: Resolve,
§fn into_expr_target(self, schema: &'a T) -> ExprTarget<'a>
fn into_expr_target(self, schema: &'a T) -> ExprTarget<'a>
Converts
self into an ExprTarget using the provided schema.impl StructuralPartialEq for Insert
Auto Trait Implementations§
impl Freeze for Insert
impl RefUnwindSafe for Insert
impl Send for Insert
impl Sync for Insert
impl Unpin for Insert
impl UnwindSafe for Insert
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