Struct Update
pub struct Update {
pub target: UpdateTarget,
pub assignments: Assignments,
pub filter: Filter,
pub condition: Condition,
pub returning: Option<Returning>,
}Expand description
An UPDATE statement that modifies existing records.
Combines a target (what to update), assignments (how to change fields), a filter (which records to update), an optional condition (a guard that must hold for the update to apply), and an optional returning clause.
§Examples
ⓘ
use toasty_core::stmt::{Update, UpdateTarget, Assignments, Filter, Condition};
use toasty_core::schema::app::ModelId;
let update = Update {
target: UpdateTarget::Model(ModelId(0)),
assignments: Assignments::default(),
filter: Filter::default(),
condition: Condition::default(),
returning: None,
};Fields§
§target: UpdateTargetThe target to update (model, table, or query).
assignments: AssignmentsThe field assignments to apply.
filter: FilterFilter selecting which records to update (WHERE clause).
condition: ConditionAn optional condition that must be satisfied for the update to apply.
Unlike filter, a condition failing does not produce an error but
silently skips the update.
returning: Option<Returning>Optional RETURNING clause.
Implementations§
Trait Implementations§
§impl<'a, T> IntoExprTarget<'a, T> for &'a Updatewhere
T: Resolve,
impl<'a, T> IntoExprTarget<'a, T> for &'a Updatewhere
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 Update
Auto Trait Implementations§
impl Freeze for Update
impl RefUnwindSafe for Update
impl Send for Update
impl Sync for Update
impl Unpin for Update
impl UnwindSafe for Update
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