delete method

  1. @override
Future delete(
  1. Entity entity,
  2. AccessOption? option
)
override

Deletes the entity from database.

  • option - an option for deleting this entity. It is the option, if any. passed from access.delete(). It is application specific, and not used in most implementations.

Implementation

@override
Future delete(Entity entity, AccessOption? option) async {
  var sql = 'delete from "${entity.otype}" where "oid"=@oid',
    data = {fdOid: entity.oid};

  if (entity is SqlFlavor) {
    final flavor = (entity as SqlFlavor).deleteFlavor;
    if (flavor != null) sql = flavor(sql, data);
  }

  await access.execute(sql, data);

  _cache?.remove(entity.otype, entity.oid); //update cache
}