batchInsert

context(context: QueryExecutor)
abstract suspend fun batchInsert(entities: Iterable<T>): DbResult<List<T>>(source)

Inserts multiple entities into the data source using the specified driver context.

This method performs an asynchronous batch insert operation and returns the result. If the operation is successful, the result will contain the list of inserted entities. In case of failure, the result contains the error details.

Note: Batch insert is not supported for MySQL dialect (no multi-row INSERT with RETURNING).

Return

A DbResult containing the list of inserted entities of type T if the operation is successful, or an error if the operation fails.

Parameters

entities

The collection of entities of type T to be inserted into the data source.