upsertRow method
Future<CrdtDataRow?>
upsertRow(
- DatabaseSession session,
- CrdtDataRow row, {
- required ColumnSelections<
CrdtDataRowTable> conflictColumns, - ColumnSelections<
CrdtDataRowTable> ? updateColumns, - WhereExpressionBuilder<
CrdtDataRowTable> ? updateWhere, - Transaction? transaction,
Upserts a single CrdtDataRow 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 CrdtDataRow will have its id field set.
Implementation
Future<CrdtDataRow?> upsertRow(
_isd.DatabaseSession session,
CrdtDataRow row, {
required _isd.ColumnSelections<CrdtDataRowTable> conflictColumns,
_isd.ColumnSelections<CrdtDataRowTable>? updateColumns,
_isd.WhereExpressionBuilder<CrdtDataRowTable>? updateWhere,
_isd.Transaction? transaction,
}) async {
return session.db.upsertRow<CrdtDataRow>(
row,
conflictColumns: conflictColumns(CrdtDataRow.t),
updateColumns: updateColumns?.call(CrdtDataRow.t),
updateWhere: updateWhere?.call(CrdtDataRow.t),
transaction: transaction,
);
}