compileIncrement method

  1. @override
String compileIncrement(
  1. Map<String, dynamic> query,
  2. String column,
  3. int amount
)
override

Compile an increment statement into SQL.

Implementation

@override
String compileIncrement(
  Map<String, dynamic> query,
  String column,
  int amount,
) {
  final table = wrapTable(query['table']);
  final wrappedCol = wrap(column);
  final wheres = compileWheres(query['wheres'] ?? []);

  final sign = amount >= 0 ? '+' : '-';
  final absAmount = amount.abs();

  return 'UPDATE $table SET $wrappedCol = $wrappedCol $sign $absAmount $wheres'
      .trim();
}