MCPcopy Create free account
hub / github.com/SeaQL/sea-orm / set

Method set

src/query/update.rs:187–201  ·  view source on GitHub ↗

Add the models to update to Self

(mut self, model: A)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 2

getMethod · 0.45
save_asMethod · 0.45

Tested by 1