123456789101112131415161718192021222324252627 |
- 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<MyDatabase> {
- DeviceInfoTableDao(MyDatabase db) : super(db);
- Future<int> addOneDeviceComp(DeviceInfoTableCompanion deviceInfoTableCompanion) async {
- return into(db.deviceInfoTable).insert(deviceInfoTableCompanion, mode: InsertMode.insertOrReplace);
- }
- Future<List<DeviceInfo>> queryAllDeviceInfo() async {
- int deviceInfoTableTime = UserService.get().getDeviceInfoTableTime();
- return (select(db.deviceInfoTable)
- ..where((tbl) => tbl.createdAt.isBiggerThanValue(deviceInfoTableTime))
- ..orderBy([(row) => OrderingTerm.asc(row.createdAt)])).get();
- }
- }
|