basic session create and delete

This commit is contained in:
Joshua Burman
2024-12-26 01:20:55 -05:00
parent 029f037f90
commit cd8da31f4b
6 changed files with 251 additions and 33 deletions

View File

@ -7,21 +7,12 @@ part 'sessions_dao.g.dart';
class SessionsDao extends DatabaseAccessor<AppDatabase> with _$SessionsDaoMixin {
SessionsDao(super.db);
Future<List<Session>> all() async {
return await select(sessions).get();
}
// Future<List<Session>> remove
// Future<List<Session>> all() => select(sessions).get();
// Stream<List<Session>> watch() => select(sessions).watch();
// Future insert(Session session) => into(sessions).insert(session);
Future<Session> find(int id) => (select(sessions)..where((session) => session.id.equals(id) )).getSingle();
Future<List<Session>> all() => select(sessions).get();
Stream<List<Session>> watch() => select(sessions).watch();
Future createOrUpdate(SessionsCompanion session) => into(sessions).insertOnConflictUpdate(session);
// Future replace(Session session) => update(sessions).replace(session);
Future remove(Session session) => delete(sessions).delete(session);
Future<Session> find(int id) async {
return await (select(sessions)..where((session) => session.id.equals(id) )).getSingle();
}
}