diff --git a/docs/lib/snippets/modular/schema_inspection.dart b/docs/lib/snippets/modular/schema_inspection.dart index f3de4ab4..1bbd75e7 100644 --- a/docs/lib/snippets/modular/schema_inspection.dart +++ b/docs/lib/snippets/modular/schema_inspection.dart @@ -25,16 +25,8 @@ extension FindById } // #enddocregion findById -extension FindTodoEntryById on GeneratedDatabase { - Todos get todos => Todos(this); - - // #docregion findTodoEntryById - Selectable findTodoEntryById(int id) { - return select(todos)..where((row) => row.id.equals(id)); - } - // #enddocregion findTodoEntryById - - // #docregion updateTitle +// #docregion updateTitle +extension UpdateTitle on DatabaseConnectionUser { Future updateTitle, 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 findTodoEntryById(int id) { + return select(todos)..where((row) => row.id.equals(id)); + } + // #enddocregion findTodoEntryById // #docregion updateTodo Future updateTodoTitle(int id, String newTitle) { diff --git a/docs/pages/docs/Dart API/schema_inspection.md b/docs/pages/docs/Dart API/schema_inspection.md index 251fe081..bc596eaa 100644 --- a/docs/pages/docs/Dart API/schema_inspection.md +++ b/docs/pages/docs/Dart API/schema_inspection.md @@ -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 \ No newline at end of file +[GeneratedColumn]: https://drift.simonbinder.eu/api/drift/generatedcolumn-class