upsert method

Future<List<UserProfileImage>> upsert(
  1. DatabaseSession session,
  2. List<UserProfileImage> rows, {
  3. required ColumnSelections<UserProfileImageTable> conflictColumns,
  4. ColumnSelections<UserProfileImageTable>? updateColumns,
  5. WhereExpressionBuilder<UserProfileImageTable>? updateWhere,
  6. Transaction? transaction,
})

Upserts all UserProfileImages 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 UserProfileImages 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<UserProfileImage>> upsert(
  _i1.DatabaseSession session,
  List<UserProfileImage> rows, {
  required _i1.ColumnSelections<UserProfileImageTable> conflictColumns,
  _i1.ColumnSelections<UserProfileImageTable>? updateColumns,
  _i1.WhereExpressionBuilder<UserProfileImageTable>? updateWhere,
  _i1.Transaction? transaction,
}) async {
  return session.db.upsert<UserProfileImage>(
    rows,
    conflictColumns: conflictColumns(UserProfileImage.t),
    updateColumns: updateColumns?.call(UserProfileImage.t),
    updateWhere: updateWhere?.call(UserProfileImage.t),
    transaction: transaction,
  );
}