mirror of https://github.com/AMT-Cheif/drift.git
Clarify schema introspection update snippet
This commit is contained in:
parent
a26cc44aaf
commit
27877a72e9
|
@ -25,16 +25,8 @@ extension FindById<Table extends HasResultSet, Row>
|
|||
}
|
||||
// #enddocregion findById
|
||||
|
||||
extension FindTodoEntryById on GeneratedDatabase {
|
||||
Todos get todos => Todos(this);
|
||||
|
||||
// #docregion findTodoEntryById
|
||||
Selectable<Todo> findTodoEntryById(int id) {
|
||||
return select(todos)..where((row) => row.id.equals(id));
|
||||
}
|
||||
// #enddocregion findTodoEntryById
|
||||
|
||||
// #docregion updateTitle
|
||||
// #docregion updateTitle
|
||||
extension UpdateTitle on DatabaseConnectionUser {
|
||||
Future<Row?> updateTitle<T extends TableInfo<Table, Row>, Row>(
|
||||
T table, int id, String newTitle) async {
|
||||
final columnsByName = table.columnsByName;
|
||||
|
@ -60,7 +52,17 @@ extension FindTodoEntryById on GeneratedDatabase {
|
|||
|
||||
return rows.singleOrNull;
|
||||
}
|
||||
// #enddocregion updateTitle
|
||||
}
|
||||
// #enddocregion updateTitle
|
||||
|
||||
extension FindTodoEntryById on GeneratedDatabase {
|
||||
Todos get todos => Todos(this);
|
||||
|
||||
// #docregion findTodoEntryById
|
||||
Selectable<Todo> findTodoEntryById(int id) {
|
||||
return select(todos)..where((row) => row.id.equals(id));
|
||||
}
|
||||
// #enddocregion findTodoEntryById
|
||||
|
||||
// #docregion updateTodo
|
||||
Future<Todo?> updateTodoTitle(int id, String newTitle) {
|
||||
|
|
|
@ -64,7 +64,7 @@ of the `id` column:
|
|||
|
||||
{% include "blocks/snippet" snippets = snippets name = 'updateTitle' %}
|
||||
|
||||
This method can then be called like this:
|
||||
In a database or database accessor class, the method can then be called like this:
|
||||
|
||||
{% include "blocks/snippet" snippets = snippets name = 'updateTodo' %}
|
||||
|
||||
|
@ -75,4 +75,4 @@ If you have questions about this, or have a suggestion for more examples to incl
|
|||
[ResultSetImplementation]: https://drift.simonbinder.eu/api/drift/resultsetimplementation-class
|
||||
[TableInfo]: https://drift.simonbinder.eu/api/drift/tableinfo-mixin
|
||||
[ViewInfo]: https://drift.simonbinder.eu/api/drift/viewinfo-class
|
||||
[GeneratedColumn]: https://drift.simonbinder.eu/api/drift/generatedcolumn-class
|
||||
[GeneratedColumn]: https://drift.simonbinder.eu/api/drift/generatedcolumn-class
|
||||
|
|
Loading…
Reference in New Issue