pub struct UpdateByKey {
pub table: TableId,
pub keys: Vec<Value>,
pub assignments: Assignments,
pub filter: Option<Expr>,
pub condition: Option<Expr>,
pub returning: bool,
}Expand description
Updates one or more records identified by primary key.
Used by key-value drivers. SQL drivers receive an equivalent UPDATE
statement via QuerySql instead. Supports conditional
updates and optionally returns the updated records.
§Examples
ⓘ
use toasty_core::driver::operation::{UpdateByKey, Operation};
let op = UpdateByKey {
table: table_id,
keys: vec![key_value],
assignments: assignments,
filter: None,
condition: None,
returning: true,
};
let operation: Operation = op.into();Fields§
§table: TableIdThe table to update.
keys: Vec<Value>Primary key values identifying the records to update.
assignments: AssignmentsColumn assignments describing how to modify the records.
filter: Option<Expr>Optional filter expression. When set, only records whose key is in
keys and that match this filter are updated.
condition: Option<Expr>Optional precondition that must hold for the update to be applied.
Unlike filter, a failed condition typically causes an error rather
than silently skipping the row.
returning: boolWhen true, the driver returns the full record for each updated row
in the ExecResponse.
Trait Implementations§
Source§impl Clone for UpdateByKey
impl Clone for UpdateByKey
Source§fn clone(&self) -> UpdateByKey
fn clone(&self) -> UpdateByKey
Returns a duplicate 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 Debug for UpdateByKey
impl Debug for UpdateByKey
Source§impl From<UpdateByKey> for Operation
impl From<UpdateByKey> for Operation
Source§fn from(value: UpdateByKey) -> Self
fn from(value: UpdateByKey) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for UpdateByKey
impl RefUnwindSafe for UpdateByKey
impl Send for UpdateByKey
impl Sync for UpdateByKey
impl Unpin for UpdateByKey
impl UnwindSafe for UpdateByKey
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