Add the models to update to Self
(mut self, model: A)
| 185 | { |
| 186 | /// Add the models to update to Self |
| 187 | pub fn set<A>(mut self, model: A) -> Self |
| 188 | where |
| 189 | A: ActiveModelTrait<Entity = E>, |
| 190 | { |
| 191 | for col in E::Column::iter() { |
| 192 | match model.get(col) { |
| 193 | ActiveValue::Set(value) => { |
| 194 | let expr = col.save_as(Expr::val(value)); |
| 195 | self.query.value(col, expr); |
| 196 | } |
| 197 | ActiveValue::Unchanged(_) | ActiveValue::NotSet => {} |
| 198 | } |
| 199 | } |
| 200 | self |
| 201 | } |
| 202 | |
| 203 | /// Creates a [SimpleExpr] from a column |
| 204 | pub fn col_expr<T>(mut self, col: T, expr: SimpleExpr) -> Self |