import 'package:drift/drift.dart'; import '../database.dart'; import '../tables/tabelle.dart'; class TabelleDao { final AppDatabase db; TabelleDao(this.db); Future> getByTipo(String tipo) { return (db.select(db.tabelle)..where((t) => t.tipoTabella.equals(tipo))).get(); } Future getByCode(String tipo, String code) { return (db.select(db.tabelle) ..where((t) => t.tipoTabella.equals(tipo) & t.codTabella.equals(code)) ).getSingleOrNull(); } Future findById(int id) { return (db.select(db.tabelle)..where((t) => t.idTabella.equals(id))).getSingleOrNull(); } }