toasty_core/driver/operation/
update_by_key.rs

1use super::Operation;
2
3use crate::{schema::db::TableId, stmt};
4
5#[derive(Debug, Clone)]
6pub struct UpdateByKey {
7    /// Which table to update
8    pub table: TableId,
9
10    /// Which keys to update
11    pub keys: Vec<stmt::Value>,
12
13    /// How to update the table
14    pub assignments: stmt::Assignments,
15
16    /// Only update keys that match the filter
17    pub filter: Option<stmt::Expr>,
18
19    /// Any conditions that must hold to apply the update
20    pub condition: Option<stmt::Expr>,
21
22    /// If true, then the driver should return a record for each instance of the
23    /// model that was updated.
24    pub returning: bool,
25}
26
27impl From<UpdateByKey> for Operation {
28    fn from(value: UpdateByKey) -> Self {
29        Self::UpdateByKey(value)
30    }
31}