Skip to main content

insert

Function insert 

Source
pub fn insert<T>(expr: impl IntoExpr<T>) -> Assignment<List<T>>
Expand description

Insert a value into a collection field.

Takes an expression of T (a single item) and produces an assignment for List<T> (the collection). The returned Assignment can be passed to any update builder setter that accepts impl Assign<List<T>>.

§Examples

ⓘ
user.update()
    .todos(stmt::insert(Todo::create().title("Buy groceries")))
    .exec(&mut db)
    .await?;