import 'package:drift/drift.dart'; import 'package:lszlgl/drfit/database.dart'; import 'package:lszlgl/drfit/device_info_table.dart'; import 'package:lszlgl/service/user_service.dart'; part 'device_info_table_dao.g.dart'; @DriftAccessor(tables: [DeviceInfoTable]) class DeviceInfoTableDao extends DatabaseAccessor { DeviceInfoTableDao(MyDatabase db) : super(db); Future addOneDeviceComp(DeviceInfoTableCompanion deviceInfoTableCompanion) async { return into(db.deviceInfoTable).insert(deviceInfoTableCompanion, mode: InsertMode.insertOrReplace); } Future> queryAllDeviceInfo() async { int deviceInfoTableTime = UserService.get().getDeviceInfoTableTime(); return (select(db.deviceInfoTable) ..where((tbl) => tbl.createdAt.isBiggerThanValue(deviceInfoTableTime)) ..orderBy([(row) => OrderingTerm.asc(row.createdAt)])).get(); } }