upsert method
Future<List<UserProfile> >
upsert(
- DatabaseSession session,
- List<
UserProfile> rows, { - required ColumnSelections<
UserProfileTable> conflictColumns, - ColumnSelections<
UserProfileTable> ? updateColumns, - WhereExpressionBuilder<
UserProfileTable> ? updateWhere, - Transaction? transaction,
Upserts all UserProfiles in the list and returns the resulting rows.
If a row conflicts on the given conflictColumns, the existing row is
updated with the new values. Otherwise, a new row is inserted.
If updateColumns is provided, only those columns will be updated on
conflict. If null, all non-conflict, non-id columns are updated.
If updateWhere is provided, the update only applies to rows matching the
given expression. Conflicting rows that don't match are skipped and not
returned, so the resulting list may be shorter than rows.
The returned UserProfiles will have their id fields set.
This is an atomic operation, meaning that if one of the rows fails, none of the rows will be affected.
Implementation
Future<List<UserProfile>> upsert(
_i1.DatabaseSession session,
List<UserProfile> rows, {
required _i1.ColumnSelections<UserProfileTable> conflictColumns,
_i1.ColumnSelections<UserProfileTable>? updateColumns,
_i1.WhereExpressionBuilder<UserProfileTable>? updateWhere,
_i1.Transaction? transaction,
}) async {
return session.db.upsert<UserProfile>(
rows,
conflictColumns: conflictColumns(UserProfile.t),
updateColumns: updateColumns?.call(UserProfile.t),
updateWhere: updateWhere?.call(UserProfile.t),
transaction: transaction,
);
}