delete method

Future<int> delete(
  1. TKey key
)

Deletes the row with this key.

A soft-deleting table writes its deleted-at column instead. forceDelete removes the row for real, and is named rather than implied so a caller does not erase a row while believing they hid it.

Implementation

Future<int> delete(TKey key) async {
  _requireKey('delete');
  final soft = binding.softDelete;
  if (soft != null) {
    return _softDelete(_keyCondition(key), soft);
  }
  final engine = await _engine();
  final outcome = await engine.deleteWhere(
    operation: 'delete',
    where: <MssqlCondition>[_keyCondition(key)],
    scopes: _scopeConditions,
  );
  return outcome.affectedRows;
}