Skip to main content

batch_insert

Function batch_insert 

Source
pub fn batch_insert<M: Model>(
    models: &mut [M],
    executor: &mut impl Executor,
) -> OrmResult<()>
Expand description

Batch insert a slice of models in a single INSERT round-trip.

Generates INSERT INTO t (cols) VALUES ($1,$2),($3,$4),… with RETURNING for generated columns. Each model is mutated in-place to receive its generated values (e.g. auto-increment IDs).