mirror of https://github.com/AMT-Cheif/drift.git
commit
9a0ea09be0
|
@ -16,7 +16,7 @@ part 'todos_dao.g.dart';
|
||||||
// fields for the tables. The <MyDatabase> type annotation is the database class
|
// fields for the tables. The <MyDatabase> type annotation is the database class
|
||||||
// that should use this dao.
|
// that should use this dao.
|
||||||
@UseDao(tables: [Todos])
|
@UseDao(tables: [Todos])
|
||||||
class TodosDao extends DatabaseAccessor<MyDatabase> with _TodosDaoMixin {
|
class TodosDao extends DatabaseAccessor<MyDatabase> with _$TodosDaoMixin {
|
||||||
// this constructor is required so that the main database can create an instance
|
// this constructor is required so that the main database can create an instance
|
||||||
// of this object.
|
// of this object.
|
||||||
TodosDao(MyDatabase db) : super(db);
|
TodosDao(MyDatabase db) : super(db);
|
||||||
|
@ -32,4 +32,4 @@ class TodosDao extends DatabaseAccessor<MyDatabase> with _TodosDaoMixin {
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
If we now change the annotation on the `MyDatabase` class to `@UseMoor(tables: [Todos, Categories], daos: [TodosDao])`
|
If we now change the annotation on the `MyDatabase` class to `@UseMoor(tables: [Todos, Categories], daos: [TodosDao])`
|
||||||
and re-run the code generation, a generated getter `todosDao` can be used to access the instance of that dao.
|
and re-run the code generation, a generated getter `todosDao` can be used to access the instance of that dao.
|
||||||
|
|
Loading…
Reference in New Issue