createRow method
Future<R>
createRow(
- List<
Assignment> assignments(- F
- ExecutionOptions options = const ExecutionOptions(),
Inserts and returns a complete row.
Uses RETURNING when supported. Otherwise inserts and reads the primary key on one transaction; keys must be literal values or one generated identity.
Implementation
Future<R> createRow(
List<Assignment> Function(F) assignments, {
ExecutionOptions options = const ExecutionOptions(),
}) async {
database.checkActive();
options.check();
preflightMutationQuery(queryState);
final plan = database.capabilities.returning ? SelectionPlan() : null;
if (plan != null) definition.selectRow(queryFields).bindSelection(plan);
final mutation = prepareInsert(
this,
assignments(queryFields),
plan,
needsRow: true,
);
return createPreparedRow(mutation, options: options);
}