bulkCreate method
- Iterable<
Insertable< f($Dataclass> >- $CreateCompanionCallback o
- InsertMode? mode,
- UpsertClause<
$Table, $Dataclass> ? onConflict,
Create multiple rows in the table using the given function
All fields in a row that don't have a default value or auto-increment
must be set and non-null. Otherwise, an InvalidDataException will be
thrown.
By default, an exception will be thrown if another row with the same
primary key already exists. This behavior can be overridden with mode
,
for instance by using InsertMode.replace or InsertMode.insertOrIgnore.
Using bulkCreate will not disable primary keys or any column constraint
checks.
onConflict
can be used to create an upsert clause for engines that
support it. For details and examples, see InsertStatement.insert.
Implementation
Future<void> bulkCreate(
Iterable<Insertable<$Dataclass>> Function($CreateCompanionCallback o) f,
{InsertMode? mode,
UpsertClause<$Table, $Dataclass>? onConflict}) {
return $state.db.batch((b) => b.insertAll(
$state._tableAsTableInfo, f($state._createCompanionCallback),
mode: mode, onConflict: onConflict));
}