forked from lxm_tools/flutter-picgo
feature:完成通过数据库配置图床列表
This commit is contained in:
29
lib/utils/sql.dart
Normal file
29
lib/utils/sql.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import './db_provider.dart';
|
||||
import '../model/base.dart';
|
||||
|
||||
class Sql extends BaseModel {
|
||||
|
||||
final String tableName;
|
||||
|
||||
Sql.setTable(this.tableName) : super(DbProvider.db);
|
||||
|
||||
// sdf
|
||||
Future<List> get() async {
|
||||
return await this.query(tableName);
|
||||
}
|
||||
|
||||
String getTableName() {
|
||||
return tableName;
|
||||
}
|
||||
|
||||
Future<int> delete(String value, String key) async {
|
||||
return await this
|
||||
.db
|
||||
.delete(tableName, where: '$key = ?', whereArgs: [value]);
|
||||
}
|
||||
|
||||
Future<int> deleteAll() async {
|
||||
return await this.db.delete(tableName);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user