upsertRow method

Future<UserProfile?> upsertRow(
  1. DatabaseSession session,
  2. UserProfile row, {
  3. required ColumnSelections<UserProfileTable> conflictColumns,
  4. ColumnSelections<UserProfileTable>? updateColumns,
  5. WhereExpressionBuilder<UserProfileTable>? updateWhere,
  6. Transaction? transaction,
})

Upserts a single UserProfile and returns the resulting row.

If the row conflicts on the given conflictColumns, the existing row is updated. 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 when the existing row matches the expression. Returns null if no row was affected — for example when updateWhere does not match the conflicting row.

The returned UserProfile will have its id field set.

Implementation

Future<UserProfile?> upsertRow(
  _i1.DatabaseSession session,
  UserProfile row, {
  required _i1.ColumnSelections<UserProfileTable> conflictColumns,
  _i1.ColumnSelections<UserProfileTable>? updateColumns,
  _i1.WhereExpressionBuilder<UserProfileTable>? updateWhere,
  _i1.Transaction? transaction,
}) async {
  return session.db.upsertRow<UserProfile>(
    row,
    conflictColumns: conflictColumns(UserProfile.t),
    updateColumns: updateColumns?.call(UserProfile.t),
    updateWhere: updateWhere?.call(UserProfile.t),
    transaction: transaction,
  );
}