pub struct UpdateByKey {
pub table: TableId,
pub keys: Vec<Value>,
pub assignments: Assignments,
pub filter: Option<Expr>,
pub condition: Option<Expr>,
pub returning: Option<Vec<ColumnId>>,
}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: None,
};
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: Option<Vec<ColumnId>>The columns to return for each updated row.
None returns the affected-row count. Some(columns) returns one
record per updated row containing exactly these columns, in this order,
in the ExecResponse. The engine builds
this list explicitly, so the driver never has to infer which columns to
return from the assignments.
Trait Implementations§
Source§impl Clone for UpdateByKey
impl Clone for UpdateByKey
Source§fn clone(&self) -> UpdateByKey
fn clone(&self) -> UpdateByKey
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more