updateOrCreate method
Future<TRow>
updateOrCreate(
- MssqlCondition where,
- TRow build(
- TRow? existing
- Set<
String> ? columns,
Updates the row matching where to build's, or inserts it.
The same two-round-trip caveat as firstOrCreate.
Implementation
Future<TRow> updateOrCreate(
MssqlCondition where,
TRow Function(TRow? existing) build, {
Set<String>? columns,
}) async {
final existing = await firstWhere(where);
final row = build(existing);
if (existing == null) return insert(row);
await update(row, columns: columns);
return row;
}