update method
Updates one or more rows in the specified table.
data: Column values to update.where: Conditions to match rows (e.g.,{'id': 1}).
Implementation
@override
Future<DbResult> update(
String table,
Map<String, dynamic> data, {
required Map<String, dynamic> where,
}) async {
final sets = data.keys.map((k) => '$k = ${ph(k)}').join(', ');
final conditions = where.keys
.map((k) => '$k = ${ph('w_$k')}')
.join(' AND ');
final values = {
...data,
...{for (final k in where.keys) 'w_$k': where[k]},
};
return rawQuery(
'UPDATE $table SET $sets WHERE $conditions;',
values: values,
);
}