pub fn remove<T>(expr: impl IntoExpr<T>) -> Assignment<List<T>>Expand description
Remove a value from a collection field.
Takes an expression of T (the item to remove) and produces an assignment
for List<T> (the collection).
What “remove” means depends on the field kind:
Vec<scalar>field: every element equal to the value is removed, atomically against the existing column value. Backends that advertiseCapability::vec_removesupport this — currently PostgreSQL only; other backends return an error.- Has-many relation: the related record is dissociated. With an
optional foreign key the FK is set to
NULL; with a required foreign key the related record is deleted.
§Examples
ⓘ
// Vec<String> field
user.update()
.tags(stmt::remove("admin"))
.exec(&mut db)
.await?;
// Has-many relation
user.update()
.todos(stmt::remove(&todo_a))
.exec(&mut db)
.await?;