update method
Executes an UPDATE query on the specified table
.
data
: Columns and values to update.where
: Conditions to match rows that should be updated. Returns the affected rows.
Implementation
@override
Future<DbResult> update(
String table,
Map<String, dynamic> data, {
required Map<String, dynamic> where,
}) async {
final sets = data.keys.map((k) => '$k = :$k').join(', ');
final conditions = where.keys.map((k) => '$k = :$k').join(' AND ');
final query = 'UPDATE $table SET $sets WHERE $conditions;';
return rawQuery(query, values: {...data, ...where});
}