Skip to main content

sql_builder/query/update/
getters.rs

1use super::*;
2
3impl UpdateStatement {
4    /// Get column values
5    pub fn get_values(&self) -> &[(DynIden, Box<Expr>)] {
6        &self.values
7    }
8
9    /// The table targeted by this update.
10    pub fn get_table(&self) -> Option<&TableRef> {
11        self.table.as_deref()
12    }
13    /// Additional sources used by this update.
14    pub fn get_from(&self) -> &[TableRef] {
15        &self.from
16    }
17    /// Predicates, including their original logical chains.
18    pub fn get_where(&self) -> &ConditionHolder {
19        &self.r#where
20    }
21    /// Ordering used to choose rows.
22    pub fn get_orders(&self) -> &[OrderExpr] {
23        &self.orders
24    }
25    /// The maximum number of rows to update.
26    pub fn get_limit(&self) -> Option<u64> {
27        match self.limit {
28            Some(Value::BigUnsigned(Some(limit))) => Some(limit),
29            _ => None,
30        }
31    }
32    /// Common table expressions attached to this update.
33    pub fn get_with(&self) -> Option<&WithClause> {
34        self.with.as_ref()
35    }
36}