import './db_provider.dart'; import '../model/base.dart'; class Sql extends BaseModel { final String tableName; Sql.setTable(this.tableName) : super(DbProvider.db); // sdf Future get() async { return await this.query(tableName); } Future getBySql(String where, List whereArgs) async { return await this.query(tableName, where: where, whereArgs: whereArgs); } Future rawUpdate(String sql, [List arguments]) async { return await this.db.rawUpdate('UPDATE $tableName SET $sql', arguments); } Future rawInsert(String valueNames, [List arguments]) async { return await this.db.rawInsert('INSERT INTO $tableName$valueNames', arguments); } Future rawDelete(String wheres, [List arguments]) async { return await this.db .rawDelete('DELETE FROM $tableName WHERE $wheres', arguments); } String getTableName() { return tableName; } Future deleteAll() async { return await this.db.delete(tableName); } }