diff --git a/docs/lib/snippets/_shared/todo_tables.drift.dart b/docs/lib/snippets/_shared/todo_tables.drift.dart index eccebd59d..bcc944336 100644 --- a/docs/lib/snippets/_shared/todo_tables.drift.dart +++ b/docs/lib/snippets/_shared/todo_tables.drift.dart @@ -4,6 +4,516 @@ import 'package:drift_docs/snippets/_shared/todo_tables.drift.dart' as i1; import 'package:drift_docs/snippets/_shared/todo_tables.dart' as i2; import 'package:drift/internal/modular.dart' as i3; +typedef $$TodoItemsTableCreateCompanionBuilder = i1.TodoItemsCompanion + Function({ + i0.Value id, + required String title, + required String content, + i0.Value category, + i0.Value dueDate, +}); +typedef $$TodoItemsTableUpdateCompanionBuilder = i1.TodoItemsCompanion + Function({ + i0.Value id, + i0.Value title, + i0.Value content, + i0.Value category, + i0.Value dueDate, +}); + +class $$TodoItemsTableFilterComposer + extends i0.Composer { + $$TodoItemsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get title => $composableBuilder( + column: $table.title, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get content => $composableBuilder( + column: $table.content, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get dueDate => $composableBuilder( + column: $table.dueDate, builder: (column) => i0.ColumnFilters(column)); + + i1.$$CategoriesTableFilterComposer get category { + final i1.$$CategoriesTableFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.category, + referencedTable: i3.ReadDatabaseContainer($db) + .resultSet('categories'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$$CategoriesTableFilterComposer( + $db: $db, + $table: i3.ReadDatabaseContainer($db) + .resultSet('categories'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $$TodoItemsTableOrderingComposer + extends i0.Composer { + $$TodoItemsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get title => $composableBuilder( + column: $table.title, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get content => $composableBuilder( + column: $table.content, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get dueDate => $composableBuilder( + column: $table.dueDate, builder: (column) => i0.ColumnOrderings(column)); + + i1.$$CategoriesTableOrderingComposer get category { + final i1.$$CategoriesTableOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.category, + referencedTable: i3.ReadDatabaseContainer($db) + .resultSet('categories'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$$CategoriesTableOrderingComposer( + $db: $db, + $table: i3.ReadDatabaseContainer($db) + .resultSet('categories'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $$TodoItemsTableAnnotationComposer + extends i0.Composer { + $$TodoItemsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get title => + $composableBuilder(column: $table.title, builder: (column) => column); + + i0.GeneratedColumn get content => + $composableBuilder(column: $table.content, builder: (column) => column); + + i0.GeneratedColumn get dueDate => + $composableBuilder(column: $table.dueDate, builder: (column) => column); + + i1.$$CategoriesTableAnnotationComposer get category { + final i1.$$CategoriesTableAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.category, + referencedTable: i3.ReadDatabaseContainer($db) + .resultSet('categories'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$$CategoriesTableAnnotationComposer( + $db: $db, + $table: i3.ReadDatabaseContainer($db) + .resultSet('categories'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $$TodoItemsTableTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.$TodoItemsTable, + i1.TodoItem, + i1.$$TodoItemsTableFilterComposer, + i1.$$TodoItemsTableOrderingComposer, + i1.$$TodoItemsTableAnnotationComposer, + $$TodoItemsTableCreateCompanionBuilder, + $$TodoItemsTableUpdateCompanionBuilder, + ( + i1.TodoItem, + i0.BaseReferences + ), + i1.TodoItem, + i0.PrefetchHooks Function({bool category})> { + $$TodoItemsTableTableManager( + i0.GeneratedDatabase db, i1.$TodoItemsTable table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$$TodoItemsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$$TodoItemsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$$TodoItemsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value title = const i0.Value.absent(), + i0.Value content = const i0.Value.absent(), + i0.Value category = const i0.Value.absent(), + i0.Value dueDate = const i0.Value.absent(), + }) => + i1.TodoItemsCompanion( + id: id, + title: title, + content: content, + category: category, + dueDate: dueDate, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required String title, + required String content, + i0.Value category = const i0.Value.absent(), + i0.Value dueDate = const i0.Value.absent(), + }) => + i1.TodoItemsCompanion.insert( + id: id, + title: title, + content: content, + category: category, + dueDate: dueDate, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$TodoItemsTableProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.$TodoItemsTable, + i1.TodoItem, + i1.$$TodoItemsTableFilterComposer, + i1.$$TodoItemsTableOrderingComposer, + i1.$$TodoItemsTableAnnotationComposer, + $$TodoItemsTableCreateCompanionBuilder, + $$TodoItemsTableUpdateCompanionBuilder, + ( + i1.TodoItem, + i0.BaseReferences + ), + i1.TodoItem, + i0.PrefetchHooks Function({bool category})>; +typedef $$CategoriesTableCreateCompanionBuilder = i1.CategoriesCompanion + Function({ + i0.Value id, + required String name, +}); +typedef $$CategoriesTableUpdateCompanionBuilder = i1.CategoriesCompanion + Function({ + i0.Value id, + i0.Value name, +}); + +class $$CategoriesTableFilterComposer + extends i0.Composer { + $$CategoriesTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get name => $composableBuilder( + column: $table.name, builder: (column) => i0.ColumnFilters(column)); + + i0.Expression todoItemsRefs( + i0.Expression Function(i1.$$TodoItemsTableFilterComposer f) f) { + final i1.$$TodoItemsTableFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: i3.ReadDatabaseContainer($db) + .resultSet('todo_items'), + getReferencedColumn: (t) => t.category, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$$TodoItemsTableFilterComposer( + $db: $db, + $table: i3.ReadDatabaseContainer($db) + .resultSet('todo_items'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return f(composer); + } +} + +class $$CategoriesTableOrderingComposer + extends i0.Composer { + $$CategoriesTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get name => $composableBuilder( + column: $table.name, builder: (column) => i0.ColumnOrderings(column)); +} + +class $$CategoriesTableAnnotationComposer + extends i0.Composer { + $$CategoriesTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get name => + $composableBuilder(column: $table.name, builder: (column) => column); + + i0.Expression todoItemsRefs( + i0.Expression Function(i1.$$TodoItemsTableAnnotationComposer a) f) { + final i1.$$TodoItemsTableAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: i3.ReadDatabaseContainer($db) + .resultSet('todo_items'), + getReferencedColumn: (t) => t.category, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$$TodoItemsTableAnnotationComposer( + $db: $db, + $table: i3.ReadDatabaseContainer($db) + .resultSet('todo_items'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return f(composer); + } +} + +class $$CategoriesTableTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.$CategoriesTable, + i1.Category, + i1.$$CategoriesTableFilterComposer, + i1.$$CategoriesTableOrderingComposer, + i1.$$CategoriesTableAnnotationComposer, + $$CategoriesTableCreateCompanionBuilder, + $$CategoriesTableUpdateCompanionBuilder, + ( + i1.Category, + i0.BaseReferences + ), + i1.Category, + i0.PrefetchHooks Function({bool todoItemsRefs})> { + $$CategoriesTableTableManager( + i0.GeneratedDatabase db, i1.$CategoriesTable table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$$CategoriesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$$CategoriesTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$$CategoriesTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value name = const i0.Value.absent(), + }) => + i1.CategoriesCompanion( + id: id, + name: name, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required String name, + }) => + i1.CategoriesCompanion.insert( + id: id, + name: name, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$CategoriesTableProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.$CategoriesTable, + i1.Category, + i1.$$CategoriesTableFilterComposer, + i1.$$CategoriesTableOrderingComposer, + i1.$$CategoriesTableAnnotationComposer, + $$CategoriesTableCreateCompanionBuilder, + $$CategoriesTableUpdateCompanionBuilder, + ( + i1.Category, + i0.BaseReferences + ), + i1.Category, + i0.PrefetchHooks Function({bool todoItemsRefs})>; +typedef $$UsersTableCreateCompanionBuilder = i1.UsersCompanion Function({ + i0.Value id, + required DateTime birthDate, +}); +typedef $$UsersTableUpdateCompanionBuilder = i1.UsersCompanion Function({ + i0.Value id, + i0.Value birthDate, +}); + +class $$UsersTableFilterComposer + extends i0.Composer { + $$UsersTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get birthDate => $composableBuilder( + column: $table.birthDate, builder: (column) => i0.ColumnFilters(column)); +} + +class $$UsersTableOrderingComposer + extends i0.Composer { + $$UsersTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get birthDate => $composableBuilder( + column: $table.birthDate, + builder: (column) => i0.ColumnOrderings(column)); +} + +class $$UsersTableAnnotationComposer + extends i0.Composer { + $$UsersTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get birthDate => + $composableBuilder(column: $table.birthDate, builder: (column) => column); +} + +class $$UsersTableTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.$UsersTable, + i1.User, + i1.$$UsersTableFilterComposer, + i1.$$UsersTableOrderingComposer, + i1.$$UsersTableAnnotationComposer, + $$UsersTableCreateCompanionBuilder, + $$UsersTableUpdateCompanionBuilder, + (i1.User, i0.BaseReferences), + i1.User, + i0.PrefetchHooks Function()> { + $$UsersTableTableManager(i0.GeneratedDatabase db, i1.$UsersTable table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$$UsersTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$$UsersTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$$UsersTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value birthDate = const i0.Value.absent(), + }) => + i1.UsersCompanion( + id: id, + birthDate: birthDate, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required DateTime birthDate, + }) => + i1.UsersCompanion.insert( + id: id, + birthDate: birthDate, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$UsersTableProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.$UsersTable, + i1.User, + i1.$$UsersTableFilterComposer, + i1.$$UsersTableOrderingComposer, + i1.$$UsersTableAnnotationComposer, + $$UsersTableCreateCompanionBuilder, + $$UsersTableUpdateCompanionBuilder, + (i1.User, i0.BaseReferences), + i1.User, + i0.PrefetchHooks Function()>; + class $TodoItemsTable extends i2.TodoItems with i0.TableInfo<$TodoItemsTable, i1.TodoItem> { @override @@ -311,232 +821,6 @@ class TodoItemsCompanion extends i0.UpdateCompanion { } } -typedef $$TodoItemsTableCreateCompanionBuilder = i1.TodoItemsCompanion - Function({ - i0.Value id, - required String title, - required String content, - i0.Value category, - i0.Value dueDate, -}); -typedef $$TodoItemsTableUpdateCompanionBuilder = i1.TodoItemsCompanion - Function({ - i0.Value id, - i0.Value title, - i0.Value content, - i0.Value category, - i0.Value dueDate, -}); - -class $$TodoItemsTableFilterComposer - extends i0.Composer { - $$TodoItemsTableFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get title => $composableBuilder( - column: $table.title, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get content => $composableBuilder( - column: $table.content, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get dueDate => $composableBuilder( - column: $table.dueDate, builder: (column) => i0.ColumnFilters(column)); - - i1.$$CategoriesTableFilterComposer get category { - final i1.$$CategoriesTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.category, - referencedTable: i3.ReadDatabaseContainer($db) - .resultSet('categories'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$$CategoriesTableFilterComposer( - $db: $db, - $table: i3.ReadDatabaseContainer($db) - .resultSet('categories'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $$TodoItemsTableOrderingComposer - extends i0.Composer { - $$TodoItemsTableOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get title => $composableBuilder( - column: $table.title, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get content => $composableBuilder( - column: $table.content, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get dueDate => $composableBuilder( - column: $table.dueDate, builder: (column) => i0.ColumnOrderings(column)); - - i1.$$CategoriesTableOrderingComposer get category { - final i1.$$CategoriesTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.category, - referencedTable: i3.ReadDatabaseContainer($db) - .resultSet('categories'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$$CategoriesTableOrderingComposer( - $db: $db, - $table: i3.ReadDatabaseContainer($db) - .resultSet('categories'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $$TodoItemsTableAnnotationComposer - extends i0.Composer { - $$TodoItemsTableAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get title => - $composableBuilder(column: $table.title, builder: (column) => column); - - i0.GeneratedColumn get content => - $composableBuilder(column: $table.content, builder: (column) => column); - - i0.GeneratedColumn get dueDate => - $composableBuilder(column: $table.dueDate, builder: (column) => column); - - i1.$$CategoriesTableAnnotationComposer get category { - final i1.$$CategoriesTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.category, - referencedTable: i3.ReadDatabaseContainer($db) - .resultSet('categories'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$$CategoriesTableAnnotationComposer( - $db: $db, - $table: i3.ReadDatabaseContainer($db) - .resultSet('categories'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $$TodoItemsTableTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.$TodoItemsTable, - i1.TodoItem, - i1.$$TodoItemsTableFilterComposer, - i1.$$TodoItemsTableOrderingComposer, - i1.$$TodoItemsTableAnnotationComposer, - $$TodoItemsTableCreateCompanionBuilder, - $$TodoItemsTableUpdateCompanionBuilder, - ( - i1.TodoItem, - i0.BaseReferences - ), - i1.TodoItem, - i0.PrefetchHooks Function({bool category})> { - $$TodoItemsTableTableManager( - i0.GeneratedDatabase db, i1.$TodoItemsTable table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$$TodoItemsTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$$TodoItemsTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$$TodoItemsTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value title = const i0.Value.absent(), - i0.Value content = const i0.Value.absent(), - i0.Value category = const i0.Value.absent(), - i0.Value dueDate = const i0.Value.absent(), - }) => - i1.TodoItemsCompanion( - id: id, - title: title, - content: content, - category: category, - dueDate: dueDate, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required String title, - required String content, - i0.Value category = const i0.Value.absent(), - i0.Value dueDate = const i0.Value.absent(), - }) => - i1.TodoItemsCompanion.insert( - id: id, - title: title, - content: content, - category: category, - dueDate: dueDate, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $$TodoItemsTableProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.$TodoItemsTable, - i1.TodoItem, - i1.$$TodoItemsTableFilterComposer, - i1.$$TodoItemsTableOrderingComposer, - i1.$$TodoItemsTableAnnotationComposer, - $$TodoItemsTableCreateCompanionBuilder, - $$TodoItemsTableUpdateCompanionBuilder, - ( - i1.TodoItem, - i0.BaseReferences - ), - i1.TodoItem, - i0.PrefetchHooks Function({bool category})>; - class $CategoriesTable extends i2.Categories with i0.TableInfo<$CategoriesTable, i1.Category> { @override @@ -715,130 +999,6 @@ class CategoriesCompanion extends i0.UpdateCompanion { } } -typedef $$CategoriesTableCreateCompanionBuilder = i1.CategoriesCompanion - Function({ - i0.Value id, - required String name, -}); -typedef $$CategoriesTableUpdateCompanionBuilder = i1.CategoriesCompanion - Function({ - i0.Value id, - i0.Value name, -}); - -class $$CategoriesTableFilterComposer - extends i0.Composer { - $$CategoriesTableFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get name => $composableBuilder( - column: $table.name, builder: (column) => i0.ColumnFilters(column)); -} - -class $$CategoriesTableOrderingComposer - extends i0.Composer { - $$CategoriesTableOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get name => $composableBuilder( - column: $table.name, builder: (column) => i0.ColumnOrderings(column)); -} - -class $$CategoriesTableAnnotationComposer - extends i0.Composer { - $$CategoriesTableAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get name => - $composableBuilder(column: $table.name, builder: (column) => column); -} - -class $$CategoriesTableTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.$CategoriesTable, - i1.Category, - i1.$$CategoriesTableFilterComposer, - i1.$$CategoriesTableOrderingComposer, - i1.$$CategoriesTableAnnotationComposer, - $$CategoriesTableCreateCompanionBuilder, - $$CategoriesTableUpdateCompanionBuilder, - ( - i1.Category, - i0.BaseReferences - ), - i1.Category, - i0.PrefetchHooks Function()> { - $$CategoriesTableTableManager( - i0.GeneratedDatabase db, i1.$CategoriesTable table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$$CategoriesTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$$CategoriesTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$$CategoriesTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value name = const i0.Value.absent(), - }) => - i1.CategoriesCompanion( - id: id, - name: name, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required String name, - }) => - i1.CategoriesCompanion.insert( - id: id, - name: name, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $$CategoriesTableProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.$CategoriesTable, - i1.Category, - i1.$$CategoriesTableFilterComposer, - i1.$$CategoriesTableOrderingComposer, - i1.$$CategoriesTableAnnotationComposer, - $$CategoriesTableCreateCompanionBuilder, - $$CategoriesTableUpdateCompanionBuilder, - ( - i1.Category, - i0.BaseReferences - ), - i1.Category, - i0.PrefetchHooks Function()>; - class $UsersTable extends i2.Users with i0.TableInfo<$UsersTable, i1.User> { @override final i0.GeneratedDatabase attachedDatabase; @@ -1018,119 +1178,3 @@ class UsersCompanion extends i0.UpdateCompanion { .toString(); } } - -typedef $$UsersTableCreateCompanionBuilder = i1.UsersCompanion Function({ - i0.Value id, - required DateTime birthDate, -}); -typedef $$UsersTableUpdateCompanionBuilder = i1.UsersCompanion Function({ - i0.Value id, - i0.Value birthDate, -}); - -class $$UsersTableFilterComposer - extends i0.Composer { - $$UsersTableFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get birthDate => $composableBuilder( - column: $table.birthDate, builder: (column) => i0.ColumnFilters(column)); -} - -class $$UsersTableOrderingComposer - extends i0.Composer { - $$UsersTableOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get birthDate => $composableBuilder( - column: $table.birthDate, - builder: (column) => i0.ColumnOrderings(column)); -} - -class $$UsersTableAnnotationComposer - extends i0.Composer { - $$UsersTableAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get birthDate => - $composableBuilder(column: $table.birthDate, builder: (column) => column); -} - -class $$UsersTableTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.$UsersTable, - i1.User, - i1.$$UsersTableFilterComposer, - i1.$$UsersTableOrderingComposer, - i1.$$UsersTableAnnotationComposer, - $$UsersTableCreateCompanionBuilder, - $$UsersTableUpdateCompanionBuilder, - (i1.User, i0.BaseReferences), - i1.User, - i0.PrefetchHooks Function()> { - $$UsersTableTableManager(i0.GeneratedDatabase db, i1.$UsersTable table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$$UsersTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$$UsersTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$$UsersTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value birthDate = const i0.Value.absent(), - }) => - i1.UsersCompanion( - id: id, - birthDate: birthDate, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required DateTime birthDate, - }) => - i1.UsersCompanion.insert( - id: id, - birthDate: birthDate, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $$UsersTableProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.$UsersTable, - i1.User, - i1.$$UsersTableFilterComposer, - i1.$$UsersTableOrderingComposer, - i1.$$UsersTableAnnotationComposer, - $$UsersTableCreateCompanionBuilder, - $$UsersTableUpdateCompanionBuilder, - (i1.User, i0.BaseReferences), - i1.User, - i0.PrefetchHooks Function()>; diff --git a/docs/lib/snippets/modular/custom_types/drift_table.drift.dart b/docs/lib/snippets/modular/custom_types/drift_table.drift.dart index c241c922c..4753fcbac 100644 --- a/docs/lib/snippets/modular/custom_types/drift_table.drift.dart +++ b/docs/lib/snippets/modular/custom_types/drift_table.drift.dart @@ -4,6 +4,148 @@ import 'package:drift_docs/snippets/modular/custom_types/drift_table.drift.dart' as i1; import 'package:drift_docs/snippets/modular/custom_types/type.dart' as i2; +typedef $PeriodicRemindersCreateCompanionBuilder = i1.PeriodicRemindersCompanion + Function({ + i0.Value id, + required Duration frequency, + required String reminder, +}); +typedef $PeriodicRemindersUpdateCompanionBuilder = i1.PeriodicRemindersCompanion + Function({ + i0.Value id, + i0.Value frequency, + i0.Value reminder, +}); + +class $PeriodicRemindersFilterComposer + extends i0.Composer { + $PeriodicRemindersFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get frequency => $composableBuilder( + column: $table.frequency, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get reminder => $composableBuilder( + column: $table.reminder, builder: (column) => i0.ColumnFilters(column)); +} + +class $PeriodicRemindersOrderingComposer + extends i0.Composer { + $PeriodicRemindersOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get frequency => $composableBuilder( + column: $table.frequency, + builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get reminder => $composableBuilder( + column: $table.reminder, builder: (column) => i0.ColumnOrderings(column)); +} + +class $PeriodicRemindersAnnotationComposer + extends i0.Composer { + $PeriodicRemindersAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get frequency => + $composableBuilder(column: $table.frequency, builder: (column) => column); + + i0.GeneratedColumn get reminder => + $composableBuilder(column: $table.reminder, builder: (column) => column); +} + +class $PeriodicRemindersTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.PeriodicReminders, + i1.PeriodicReminder, + i1.$PeriodicRemindersFilterComposer, + i1.$PeriodicRemindersOrderingComposer, + i1.$PeriodicRemindersAnnotationComposer, + $PeriodicRemindersCreateCompanionBuilder, + $PeriodicRemindersUpdateCompanionBuilder, + ( + i1.PeriodicReminder, + i0.BaseReferences + ), + i1.PeriodicReminder, + i0.PrefetchHooks Function()> { + $PeriodicRemindersTableManager( + i0.GeneratedDatabase db, i1.PeriodicReminders table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$PeriodicRemindersFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$PeriodicRemindersOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$PeriodicRemindersAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value frequency = const i0.Value.absent(), + i0.Value reminder = const i0.Value.absent(), + }) => + i1.PeriodicRemindersCompanion( + id: id, + frequency: frequency, + reminder: reminder, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required Duration frequency, + required String reminder, + }) => + i1.PeriodicRemindersCompanion.insert( + id: id, + frequency: frequency, + reminder: reminder, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $PeriodicRemindersProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.PeriodicReminders, + i1.PeriodicReminder, + i1.$PeriodicRemindersFilterComposer, + i1.$PeriodicRemindersOrderingComposer, + i1.$PeriodicRemindersAnnotationComposer, + $PeriodicRemindersCreateCompanionBuilder, + $PeriodicRemindersUpdateCompanionBuilder, + ( + i1.PeriodicReminder, + i0.BaseReferences + ), + i1.PeriodicReminder, + i0.PrefetchHooks Function()>; + class PeriodicReminders extends i0.Table with i0.TableInfo { @override @@ -230,145 +372,3 @@ class PeriodicRemindersCompanion .toString(); } } - -typedef $PeriodicRemindersCreateCompanionBuilder = i1.PeriodicRemindersCompanion - Function({ - i0.Value id, - required Duration frequency, - required String reminder, -}); -typedef $PeriodicRemindersUpdateCompanionBuilder = i1.PeriodicRemindersCompanion - Function({ - i0.Value id, - i0.Value frequency, - i0.Value reminder, -}); - -class $PeriodicRemindersFilterComposer - extends i0.Composer { - $PeriodicRemindersFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get frequency => $composableBuilder( - column: $table.frequency, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get reminder => $composableBuilder( - column: $table.reminder, builder: (column) => i0.ColumnFilters(column)); -} - -class $PeriodicRemindersOrderingComposer - extends i0.Composer { - $PeriodicRemindersOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get frequency => $composableBuilder( - column: $table.frequency, - builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get reminder => $composableBuilder( - column: $table.reminder, builder: (column) => i0.ColumnOrderings(column)); -} - -class $PeriodicRemindersAnnotationComposer - extends i0.Composer { - $PeriodicRemindersAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get frequency => - $composableBuilder(column: $table.frequency, builder: (column) => column); - - i0.GeneratedColumn get reminder => - $composableBuilder(column: $table.reminder, builder: (column) => column); -} - -class $PeriodicRemindersTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.PeriodicReminders, - i1.PeriodicReminder, - i1.$PeriodicRemindersFilterComposer, - i1.$PeriodicRemindersOrderingComposer, - i1.$PeriodicRemindersAnnotationComposer, - $PeriodicRemindersCreateCompanionBuilder, - $PeriodicRemindersUpdateCompanionBuilder, - ( - i1.PeriodicReminder, - i0.BaseReferences - ), - i1.PeriodicReminder, - i0.PrefetchHooks Function()> { - $PeriodicRemindersTableManager( - i0.GeneratedDatabase db, i1.PeriodicReminders table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$PeriodicRemindersFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$PeriodicRemindersOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$PeriodicRemindersAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value frequency = const i0.Value.absent(), - i0.Value reminder = const i0.Value.absent(), - }) => - i1.PeriodicRemindersCompanion( - id: id, - frequency: frequency, - reminder: reminder, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required Duration frequency, - required String reminder, - }) => - i1.PeriodicRemindersCompanion.insert( - id: id, - frequency: frequency, - reminder: reminder, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $PeriodicRemindersProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.PeriodicReminders, - i1.PeriodicReminder, - i1.$PeriodicRemindersFilterComposer, - i1.$PeriodicRemindersOrderingComposer, - i1.$PeriodicRemindersAnnotationComposer, - $PeriodicRemindersCreateCompanionBuilder, - $PeriodicRemindersUpdateCompanionBuilder, - ( - i1.PeriodicReminder, - i0.BaseReferences - ), - i1.PeriodicReminder, - i0.PrefetchHooks Function()>; diff --git a/docs/lib/snippets/modular/custom_types/table.drift.dart b/docs/lib/snippets/modular/custom_types/table.drift.dart index ba3c4bad8..43a07c047 100644 --- a/docs/lib/snippets/modular/custom_types/table.drift.dart +++ b/docs/lib/snippets/modular/custom_types/table.drift.dart @@ -5,6 +5,150 @@ import 'package:drift_docs/snippets/modular/custom_types/table.drift.dart' import 'package:drift_docs/snippets/modular/custom_types/type.dart' as i2; import 'package:drift_docs/snippets/modular/custom_types/table.dart' as i3; +typedef $$PeriodicRemindersTableCreateCompanionBuilder + = i1.PeriodicRemindersCompanion Function({ + i0.Value id, + i0.Value frequency, + required String reminder, +}); +typedef $$PeriodicRemindersTableUpdateCompanionBuilder + = i1.PeriodicRemindersCompanion Function({ + i0.Value id, + i0.Value frequency, + i0.Value reminder, +}); + +class $$PeriodicRemindersTableFilterComposer + extends i0.Composer { + $$PeriodicRemindersTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get frequency => $composableBuilder( + column: $table.frequency, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get reminder => $composableBuilder( + column: $table.reminder, builder: (column) => i0.ColumnFilters(column)); +} + +class $$PeriodicRemindersTableOrderingComposer + extends i0.Composer { + $$PeriodicRemindersTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get frequency => $composableBuilder( + column: $table.frequency, + builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get reminder => $composableBuilder( + column: $table.reminder, builder: (column) => i0.ColumnOrderings(column)); +} + +class $$PeriodicRemindersTableAnnotationComposer + extends i0.Composer { + $$PeriodicRemindersTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get frequency => + $composableBuilder(column: $table.frequency, builder: (column) => column); + + i0.GeneratedColumn get reminder => + $composableBuilder(column: $table.reminder, builder: (column) => column); +} + +class $$PeriodicRemindersTableTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.$PeriodicRemindersTable, + i1.PeriodicReminder, + i1.$$PeriodicRemindersTableFilterComposer, + i1.$$PeriodicRemindersTableOrderingComposer, + i1.$$PeriodicRemindersTableAnnotationComposer, + $$PeriodicRemindersTableCreateCompanionBuilder, + $$PeriodicRemindersTableUpdateCompanionBuilder, + ( + i1.PeriodicReminder, + i0.BaseReferences + ), + i1.PeriodicReminder, + i0.PrefetchHooks Function()> { + $$PeriodicRemindersTableTableManager( + i0.GeneratedDatabase db, i1.$PeriodicRemindersTable table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$$PeriodicRemindersTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => i1 + .$$PeriodicRemindersTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$$PeriodicRemindersTableAnnotationComposer( + $db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value frequency = const i0.Value.absent(), + i0.Value reminder = const i0.Value.absent(), + }) => + i1.PeriodicRemindersCompanion( + id: id, + frequency: frequency, + reminder: reminder, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value frequency = const i0.Value.absent(), + required String reminder, + }) => + i1.PeriodicRemindersCompanion.insert( + id: id, + frequency: frequency, + reminder: reminder, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$PeriodicRemindersTableProcessedTableManager + = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.$PeriodicRemindersTable, + i1.PeriodicReminder, + i1.$$PeriodicRemindersTableFilterComposer, + i1.$$PeriodicRemindersTableOrderingComposer, + i1.$$PeriodicRemindersTableAnnotationComposer, + $$PeriodicRemindersTableCreateCompanionBuilder, + $$PeriodicRemindersTableUpdateCompanionBuilder, + ( + i1.PeriodicReminder, + i0.BaseReferences + ), + i1.PeriodicReminder, + i0.PrefetchHooks Function()>; + class $PeriodicRemindersTable extends i3.PeriodicReminders with i0.TableInfo<$PeriodicRemindersTable, i1.PeriodicReminder> { @override @@ -228,147 +372,3 @@ class PeriodicRemindersCompanion .toString(); } } - -typedef $$PeriodicRemindersTableCreateCompanionBuilder - = i1.PeriodicRemindersCompanion Function({ - i0.Value id, - i0.Value frequency, - required String reminder, -}); -typedef $$PeriodicRemindersTableUpdateCompanionBuilder - = i1.PeriodicRemindersCompanion Function({ - i0.Value id, - i0.Value frequency, - i0.Value reminder, -}); - -class $$PeriodicRemindersTableFilterComposer - extends i0.Composer { - $$PeriodicRemindersTableFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get frequency => $composableBuilder( - column: $table.frequency, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get reminder => $composableBuilder( - column: $table.reminder, builder: (column) => i0.ColumnFilters(column)); -} - -class $$PeriodicRemindersTableOrderingComposer - extends i0.Composer { - $$PeriodicRemindersTableOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get frequency => $composableBuilder( - column: $table.frequency, - builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get reminder => $composableBuilder( - column: $table.reminder, builder: (column) => i0.ColumnOrderings(column)); -} - -class $$PeriodicRemindersTableAnnotationComposer - extends i0.Composer { - $$PeriodicRemindersTableAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get frequency => - $composableBuilder(column: $table.frequency, builder: (column) => column); - - i0.GeneratedColumn get reminder => - $composableBuilder(column: $table.reminder, builder: (column) => column); -} - -class $$PeriodicRemindersTableTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.$PeriodicRemindersTable, - i1.PeriodicReminder, - i1.$$PeriodicRemindersTableFilterComposer, - i1.$$PeriodicRemindersTableOrderingComposer, - i1.$$PeriodicRemindersTableAnnotationComposer, - $$PeriodicRemindersTableCreateCompanionBuilder, - $$PeriodicRemindersTableUpdateCompanionBuilder, - ( - i1.PeriodicReminder, - i0.BaseReferences - ), - i1.PeriodicReminder, - i0.PrefetchHooks Function()> { - $$PeriodicRemindersTableTableManager( - i0.GeneratedDatabase db, i1.$PeriodicRemindersTable table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$$PeriodicRemindersTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => i1 - .$$PeriodicRemindersTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$$PeriodicRemindersTableAnnotationComposer( - $db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value frequency = const i0.Value.absent(), - i0.Value reminder = const i0.Value.absent(), - }) => - i1.PeriodicRemindersCompanion( - id: id, - frequency: frequency, - reminder: reminder, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value frequency = const i0.Value.absent(), - required String reminder, - }) => - i1.PeriodicRemindersCompanion.insert( - id: id, - frequency: frequency, - reminder: reminder, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $$PeriodicRemindersTableProcessedTableManager - = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.$PeriodicRemindersTable, - i1.PeriodicReminder, - i1.$$PeriodicRemindersTableFilterComposer, - i1.$$PeriodicRemindersTableOrderingComposer, - i1.$$PeriodicRemindersTableAnnotationComposer, - $$PeriodicRemindersTableCreateCompanionBuilder, - $$PeriodicRemindersTableUpdateCompanionBuilder, - ( - i1.PeriodicReminder, - i0.BaseReferences - ), - i1.PeriodicReminder, - i0.PrefetchHooks Function()>; diff --git a/docs/lib/snippets/modular/drift/example.drift.dart b/docs/lib/snippets/modular/drift/example.drift.dart index 1a51533a6..4ad47ab1c 100644 --- a/docs/lib/snippets/modular/drift/example.drift.dart +++ b/docs/lib/snippets/modular/drift/example.drift.dart @@ -3,6 +3,375 @@ import 'package:drift/drift.dart' as i0; import 'package:drift_docs/snippets/modular/drift/example.drift.dart' as i1; import 'package:drift/internal/modular.dart' as i2; +typedef $TodosCreateCompanionBuilder = i1.TodosCompanion Function({ + i0.Value id, + required String title, + required String content, + i0.Value category, +}); +typedef $TodosUpdateCompanionBuilder = i1.TodosCompanion Function({ + i0.Value id, + i0.Value title, + i0.Value content, + i0.Value category, +}); + +class $TodosFilterComposer extends i0.Composer { + $TodosFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get title => $composableBuilder( + column: $table.title, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get content => $composableBuilder( + column: $table.content, builder: (column) => i0.ColumnFilters(column)); + + i1.$CategoriesFilterComposer get category { + final i1.$CategoriesFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.category, + referencedTable: i2.ReadDatabaseContainer($db) + .resultSet('categories'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$CategoriesFilterComposer( + $db: $db, + $table: i2.ReadDatabaseContainer($db) + .resultSet('categories'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $TodosOrderingComposer + extends i0.Composer { + $TodosOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get title => $composableBuilder( + column: $table.title, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get content => $composableBuilder( + column: $table.content, builder: (column) => i0.ColumnOrderings(column)); + + i1.$CategoriesOrderingComposer get category { + final i1.$CategoriesOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.category, + referencedTable: i2.ReadDatabaseContainer($db) + .resultSet('categories'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$CategoriesOrderingComposer( + $db: $db, + $table: i2.ReadDatabaseContainer($db) + .resultSet('categories'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $TodosAnnotationComposer + extends i0.Composer { + $TodosAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get title => + $composableBuilder(column: $table.title, builder: (column) => column); + + i0.GeneratedColumn get content => + $composableBuilder(column: $table.content, builder: (column) => column); + + i1.$CategoriesAnnotationComposer get category { + final i1.$CategoriesAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.category, + referencedTable: i2.ReadDatabaseContainer($db) + .resultSet('categories'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$CategoriesAnnotationComposer( + $db: $db, + $table: i2.ReadDatabaseContainer($db) + .resultSet('categories'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $TodosTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.Todos, + i1.Todo, + i1.$TodosFilterComposer, + i1.$TodosOrderingComposer, + i1.$TodosAnnotationComposer, + $TodosCreateCompanionBuilder, + $TodosUpdateCompanionBuilder, + (i1.Todo, i0.BaseReferences), + i1.Todo, + i0.PrefetchHooks Function({bool category})> { + $TodosTableManager(i0.GeneratedDatabase db, i1.Todos table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$TodosFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$TodosOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$TodosAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value title = const i0.Value.absent(), + i0.Value content = const i0.Value.absent(), + i0.Value category = const i0.Value.absent(), + }) => + i1.TodosCompanion( + id: id, + title: title, + content: content, + category: category, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required String title, + required String content, + i0.Value category = const i0.Value.absent(), + }) => + i1.TodosCompanion.insert( + id: id, + title: title, + content: content, + category: category, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $TodosProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.Todos, + i1.Todo, + i1.$TodosFilterComposer, + i1.$TodosOrderingComposer, + i1.$TodosAnnotationComposer, + $TodosCreateCompanionBuilder, + $TodosUpdateCompanionBuilder, + (i1.Todo, i0.BaseReferences), + i1.Todo, + i0.PrefetchHooks Function({bool category})>; +typedef $CategoriesCreateCompanionBuilder = i1.CategoriesCompanion Function({ + i0.Value id, + required String description, +}); +typedef $CategoriesUpdateCompanionBuilder = i1.CategoriesCompanion Function({ + i0.Value id, + i0.Value description, +}); + +class $CategoriesFilterComposer + extends i0.Composer { + $CategoriesFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get description => $composableBuilder( + column: $table.description, + builder: (column) => i0.ColumnFilters(column)); + + i0.Expression todosRefs( + i0.Expression Function(i1.$TodosFilterComposer f) f) { + final i1.$TodosFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: + i2.ReadDatabaseContainer($db).resultSet('todos'), + getReferencedColumn: (t) => t.category, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$TodosFilterComposer( + $db: $db, + $table: + i2.ReadDatabaseContainer($db).resultSet('todos'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return f(composer); + } +} + +class $CategoriesOrderingComposer + extends i0.Composer { + $CategoriesOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get description => $composableBuilder( + column: $table.description, + builder: (column) => i0.ColumnOrderings(column)); +} + +class $CategoriesAnnotationComposer + extends i0.Composer { + $CategoriesAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get description => $composableBuilder( + column: $table.description, builder: (column) => column); + + i0.Expression todosRefs( + i0.Expression Function(i1.$TodosAnnotationComposer a) f) { + final i1.$TodosAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: + i2.ReadDatabaseContainer($db).resultSet('todos'), + getReferencedColumn: (t) => t.category, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$TodosAnnotationComposer( + $db: $db, + $table: + i2.ReadDatabaseContainer($db).resultSet('todos'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return f(composer); + } +} + +class $CategoriesTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.Categories, + i1.Category, + i1.$CategoriesFilterComposer, + i1.$CategoriesOrderingComposer, + i1.$CategoriesAnnotationComposer, + $CategoriesCreateCompanionBuilder, + $CategoriesUpdateCompanionBuilder, + ( + i1.Category, + i0.BaseReferences + ), + i1.Category, + i0.PrefetchHooks Function({bool todosRefs})> { + $CategoriesTableManager(i0.GeneratedDatabase db, i1.Categories table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$CategoriesFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$CategoriesOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$CategoriesAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value description = const i0.Value.absent(), + }) => + i1.CategoriesCompanion( + id: id, + description: description, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required String description, + }) => + i1.CategoriesCompanion.insert( + id: id, + description: description, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $CategoriesProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.Categories, + i1.Category, + i1.$CategoriesFilterComposer, + i1.$CategoriesOrderingComposer, + i1.$CategoriesAnnotationComposer, + $CategoriesCreateCompanionBuilder, + $CategoriesUpdateCompanionBuilder, + ( + i1.Category, + i0.BaseReferences + ), + i1.Category, + i0.PrefetchHooks Function({bool todosRefs})>; + class Todos extends i0.Table with i0.TableInfo { @override final i0.GeneratedDatabase attachedDatabase; @@ -214,261 +583,60 @@ class TodosCompanion extends i0.UpdateCompanion { static i0.Insertable custom({ i0.Expression? id, i0.Expression? title, - i0.Expression? content, - i0.Expression? category, - }) { - return i0.RawValuesInsertable({ - if (id != null) 'id': id, - if (title != null) 'title': title, - if (content != null) 'content': content, - if (category != null) 'category': category, - }); - } - - i1.TodosCompanion copyWith( - {i0.Value? id, - i0.Value? title, - i0.Value? content, - i0.Value? category}) { - return i1.TodosCompanion( - id: id ?? this.id, - title: title ?? this.title, - content: content ?? this.content, - category: category ?? this.category, - ); - } - - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - if (id.present) { - map['id'] = i0.Variable(id.value); - } - if (title.present) { - map['title'] = i0.Variable(title.value); - } - if (content.present) { - map['content'] = i0.Variable(content.value); - } - if (category.present) { - map['category'] = i0.Variable(category.value); - } - return map; - } - - @override - String toString() { - return (StringBuffer('TodosCompanion(') - ..write('id: $id, ') - ..write('title: $title, ') - ..write('content: $content, ') - ..write('category: $category') - ..write(')')) - .toString(); - } -} - -typedef $TodosCreateCompanionBuilder = i1.TodosCompanion Function({ - i0.Value id, - required String title, - required String content, - i0.Value category, -}); -typedef $TodosUpdateCompanionBuilder = i1.TodosCompanion Function({ - i0.Value id, - i0.Value title, - i0.Value content, - i0.Value category, -}); - -class $TodosFilterComposer extends i0.Composer { - $TodosFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get title => $composableBuilder( - column: $table.title, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get content => $composableBuilder( - column: $table.content, builder: (column) => i0.ColumnFilters(column)); - - i1.$CategoriesFilterComposer get category { - final i1.$CategoriesFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.category, - referencedTable: i2.ReadDatabaseContainer($db) - .resultSet('categories'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$CategoriesFilterComposer( - $db: $db, - $table: i2.ReadDatabaseContainer($db) - .resultSet('categories'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $TodosOrderingComposer - extends i0.Composer { - $TodosOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get title => $composableBuilder( - column: $table.title, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get content => $composableBuilder( - column: $table.content, builder: (column) => i0.ColumnOrderings(column)); - - i1.$CategoriesOrderingComposer get category { - final i1.$CategoriesOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.category, - referencedTable: i2.ReadDatabaseContainer($db) - .resultSet('categories'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$CategoriesOrderingComposer( - $db: $db, - $table: i2.ReadDatabaseContainer($db) - .resultSet('categories'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $TodosAnnotationComposer - extends i0.Composer { - $TodosAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get title => - $composableBuilder(column: $table.title, builder: (column) => column); + i0.Expression? content, + i0.Expression? category, + }) { + return i0.RawValuesInsertable({ + if (id != null) 'id': id, + if (title != null) 'title': title, + if (content != null) 'content': content, + if (category != null) 'category': category, + }); + } - i0.GeneratedColumn get content => - $composableBuilder(column: $table.content, builder: (column) => column); + i1.TodosCompanion copyWith( + {i0.Value? id, + i0.Value? title, + i0.Value? content, + i0.Value? category}) { + return i1.TodosCompanion( + id: id ?? this.id, + title: title ?? this.title, + content: content ?? this.content, + category: category ?? this.category, + ); + } - i1.$CategoriesAnnotationComposer get category { - final i1.$CategoriesAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.category, - referencedTable: i2.ReadDatabaseContainer($db) - .resultSet('categories'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$CategoriesAnnotationComposer( - $db: $db, - $table: i2.ReadDatabaseContainer($db) - .resultSet('categories'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (id.present) { + map['id'] = i0.Variable(id.value); + } + if (title.present) { + map['title'] = i0.Variable(title.value); + } + if (content.present) { + map['content'] = i0.Variable(content.value); + } + if (category.present) { + map['category'] = i0.Variable(category.value); + } + return map; } -} -class $TodosTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.Todos, - i1.Todo, - i1.$TodosFilterComposer, - i1.$TodosOrderingComposer, - i1.$TodosAnnotationComposer, - $TodosCreateCompanionBuilder, - $TodosUpdateCompanionBuilder, - (i1.Todo, i0.BaseReferences), - i1.Todo, - i0.PrefetchHooks Function({bool category})> { - $TodosTableManager(i0.GeneratedDatabase db, i1.Todos table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$TodosFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$TodosOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$TodosAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value title = const i0.Value.absent(), - i0.Value content = const i0.Value.absent(), - i0.Value category = const i0.Value.absent(), - }) => - i1.TodosCompanion( - id: id, - title: title, - content: content, - category: category, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required String title, - required String content, - i0.Value category = const i0.Value.absent(), - }) => - i1.TodosCompanion.insert( - id: id, - title: title, - content: content, - category: category, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); + @override + String toString() { + return (StringBuffer('TodosCompanion(') + ..write('id: $id, ') + ..write('title: $title, ') + ..write('content: $content, ') + ..write('category: $category') + ..write(')')) + .toString(); + } } -typedef $TodosProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.Todos, - i1.Todo, - i1.$TodosFilterComposer, - i1.$TodosOrderingComposer, - i1.$TodosAnnotationComposer, - $TodosCreateCompanionBuilder, - $TodosUpdateCompanionBuilder, - (i1.Todo, i0.BaseReferences), - i1.Todo, - i0.PrefetchHooks Function({bool category})>; - class Categories extends i0.Table with i0.TableInfo { @override final i0.GeneratedDatabase attachedDatabase; @@ -654,129 +822,6 @@ class CategoriesCompanion extends i0.UpdateCompanion { } } -typedef $CategoriesCreateCompanionBuilder = i1.CategoriesCompanion Function({ - i0.Value id, - required String description, -}); -typedef $CategoriesUpdateCompanionBuilder = i1.CategoriesCompanion Function({ - i0.Value id, - i0.Value description, -}); - -class $CategoriesFilterComposer - extends i0.Composer { - $CategoriesFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get description => $composableBuilder( - column: $table.description, - builder: (column) => i0.ColumnFilters(column)); -} - -class $CategoriesOrderingComposer - extends i0.Composer { - $CategoriesOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get description => $composableBuilder( - column: $table.description, - builder: (column) => i0.ColumnOrderings(column)); -} - -class $CategoriesAnnotationComposer - extends i0.Composer { - $CategoriesAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get description => $composableBuilder( - column: $table.description, builder: (column) => column); -} - -class $CategoriesTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.Categories, - i1.Category, - i1.$CategoriesFilterComposer, - i1.$CategoriesOrderingComposer, - i1.$CategoriesAnnotationComposer, - $CategoriesCreateCompanionBuilder, - $CategoriesUpdateCompanionBuilder, - ( - i1.Category, - i0.BaseReferences - ), - i1.Category, - i0.PrefetchHooks Function()> { - $CategoriesTableManager(i0.GeneratedDatabase db, i1.Categories table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$CategoriesFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$CategoriesOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$CategoriesAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value description = const i0.Value.absent(), - }) => - i1.CategoriesCompanion( - id: id, - description: description, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required String description, - }) => - i1.CategoriesCompanion.insert( - id: id, - description: description, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $CategoriesProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.Categories, - i1.Category, - i1.$CategoriesFilterComposer, - i1.$CategoriesOrderingComposer, - i1.$CategoriesAnnotationComposer, - $CategoriesCreateCompanionBuilder, - $CategoriesUpdateCompanionBuilder, - ( - i1.Category, - i0.BaseReferences - ), - i1.Category, - i0.PrefetchHooks Function()>; - class ExampleDrift extends i2.ModularAccessor { ExampleDrift(i0.GeneratedDatabase db) : super(db); i0.Selectable filterTodos(FilterTodos$predicate predicate) { diff --git a/docs/lib/snippets/modular/drift/with_existing.drift.dart b/docs/lib/snippets/modular/drift/with_existing.drift.dart index fce4bbd87..60b34a34b 100644 --- a/docs/lib/snippets/modular/drift/with_existing.drift.dart +++ b/docs/lib/snippets/modular/drift/with_existing.drift.dart @@ -5,6 +5,354 @@ import 'package:drift_docs/snippets/modular/drift/with_existing.drift.dart' as i2; import 'package:drift/internal/modular.dart' as i3; +typedef $UsersCreateCompanionBuilder = i2.UsersCompanion Function({ + i0.Value id, + required String name, +}); +typedef $UsersUpdateCompanionBuilder = i2.UsersCompanion Function({ + i0.Value id, + i0.Value name, +}); + +class $UsersFilterComposer extends i0.Composer { + $UsersFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get name => $composableBuilder( + column: $table.name, builder: (column) => i0.ColumnFilters(column)); +} + +class $UsersOrderingComposer + extends i0.Composer { + $UsersOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get name => $composableBuilder( + column: $table.name, builder: (column) => i0.ColumnOrderings(column)); +} + +class $UsersAnnotationComposer + extends i0.Composer { + $UsersAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get name => + $composableBuilder(column: $table.name, builder: (column) => column); +} + +class $UsersTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i2.Users, + i1.User, + i2.$UsersFilterComposer, + i2.$UsersOrderingComposer, + i2.$UsersAnnotationComposer, + $UsersCreateCompanionBuilder, + $UsersUpdateCompanionBuilder, + (i1.User, i0.BaseReferences), + i1.User, + i0.PrefetchHooks Function()> { + $UsersTableManager(i0.GeneratedDatabase db, i2.Users table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i2.$UsersFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i2.$UsersOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i2.$UsersAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value name = const i0.Value.absent(), + }) => + i2.UsersCompanion( + id: id, + name: name, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required String name, + }) => + i2.UsersCompanion.insert( + id: id, + name: name, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $UsersProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i2.Users, + i1.User, + i2.$UsersFilterComposer, + i2.$UsersOrderingComposer, + i2.$UsersAnnotationComposer, + $UsersCreateCompanionBuilder, + $UsersUpdateCompanionBuilder, + (i1.User, i0.BaseReferences), + i1.User, + i0.PrefetchHooks Function()>; +typedef $FriendsCreateCompanionBuilder = i2.FriendsCompanion Function({ + required int userA, + required int userB, + i0.Value rowid, +}); +typedef $FriendsUpdateCompanionBuilder = i2.FriendsCompanion Function({ + i0.Value userA, + i0.Value userB, + i0.Value rowid, +}); + +class $FriendsFilterComposer + extends i0.Composer { + $FriendsFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i2.$UsersFilterComposer get userA { + final i2.$UsersFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.userA, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$UsersFilterComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i2.$UsersFilterComposer get userB { + final i2.$UsersFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.userB, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$UsersFilterComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $FriendsOrderingComposer + extends i0.Composer { + $FriendsOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i2.$UsersOrderingComposer get userA { + final i2.$UsersOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.userA, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$UsersOrderingComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i2.$UsersOrderingComposer get userB { + final i2.$UsersOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.userB, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$UsersOrderingComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $FriendsAnnotationComposer + extends i0.Composer { + $FriendsAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i2.$UsersAnnotationComposer get userA { + final i2.$UsersAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.userA, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$UsersAnnotationComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i2.$UsersAnnotationComposer get userB { + final i2.$UsersAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.userB, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$UsersAnnotationComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $FriendsTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i2.Friends, + i2.Friend, + i2.$FriendsFilterComposer, + i2.$FriendsOrderingComposer, + i2.$FriendsAnnotationComposer, + $FriendsCreateCompanionBuilder, + $FriendsUpdateCompanionBuilder, + (i2.Friend, i0.BaseReferences), + i2.Friend, + i0.PrefetchHooks Function({bool userA, bool userB})> { + $FriendsTableManager(i0.GeneratedDatabase db, i2.Friends table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i2.$FriendsFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i2.$FriendsOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i2.$FriendsAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value userA = const i0.Value.absent(), + i0.Value userB = const i0.Value.absent(), + i0.Value rowid = const i0.Value.absent(), + }) => + i2.FriendsCompanion( + userA: userA, + userB: userB, + rowid: rowid, + ), + createCompanionCallback: ({ + required int userA, + required int userB, + i0.Value rowid = const i0.Value.absent(), + }) => + i2.FriendsCompanion.insert( + userA: userA, + userB: userB, + rowid: rowid, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $FriendsProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i2.Friends, + i2.Friend, + i2.$FriendsFilterComposer, + i2.$FriendsOrderingComposer, + i2.$FriendsAnnotationComposer, + $FriendsCreateCompanionBuilder, + $FriendsUpdateCompanionBuilder, + (i2.Friend, i0.BaseReferences), + i2.Friend, + i0.PrefetchHooks Function({bool userA, bool userB})>; + class Users extends i0.Table with i0.TableInfo { @override final i0.GeneratedDatabase attachedDatabase; @@ -109,129 +457,15 @@ class UsersCompanion extends i0.UpdateCompanion { return map; } - @override - String toString() { - return (StringBuffer('UsersCompanion(') - ..write('id: $id, ') - ..write('name: $name') - ..write(')')) - .toString(); - } -} - -typedef $UsersCreateCompanionBuilder = i2.UsersCompanion Function({ - i0.Value id, - required String name, -}); -typedef $UsersUpdateCompanionBuilder = i2.UsersCompanion Function({ - i0.Value id, - i0.Value name, -}); - -class $UsersFilterComposer extends i0.Composer { - $UsersFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get name => $composableBuilder( - column: $table.name, builder: (column) => i0.ColumnFilters(column)); -} - -class $UsersOrderingComposer - extends i0.Composer { - $UsersOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get name => $composableBuilder( - column: $table.name, builder: (column) => i0.ColumnOrderings(column)); -} - -class $UsersAnnotationComposer - extends i0.Composer { - $UsersAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get name => - $composableBuilder(column: $table.name, builder: (column) => column); -} - -class $UsersTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i2.Users, - i1.User, - i2.$UsersFilterComposer, - i2.$UsersOrderingComposer, - i2.$UsersAnnotationComposer, - $UsersCreateCompanionBuilder, - $UsersUpdateCompanionBuilder, - (i1.User, i0.BaseReferences), - i1.User, - i0.PrefetchHooks Function()> { - $UsersTableManager(i0.GeneratedDatabase db, i2.Users table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i2.$UsersFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i2.$UsersOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i2.$UsersAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value name = const i0.Value.absent(), - }) => - i2.UsersCompanion( - id: id, - name: name, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required String name, - }) => - i2.UsersCompanion.insert( - id: id, - name: name, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $UsersProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i2.Users, - i1.User, - i2.$UsersFilterComposer, - i2.$UsersOrderingComposer, - i2.$UsersAnnotationComposer, - $UsersCreateCompanionBuilder, - $UsersUpdateCompanionBuilder, - (i1.User, i0.BaseReferences), - i1.User, - i0.PrefetchHooks Function()>; + @override + String toString() { + return (StringBuffer('UsersCompanion(') + ..write('id: $id, ') + ..write('name: $name') + ..write(')')) + .toString(); + } +} class Friends extends i0.Table with i0.TableInfo { @override @@ -431,241 +665,6 @@ class FriendsCompanion extends i0.UpdateCompanion { } } -typedef $FriendsCreateCompanionBuilder = i2.FriendsCompanion Function({ - required int userA, - required int userB, - i0.Value rowid, -}); -typedef $FriendsUpdateCompanionBuilder = i2.FriendsCompanion Function({ - i0.Value userA, - i0.Value userB, - i0.Value rowid, -}); - -class $FriendsFilterComposer - extends i0.Composer { - $FriendsFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i2.$UsersFilterComposer get userA { - final i2.$UsersFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.userA, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$UsersFilterComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } - - i2.$UsersFilterComposer get userB { - final i2.$UsersFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.userB, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$UsersFilterComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $FriendsOrderingComposer - extends i0.Composer { - $FriendsOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i2.$UsersOrderingComposer get userA { - final i2.$UsersOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.userA, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$UsersOrderingComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } - - i2.$UsersOrderingComposer get userB { - final i2.$UsersOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.userB, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$UsersOrderingComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $FriendsAnnotationComposer - extends i0.Composer { - $FriendsAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i2.$UsersAnnotationComposer get userA { - final i2.$UsersAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.userA, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$UsersAnnotationComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } - - i2.$UsersAnnotationComposer get userB { - final i2.$UsersAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.userB, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$UsersAnnotationComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $FriendsTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i2.Friends, - i2.Friend, - i2.$FriendsFilterComposer, - i2.$FriendsOrderingComposer, - i2.$FriendsAnnotationComposer, - $FriendsCreateCompanionBuilder, - $FriendsUpdateCompanionBuilder, - (i2.Friend, i0.BaseReferences), - i2.Friend, - i0.PrefetchHooks Function({bool userA, bool userB})> { - $FriendsTableManager(i0.GeneratedDatabase db, i2.Friends table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i2.$FriendsFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i2.$FriendsOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i2.$FriendsAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value userA = const i0.Value.absent(), - i0.Value userB = const i0.Value.absent(), - i0.Value rowid = const i0.Value.absent(), - }) => - i2.FriendsCompanion( - userA: userA, - userB: userB, - rowid: rowid, - ), - createCompanionCallback: ({ - required int userA, - required int userB, - i0.Value rowid = const i0.Value.absent(), - }) => - i2.FriendsCompanion.insert( - userA: userA, - userB: userB, - rowid: rowid, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $FriendsProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i2.Friends, - i2.Friend, - i2.$FriendsFilterComposer, - i2.$FriendsOrderingComposer, - i2.$FriendsAnnotationComposer, - $FriendsCreateCompanionBuilder, - $FriendsUpdateCompanionBuilder, - (i2.Friend, i0.BaseReferences), - i2.Friend, - i0.PrefetchHooks Function({bool userA, bool userB})>; - class WithExistingDrift extends i3.ModularAccessor { WithExistingDrift(i0.GeneratedDatabase db) : super(db); i0.Selectable allFriendsOf(int id) { diff --git a/docs/lib/snippets/modular/many_to_many/json.drift.dart b/docs/lib/snippets/modular/many_to_many/json.drift.dart index 3e2e07325..c77f84794 100644 --- a/docs/lib/snippets/modular/many_to_many/json.drift.dart +++ b/docs/lib/snippets/modular/many_to_many/json.drift.dart @@ -5,6 +5,136 @@ import 'package:drift_docs/snippets/modular/many_to_many/shared.drift.dart' import 'package:drift_docs/snippets/modular/many_to_many/json.drift.dart' as i2; import 'package:drift_docs/snippets/modular/many_to_many/json.dart' as i3; +typedef $$ShoppingCartsTableCreateCompanionBuilder = i2.ShoppingCartsCompanion + Function({ + i0.Value id, + required i3.ShoppingCartEntries entries, +}); +typedef $$ShoppingCartsTableUpdateCompanionBuilder = i2.ShoppingCartsCompanion + Function({ + i0.Value id, + i0.Value entries, +}); + +class $$ShoppingCartsTableFilterComposer + extends i0.Composer { + $$ShoppingCartsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnWithTypeConverterFilters + get entries => $composableBuilder( + column: $table.entries, + builder: (column) => i0.ColumnWithTypeConverterFilters(column)); +} + +class $$ShoppingCartsTableOrderingComposer + extends i0.Composer { + $$ShoppingCartsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get entries => $composableBuilder( + column: $table.entries, builder: (column) => i0.ColumnOrderings(column)); +} + +class $$ShoppingCartsTableAnnotationComposer + extends i0.Composer { + $$ShoppingCartsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumnWithTypeConverter + get entries => $composableBuilder( + column: $table.entries, builder: (column) => column); +} + +class $$ShoppingCartsTableTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i2.$ShoppingCartsTable, + i2.ShoppingCart, + i2.$$ShoppingCartsTableFilterComposer, + i2.$$ShoppingCartsTableOrderingComposer, + i2.$$ShoppingCartsTableAnnotationComposer, + $$ShoppingCartsTableCreateCompanionBuilder, + $$ShoppingCartsTableUpdateCompanionBuilder, + ( + i2.ShoppingCart, + i0.BaseReferences + ), + i2.ShoppingCart, + i0.PrefetchHooks Function()> { + $$ShoppingCartsTableTableManager( + i0.GeneratedDatabase db, i2.$ShoppingCartsTable table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i2.$$ShoppingCartsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i2.$$ShoppingCartsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i2.$$ShoppingCartsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value entries = const i0.Value.absent(), + }) => + i2.ShoppingCartsCompanion( + id: id, + entries: entries, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required i3.ShoppingCartEntries entries, + }) => + i2.ShoppingCartsCompanion.insert( + id: id, + entries: entries, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$ShoppingCartsTableProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i2.$ShoppingCartsTable, + i2.ShoppingCart, + i2.$$ShoppingCartsTableFilterComposer, + i2.$$ShoppingCartsTableOrderingComposer, + i2.$$ShoppingCartsTableAnnotationComposer, + $$ShoppingCartsTableCreateCompanionBuilder, + $$ShoppingCartsTableUpdateCompanionBuilder, + ( + i2.ShoppingCart, + i0.BaseReferences + ), + i2.ShoppingCart, + i0.PrefetchHooks Function()>; + abstract class $JsonBasedDatabase extends i0.GeneratedDatabase { $JsonBasedDatabase(i0.QueryExecutor e) : super(e); $JsonBasedDatabaseManager get managers => $JsonBasedDatabaseManager(this); @@ -218,133 +348,3 @@ class ShoppingCartsCompanion extends i0.UpdateCompanion { .toString(); } } - -typedef $$ShoppingCartsTableCreateCompanionBuilder = i2.ShoppingCartsCompanion - Function({ - i0.Value id, - required i3.ShoppingCartEntries entries, -}); -typedef $$ShoppingCartsTableUpdateCompanionBuilder = i2.ShoppingCartsCompanion - Function({ - i0.Value id, - i0.Value entries, -}); - -class $$ShoppingCartsTableFilterComposer - extends i0.Composer { - $$ShoppingCartsTableFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnWithTypeConverterFilters - get entries => $composableBuilder( - column: $table.entries, - builder: (column) => i0.ColumnWithTypeConverterFilters(column)); -} - -class $$ShoppingCartsTableOrderingComposer - extends i0.Composer { - $$ShoppingCartsTableOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get entries => $composableBuilder( - column: $table.entries, builder: (column) => i0.ColumnOrderings(column)); -} - -class $$ShoppingCartsTableAnnotationComposer - extends i0.Composer { - $$ShoppingCartsTableAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumnWithTypeConverter - get entries => $composableBuilder( - column: $table.entries, builder: (column) => column); -} - -class $$ShoppingCartsTableTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i2.$ShoppingCartsTable, - i2.ShoppingCart, - i2.$$ShoppingCartsTableFilterComposer, - i2.$$ShoppingCartsTableOrderingComposer, - i2.$$ShoppingCartsTableAnnotationComposer, - $$ShoppingCartsTableCreateCompanionBuilder, - $$ShoppingCartsTableUpdateCompanionBuilder, - ( - i2.ShoppingCart, - i0.BaseReferences - ), - i2.ShoppingCart, - i0.PrefetchHooks Function()> { - $$ShoppingCartsTableTableManager( - i0.GeneratedDatabase db, i2.$ShoppingCartsTable table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i2.$$ShoppingCartsTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i2.$$ShoppingCartsTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i2.$$ShoppingCartsTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value entries = const i0.Value.absent(), - }) => - i2.ShoppingCartsCompanion( - id: id, - entries: entries, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required i3.ShoppingCartEntries entries, - }) => - i2.ShoppingCartsCompanion.insert( - id: id, - entries: entries, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $$ShoppingCartsTableProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i2.$ShoppingCartsTable, - i2.ShoppingCart, - i2.$$ShoppingCartsTableFilterComposer, - i2.$$ShoppingCartsTableOrderingComposer, - i2.$$ShoppingCartsTableAnnotationComposer, - $$ShoppingCartsTableCreateCompanionBuilder, - $$ShoppingCartsTableUpdateCompanionBuilder, - ( - i2.ShoppingCart, - i0.BaseReferences - ), - i2.ShoppingCart, - i0.PrefetchHooks Function()>; diff --git a/docs/lib/snippets/modular/many_to_many/relational.drift.dart b/docs/lib/snippets/modular/many_to_many/relational.drift.dart index 832d9ff89..c18ca0bdf 100644 --- a/docs/lib/snippets/modular/many_to_many/relational.drift.dart +++ b/docs/lib/snippets/modular/many_to_many/relational.drift.dart @@ -7,6 +7,421 @@ import 'package:drift_docs/snippets/modular/many_to_many/relational.drift.dart' import 'package:drift_docs/snippets/modular/many_to_many/relational.dart' as i3; import 'package:drift/internal/modular.dart' as i4; +typedef $$ShoppingCartsTableCreateCompanionBuilder = i2.ShoppingCartsCompanion + Function({ + i0.Value id, +}); +typedef $$ShoppingCartsTableUpdateCompanionBuilder = i2.ShoppingCartsCompanion + Function({ + i0.Value id, +}); + +class $$ShoppingCartsTableFilterComposer + extends i0.Composer { + $$ShoppingCartsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.Expression shoppingCartEntriesRefs( + i0.Expression Function( + i2.$$ShoppingCartEntriesTableFilterComposer f) + f) { + final i2.$$ShoppingCartEntriesTableFilterComposer composer = + $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: i4.ReadDatabaseContainer($db) + .resultSet( + 'shopping_cart_entries'), + getReferencedColumn: (t) => t.shoppingCart, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$$ShoppingCartEntriesTableFilterComposer( + $db: $db, + $table: i4.ReadDatabaseContainer($db) + .resultSet( + 'shopping_cart_entries'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return f(composer); + } +} + +class $$ShoppingCartsTableOrderingComposer + extends i0.Composer { + $$ShoppingCartsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); +} + +class $$ShoppingCartsTableAnnotationComposer + extends i0.Composer { + $$ShoppingCartsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.Expression shoppingCartEntriesRefs( + i0.Expression Function( + i2.$$ShoppingCartEntriesTableAnnotationComposer a) + f) { + final i2.$$ShoppingCartEntriesTableAnnotationComposer composer = + $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: i4.ReadDatabaseContainer($db) + .resultSet( + 'shopping_cart_entries'), + getReferencedColumn: (t) => t.shoppingCart, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$$ShoppingCartEntriesTableAnnotationComposer( + $db: $db, + $table: i4.ReadDatabaseContainer($db) + .resultSet( + 'shopping_cart_entries'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return f(composer); + } +} + +class $$ShoppingCartsTableTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i2.$ShoppingCartsTable, + i2.ShoppingCart, + i2.$$ShoppingCartsTableFilterComposer, + i2.$$ShoppingCartsTableOrderingComposer, + i2.$$ShoppingCartsTableAnnotationComposer, + $$ShoppingCartsTableCreateCompanionBuilder, + $$ShoppingCartsTableUpdateCompanionBuilder, + ( + i2.ShoppingCart, + i0.BaseReferences + ), + i2.ShoppingCart, + i0.PrefetchHooks Function({bool shoppingCartEntriesRefs})> { + $$ShoppingCartsTableTableManager( + i0.GeneratedDatabase db, i2.$ShoppingCartsTable table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i2.$$ShoppingCartsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i2.$$ShoppingCartsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i2.$$ShoppingCartsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + }) => + i2.ShoppingCartsCompanion( + id: id, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + }) => + i2.ShoppingCartsCompanion.insert( + id: id, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$ShoppingCartsTableProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i2.$ShoppingCartsTable, + i2.ShoppingCart, + i2.$$ShoppingCartsTableFilterComposer, + i2.$$ShoppingCartsTableOrderingComposer, + i2.$$ShoppingCartsTableAnnotationComposer, + $$ShoppingCartsTableCreateCompanionBuilder, + $$ShoppingCartsTableUpdateCompanionBuilder, + ( + i2.ShoppingCart, + i0.BaseReferences + ), + i2.ShoppingCart, + i0.PrefetchHooks Function({bool shoppingCartEntriesRefs})>; +typedef $$ShoppingCartEntriesTableCreateCompanionBuilder + = i2.ShoppingCartEntriesCompanion Function({ + required int shoppingCart, + required int item, + i0.Value rowid, +}); +typedef $$ShoppingCartEntriesTableUpdateCompanionBuilder + = i2.ShoppingCartEntriesCompanion Function({ + i0.Value shoppingCart, + i0.Value item, + i0.Value rowid, +}); + +class $$ShoppingCartEntriesTableFilterComposer + extends i0.Composer { + $$ShoppingCartEntriesTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i2.$$ShoppingCartsTableFilterComposer get shoppingCart { + final i2.$$ShoppingCartsTableFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.shoppingCart, + referencedTable: i4.ReadDatabaseContainer($db) + .resultSet('shopping_carts'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$$ShoppingCartsTableFilterComposer( + $db: $db, + $table: i4.ReadDatabaseContainer($db) + .resultSet('shopping_carts'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i1.$$BuyableItemsTableFilterComposer get item { + final i1.$$BuyableItemsTableFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.item, + referencedTable: i4.ReadDatabaseContainer($db) + .resultSet('buyable_items'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$$BuyableItemsTableFilterComposer( + $db: $db, + $table: i4.ReadDatabaseContainer($db) + .resultSet('buyable_items'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $$ShoppingCartEntriesTableOrderingComposer + extends i0.Composer { + $$ShoppingCartEntriesTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i2.$$ShoppingCartsTableOrderingComposer get shoppingCart { + final i2.$$ShoppingCartsTableOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.shoppingCart, + referencedTable: i4.ReadDatabaseContainer($db) + .resultSet('shopping_carts'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$$ShoppingCartsTableOrderingComposer( + $db: $db, + $table: i4.ReadDatabaseContainer($db) + .resultSet('shopping_carts'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i1.$$BuyableItemsTableOrderingComposer get item { + final i1.$$BuyableItemsTableOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.item, + referencedTable: i4.ReadDatabaseContainer($db) + .resultSet('buyable_items'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$$BuyableItemsTableOrderingComposer( + $db: $db, + $table: i4.ReadDatabaseContainer($db) + .resultSet('buyable_items'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $$ShoppingCartEntriesTableAnnotationComposer + extends i0.Composer { + $$ShoppingCartEntriesTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i2.$$ShoppingCartsTableAnnotationComposer get shoppingCart { + final i2.$$ShoppingCartsTableAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.shoppingCart, + referencedTable: i4.ReadDatabaseContainer($db) + .resultSet('shopping_carts'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$$ShoppingCartsTableAnnotationComposer( + $db: $db, + $table: i4.ReadDatabaseContainer($db) + .resultSet('shopping_carts'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i1.$$BuyableItemsTableAnnotationComposer get item { + final i1.$$BuyableItemsTableAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.item, + referencedTable: i4.ReadDatabaseContainer($db) + .resultSet('buyable_items'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$$BuyableItemsTableAnnotationComposer( + $db: $db, + $table: i4.ReadDatabaseContainer($db) + .resultSet('buyable_items'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $$ShoppingCartEntriesTableTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i2.$ShoppingCartEntriesTable, + i2.ShoppingCartEntry, + i2.$$ShoppingCartEntriesTableFilterComposer, + i2.$$ShoppingCartEntriesTableOrderingComposer, + i2.$$ShoppingCartEntriesTableAnnotationComposer, + $$ShoppingCartEntriesTableCreateCompanionBuilder, + $$ShoppingCartEntriesTableUpdateCompanionBuilder, + ( + i2.ShoppingCartEntry, + i0.BaseReferences + ), + i2.ShoppingCartEntry, + i0.PrefetchHooks Function({bool shoppingCart, bool item})> { + $$ShoppingCartEntriesTableTableManager( + i0.GeneratedDatabase db, i2.$ShoppingCartEntriesTable table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => i2 + .$$ShoppingCartEntriesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i2.$$ShoppingCartEntriesTableOrderingComposer( + $db: db, $table: table), + createComputedFieldComposer: () => + i2.$$ShoppingCartEntriesTableAnnotationComposer( + $db: db, $table: table), + updateCompanionCallback: ({ + i0.Value shoppingCart = const i0.Value.absent(), + i0.Value item = const i0.Value.absent(), + i0.Value rowid = const i0.Value.absent(), + }) => + i2.ShoppingCartEntriesCompanion( + shoppingCart: shoppingCart, + item: item, + rowid: rowid, + ), + createCompanionCallback: ({ + required int shoppingCart, + required int item, + i0.Value rowid = const i0.Value.absent(), + }) => + i2.ShoppingCartEntriesCompanion.insert( + shoppingCart: shoppingCart, + item: item, + rowid: rowid, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$ShoppingCartEntriesTableProcessedTableManager + = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i2.$ShoppingCartEntriesTable, + i2.ShoppingCartEntry, + i2.$$ShoppingCartEntriesTableFilterComposer, + i2.$$ShoppingCartEntriesTableOrderingComposer, + i2.$$ShoppingCartEntriesTableAnnotationComposer, + $$ShoppingCartEntriesTableCreateCompanionBuilder, + $$ShoppingCartEntriesTableUpdateCompanionBuilder, + ( + i2.ShoppingCartEntry, + i0.BaseReferences + ), + i2.ShoppingCartEntry, + i0.PrefetchHooks Function({bool shoppingCart, bool item})>; + abstract class $RelationalDatabase extends i0.GeneratedDatabase { $RelationalDatabase(i0.QueryExecutor e) : super(e); $RelationalDatabaseManager get managers => $RelationalDatabaseManager(this); @@ -174,124 +589,13 @@ class ShoppingCartsCompanion extends i0.UpdateCompanion { } @override - String toString() { - return (StringBuffer('ShoppingCartsCompanion(') - ..write('id: $id') - ..write(')')) - .toString(); - } -} - -typedef $$ShoppingCartsTableCreateCompanionBuilder = i2.ShoppingCartsCompanion - Function({ - i0.Value id, -}); -typedef $$ShoppingCartsTableUpdateCompanionBuilder = i2.ShoppingCartsCompanion - Function({ - i0.Value id, -}); - -class $$ShoppingCartsTableFilterComposer - extends i0.Composer { - $$ShoppingCartsTableFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); -} - -class $$ShoppingCartsTableOrderingComposer - extends i0.Composer { - $$ShoppingCartsTableOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); -} - -class $$ShoppingCartsTableAnnotationComposer - extends i0.Composer { - $$ShoppingCartsTableAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); -} - -class $$ShoppingCartsTableTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i2.$ShoppingCartsTable, - i2.ShoppingCart, - i2.$$ShoppingCartsTableFilterComposer, - i2.$$ShoppingCartsTableOrderingComposer, - i2.$$ShoppingCartsTableAnnotationComposer, - $$ShoppingCartsTableCreateCompanionBuilder, - $$ShoppingCartsTableUpdateCompanionBuilder, - ( - i2.ShoppingCart, - i0.BaseReferences - ), - i2.ShoppingCart, - i0.PrefetchHooks Function()> { - $$ShoppingCartsTableTableManager( - i0.GeneratedDatabase db, i2.$ShoppingCartsTable table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i2.$$ShoppingCartsTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i2.$$ShoppingCartsTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i2.$$ShoppingCartsTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - }) => - i2.ShoppingCartsCompanion( - id: id, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - }) => - i2.ShoppingCartsCompanion.insert( - id: id, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $$ShoppingCartsTableProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i2.$ShoppingCartsTable, - i2.ShoppingCart, - i2.$$ShoppingCartsTableFilterComposer, - i2.$$ShoppingCartsTableOrderingComposer, - i2.$$ShoppingCartsTableAnnotationComposer, - $$ShoppingCartsTableCreateCompanionBuilder, - $$ShoppingCartsTableUpdateCompanionBuilder, - ( - i2.ShoppingCart, - i0.BaseReferences - ), - i2.ShoppingCart, - i0.PrefetchHooks Function()>; + String toString() { + return (StringBuffer('ShoppingCartsCompanion(') + ..write('id: $id') + ..write(')')) + .toString(); + } +} class $ShoppingCartEntriesTable extends i3.ShoppingCartEntries with i0.TableInfo<$ShoppingCartEntriesTable, i2.ShoppingCartEntry> { @@ -500,252 +804,3 @@ class ShoppingCartEntriesCompanion .toString(); } } - -typedef $$ShoppingCartEntriesTableCreateCompanionBuilder - = i2.ShoppingCartEntriesCompanion Function({ - required int shoppingCart, - required int item, - i0.Value rowid, -}); -typedef $$ShoppingCartEntriesTableUpdateCompanionBuilder - = i2.ShoppingCartEntriesCompanion Function({ - i0.Value shoppingCart, - i0.Value item, - i0.Value rowid, -}); - -class $$ShoppingCartEntriesTableFilterComposer - extends i0.Composer { - $$ShoppingCartEntriesTableFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i2.$$ShoppingCartsTableFilterComposer get shoppingCart { - final i2.$$ShoppingCartsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.shoppingCart, - referencedTable: i4.ReadDatabaseContainer($db) - .resultSet('shopping_carts'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$$ShoppingCartsTableFilterComposer( - $db: $db, - $table: i4.ReadDatabaseContainer($db) - .resultSet('shopping_carts'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } - - i1.$$BuyableItemsTableFilterComposer get item { - final i1.$$BuyableItemsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.item, - referencedTable: i4.ReadDatabaseContainer($db) - .resultSet('buyable_items'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$$BuyableItemsTableFilterComposer( - $db: $db, - $table: i4.ReadDatabaseContainer($db) - .resultSet('buyable_items'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $$ShoppingCartEntriesTableOrderingComposer - extends i0.Composer { - $$ShoppingCartEntriesTableOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i2.$$ShoppingCartsTableOrderingComposer get shoppingCart { - final i2.$$ShoppingCartsTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.shoppingCart, - referencedTable: i4.ReadDatabaseContainer($db) - .resultSet('shopping_carts'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$$ShoppingCartsTableOrderingComposer( - $db: $db, - $table: i4.ReadDatabaseContainer($db) - .resultSet('shopping_carts'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } - - i1.$$BuyableItemsTableOrderingComposer get item { - final i1.$$BuyableItemsTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.item, - referencedTable: i4.ReadDatabaseContainer($db) - .resultSet('buyable_items'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$$BuyableItemsTableOrderingComposer( - $db: $db, - $table: i4.ReadDatabaseContainer($db) - .resultSet('buyable_items'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $$ShoppingCartEntriesTableAnnotationComposer - extends i0.Composer { - $$ShoppingCartEntriesTableAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i2.$$ShoppingCartsTableAnnotationComposer get shoppingCart { - final i2.$$ShoppingCartsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.shoppingCart, - referencedTable: i4.ReadDatabaseContainer($db) - .resultSet('shopping_carts'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$$ShoppingCartsTableAnnotationComposer( - $db: $db, - $table: i4.ReadDatabaseContainer($db) - .resultSet('shopping_carts'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } - - i1.$$BuyableItemsTableAnnotationComposer get item { - final i1.$$BuyableItemsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.item, - referencedTable: i4.ReadDatabaseContainer($db) - .resultSet('buyable_items'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$$BuyableItemsTableAnnotationComposer( - $db: $db, - $table: i4.ReadDatabaseContainer($db) - .resultSet('buyable_items'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $$ShoppingCartEntriesTableTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i2.$ShoppingCartEntriesTable, - i2.ShoppingCartEntry, - i2.$$ShoppingCartEntriesTableFilterComposer, - i2.$$ShoppingCartEntriesTableOrderingComposer, - i2.$$ShoppingCartEntriesTableAnnotationComposer, - $$ShoppingCartEntriesTableCreateCompanionBuilder, - $$ShoppingCartEntriesTableUpdateCompanionBuilder, - ( - i2.ShoppingCartEntry, - i0.BaseReferences - ), - i2.ShoppingCartEntry, - i0.PrefetchHooks Function({bool shoppingCart, bool item})> { - $$ShoppingCartEntriesTableTableManager( - i0.GeneratedDatabase db, i2.$ShoppingCartEntriesTable table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => i2 - .$$ShoppingCartEntriesTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i2.$$ShoppingCartEntriesTableOrderingComposer( - $db: db, $table: table), - createComputedFieldComposer: () => - i2.$$ShoppingCartEntriesTableAnnotationComposer( - $db: db, $table: table), - updateCompanionCallback: ({ - i0.Value shoppingCart = const i0.Value.absent(), - i0.Value item = const i0.Value.absent(), - i0.Value rowid = const i0.Value.absent(), - }) => - i2.ShoppingCartEntriesCompanion( - shoppingCart: shoppingCart, - item: item, - rowid: rowid, - ), - createCompanionCallback: ({ - required int shoppingCart, - required int item, - i0.Value rowid = const i0.Value.absent(), - }) => - i2.ShoppingCartEntriesCompanion.insert( - shoppingCart: shoppingCart, - item: item, - rowid: rowid, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $$ShoppingCartEntriesTableProcessedTableManager - = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i2.$ShoppingCartEntriesTable, - i2.ShoppingCartEntry, - i2.$$ShoppingCartEntriesTableFilterComposer, - i2.$$ShoppingCartEntriesTableOrderingComposer, - i2.$$ShoppingCartEntriesTableAnnotationComposer, - $$ShoppingCartEntriesTableCreateCompanionBuilder, - $$ShoppingCartEntriesTableUpdateCompanionBuilder, - ( - i2.ShoppingCartEntry, - i0.BaseReferences - ), - i2.ShoppingCartEntry, - i0.PrefetchHooks Function({bool shoppingCart, bool item})>; diff --git a/docs/lib/snippets/modular/many_to_many/shared.drift.dart b/docs/lib/snippets/modular/many_to_many/shared.drift.dart index f61a2201e..8303e4857 100644 --- a/docs/lib/snippets/modular/many_to_many/shared.drift.dart +++ b/docs/lib/snippets/modular/many_to_many/shared.drift.dart @@ -4,6 +4,149 @@ import 'package:drift_docs/snippets/modular/many_to_many/shared.drift.dart' as i1; import 'package:drift_docs/snippets/modular/many_to_many/shared.dart' as i2; +typedef $$BuyableItemsTableCreateCompanionBuilder = i1.BuyableItemsCompanion + Function({ + i0.Value id, + required String description, + required int price, +}); +typedef $$BuyableItemsTableUpdateCompanionBuilder = i1.BuyableItemsCompanion + Function({ + i0.Value id, + i0.Value description, + i0.Value price, +}); + +class $$BuyableItemsTableFilterComposer + extends i0.Composer { + $$BuyableItemsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get description => $composableBuilder( + column: $table.description, + builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get price => $composableBuilder( + column: $table.price, builder: (column) => i0.ColumnFilters(column)); +} + +class $$BuyableItemsTableOrderingComposer + extends i0.Composer { + $$BuyableItemsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get description => $composableBuilder( + column: $table.description, + builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get price => $composableBuilder( + column: $table.price, builder: (column) => i0.ColumnOrderings(column)); +} + +class $$BuyableItemsTableAnnotationComposer + extends i0.Composer { + $$BuyableItemsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get description => $composableBuilder( + column: $table.description, builder: (column) => column); + + i0.GeneratedColumn get price => + $composableBuilder(column: $table.price, builder: (column) => column); +} + +class $$BuyableItemsTableTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.$BuyableItemsTable, + i1.BuyableItem, + i1.$$BuyableItemsTableFilterComposer, + i1.$$BuyableItemsTableOrderingComposer, + i1.$$BuyableItemsTableAnnotationComposer, + $$BuyableItemsTableCreateCompanionBuilder, + $$BuyableItemsTableUpdateCompanionBuilder, + ( + i1.BuyableItem, + i0.BaseReferences + ), + i1.BuyableItem, + i0.PrefetchHooks Function()> { + $$BuyableItemsTableTableManager( + i0.GeneratedDatabase db, i1.$BuyableItemsTable table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$$BuyableItemsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$$BuyableItemsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$$BuyableItemsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value description = const i0.Value.absent(), + i0.Value price = const i0.Value.absent(), + }) => + i1.BuyableItemsCompanion( + id: id, + description: description, + price: price, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required String description, + required int price, + }) => + i1.BuyableItemsCompanion.insert( + id: id, + description: description, + price: price, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$BuyableItemsTableProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.$BuyableItemsTable, + i1.BuyableItem, + i1.$$BuyableItemsTableFilterComposer, + i1.$$BuyableItemsTableOrderingComposer, + i1.$$BuyableItemsTableAnnotationComposer, + $$BuyableItemsTableCreateCompanionBuilder, + $$BuyableItemsTableUpdateCompanionBuilder, + ( + i1.BuyableItem, + i0.BaseReferences + ), + i1.BuyableItem, + i0.PrefetchHooks Function()>; + class $BuyableItemsTable extends i2.BuyableItems with i0.TableInfo<$BuyableItemsTable, i1.BuyableItem> { @override @@ -227,146 +370,3 @@ class BuyableItemsCompanion extends i0.UpdateCompanion { .toString(); } } - -typedef $$BuyableItemsTableCreateCompanionBuilder = i1.BuyableItemsCompanion - Function({ - i0.Value id, - required String description, - required int price, -}); -typedef $$BuyableItemsTableUpdateCompanionBuilder = i1.BuyableItemsCompanion - Function({ - i0.Value id, - i0.Value description, - i0.Value price, -}); - -class $$BuyableItemsTableFilterComposer - extends i0.Composer { - $$BuyableItemsTableFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get description => $composableBuilder( - column: $table.description, - builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get price => $composableBuilder( - column: $table.price, builder: (column) => i0.ColumnFilters(column)); -} - -class $$BuyableItemsTableOrderingComposer - extends i0.Composer { - $$BuyableItemsTableOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get description => $composableBuilder( - column: $table.description, - builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get price => $composableBuilder( - column: $table.price, builder: (column) => i0.ColumnOrderings(column)); -} - -class $$BuyableItemsTableAnnotationComposer - extends i0.Composer { - $$BuyableItemsTableAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get description => $composableBuilder( - column: $table.description, builder: (column) => column); - - i0.GeneratedColumn get price => - $composableBuilder(column: $table.price, builder: (column) => column); -} - -class $$BuyableItemsTableTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.$BuyableItemsTable, - i1.BuyableItem, - i1.$$BuyableItemsTableFilterComposer, - i1.$$BuyableItemsTableOrderingComposer, - i1.$$BuyableItemsTableAnnotationComposer, - $$BuyableItemsTableCreateCompanionBuilder, - $$BuyableItemsTableUpdateCompanionBuilder, - ( - i1.BuyableItem, - i0.BaseReferences - ), - i1.BuyableItem, - i0.PrefetchHooks Function()> { - $$BuyableItemsTableTableManager( - i0.GeneratedDatabase db, i1.$BuyableItemsTable table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$$BuyableItemsTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$$BuyableItemsTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$$BuyableItemsTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value description = const i0.Value.absent(), - i0.Value price = const i0.Value.absent(), - }) => - i1.BuyableItemsCompanion( - id: id, - description: description, - price: price, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required String description, - required int price, - }) => - i1.BuyableItemsCompanion.insert( - id: id, - description: description, - price: price, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $$BuyableItemsTableProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.$BuyableItemsTable, - i1.BuyableItem, - i1.$$BuyableItemsTableFilterComposer, - i1.$$BuyableItemsTableOrderingComposer, - i1.$$BuyableItemsTableAnnotationComposer, - $$BuyableItemsTableCreateCompanionBuilder, - $$BuyableItemsTableUpdateCompanionBuilder, - ( - i1.BuyableItem, - i0.BaseReferences - ), - i1.BuyableItem, - i0.PrefetchHooks Function()>; diff --git a/docs/lib/snippets/modular/upserts.drift.dart b/docs/lib/snippets/modular/upserts.drift.dart index 11eda0ac7..64d11a4d5 100644 --- a/docs/lib/snippets/modular/upserts.drift.dart +++ b/docs/lib/snippets/modular/upserts.drift.dart @@ -4,6 +4,282 @@ import 'package:drift_docs/snippets/modular/upserts.drift.dart' as i1; import 'package:drift_docs/snippets/modular/upserts.dart' as i2; import 'package:drift/src/runtime/query_builder/query_builder.dart' as i3; +typedef $$WordsTableCreateCompanionBuilder = i1.WordsCompanion Function({ + required String word, + i0.Value usages, + i0.Value rowid, +}); +typedef $$WordsTableUpdateCompanionBuilder = i1.WordsCompanion Function({ + i0.Value word, + i0.Value usages, + i0.Value rowid, +}); + +class $$WordsTableFilterComposer + extends i0.Composer { + $$WordsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get word => $composableBuilder( + column: $table.word, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get usages => $composableBuilder( + column: $table.usages, builder: (column) => i0.ColumnFilters(column)); +} + +class $$WordsTableOrderingComposer + extends i0.Composer { + $$WordsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get word => $composableBuilder( + column: $table.word, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get usages => $composableBuilder( + column: $table.usages, builder: (column) => i0.ColumnOrderings(column)); +} + +class $$WordsTableAnnotationComposer + extends i0.Composer { + $$WordsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get word => + $composableBuilder(column: $table.word, builder: (column) => column); + + i0.GeneratedColumn get usages => + $composableBuilder(column: $table.usages, builder: (column) => column); +} + +class $$WordsTableTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.$WordsTable, + i1.Word, + i1.$$WordsTableFilterComposer, + i1.$$WordsTableOrderingComposer, + i1.$$WordsTableAnnotationComposer, + $$WordsTableCreateCompanionBuilder, + $$WordsTableUpdateCompanionBuilder, + (i1.Word, i0.BaseReferences), + i1.Word, + i0.PrefetchHooks Function()> { + $$WordsTableTableManager(i0.GeneratedDatabase db, i1.$WordsTable table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$$WordsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$$WordsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$$WordsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value word = const i0.Value.absent(), + i0.Value usages = const i0.Value.absent(), + i0.Value rowid = const i0.Value.absent(), + }) => + i1.WordsCompanion( + word: word, + usages: usages, + rowid: rowid, + ), + createCompanionCallback: ({ + required String word, + i0.Value usages = const i0.Value.absent(), + i0.Value rowid = const i0.Value.absent(), + }) => + i1.WordsCompanion.insert( + word: word, + usages: usages, + rowid: rowid, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$WordsTableProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.$WordsTable, + i1.Word, + i1.$$WordsTableFilterComposer, + i1.$$WordsTableOrderingComposer, + i1.$$WordsTableAnnotationComposer, + $$WordsTableCreateCompanionBuilder, + $$WordsTableUpdateCompanionBuilder, + (i1.Word, i0.BaseReferences), + i1.Word, + i0.PrefetchHooks Function()>; +typedef $$MatchResultsTableCreateCompanionBuilder = i1.MatchResultsCompanion + Function({ + i0.Value id, + required String teamA, + required String teamB, + required bool teamAWon, +}); +typedef $$MatchResultsTableUpdateCompanionBuilder = i1.MatchResultsCompanion + Function({ + i0.Value id, + i0.Value teamA, + i0.Value teamB, + i0.Value teamAWon, +}); + +class $$MatchResultsTableFilterComposer + extends i0.Composer { + $$MatchResultsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get teamA => $composableBuilder( + column: $table.teamA, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get teamB => $composableBuilder( + column: $table.teamB, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get teamAWon => $composableBuilder( + column: $table.teamAWon, builder: (column) => i0.ColumnFilters(column)); +} + +class $$MatchResultsTableOrderingComposer + extends i0.Composer { + $$MatchResultsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get teamA => $composableBuilder( + column: $table.teamA, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get teamB => $composableBuilder( + column: $table.teamB, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get teamAWon => $composableBuilder( + column: $table.teamAWon, builder: (column) => i0.ColumnOrderings(column)); +} + +class $$MatchResultsTableAnnotationComposer + extends i0.Composer { + $$MatchResultsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get teamA => + $composableBuilder(column: $table.teamA, builder: (column) => column); + + i0.GeneratedColumn get teamB => + $composableBuilder(column: $table.teamB, builder: (column) => column); + + i0.GeneratedColumn get teamAWon => + $composableBuilder(column: $table.teamAWon, builder: (column) => column); +} + +class $$MatchResultsTableTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.$MatchResultsTable, + i1.MatchResult, + i1.$$MatchResultsTableFilterComposer, + i1.$$MatchResultsTableOrderingComposer, + i1.$$MatchResultsTableAnnotationComposer, + $$MatchResultsTableCreateCompanionBuilder, + $$MatchResultsTableUpdateCompanionBuilder, + ( + i1.MatchResult, + i0.BaseReferences + ), + i1.MatchResult, + i0.PrefetchHooks Function()> { + $$MatchResultsTableTableManager( + i0.GeneratedDatabase db, i1.$MatchResultsTable table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$$MatchResultsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$$MatchResultsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$$MatchResultsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value teamA = const i0.Value.absent(), + i0.Value teamB = const i0.Value.absent(), + i0.Value teamAWon = const i0.Value.absent(), + }) => + i1.MatchResultsCompanion( + id: id, + teamA: teamA, + teamB: teamB, + teamAWon: teamAWon, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required String teamA, + required String teamB, + required bool teamAWon, + }) => + i1.MatchResultsCompanion.insert( + id: id, + teamA: teamA, + teamB: teamB, + teamAWon: teamAWon, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$MatchResultsTableProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.$MatchResultsTable, + i1.MatchResult, + i1.$$MatchResultsTableFilterComposer, + i1.$$MatchResultsTableOrderingComposer, + i1.$$MatchResultsTableAnnotationComposer, + $$MatchResultsTableCreateCompanionBuilder, + $$MatchResultsTableUpdateCompanionBuilder, + ( + i1.MatchResult, + i0.BaseReferences + ), + i1.MatchResult, + i0.PrefetchHooks Function()>; + class $WordsTable extends i2.Words with i0.TableInfo<$WordsTable, i1.Word> { @override final i0.GeneratedDatabase attachedDatabase; @@ -153,167 +429,46 @@ class WordsCompanion extends i0.UpdateCompanion { i0.Expression? rowid, }) { return i0.RawValuesInsertable({ - if (word != null) 'word': word, - if (usages != null) 'usages': usages, - if (rowid != null) 'rowid': rowid, - }); - } - - i1.WordsCompanion copyWith( - {i0.Value? word, i0.Value? usages, i0.Value? rowid}) { - return i1.WordsCompanion( - word: word ?? this.word, - usages: usages ?? this.usages, - rowid: rowid ?? this.rowid, - ); - } - - @override - Map toColumns(bool nullToAbsent) { - final map = {}; - if (word.present) { - map['word'] = i0.Variable(word.value); - } - if (usages.present) { - map['usages'] = i0.Variable(usages.value); - } - if (rowid.present) { - map['rowid'] = i0.Variable(rowid.value); - } - return map; - } - - @override - String toString() { - return (StringBuffer('WordsCompanion(') - ..write('word: $word, ') - ..write('usages: $usages, ') - ..write('rowid: $rowid') - ..write(')')) - .toString(); - } -} - -typedef $$WordsTableCreateCompanionBuilder = i1.WordsCompanion Function({ - required String word, - i0.Value usages, - i0.Value rowid, -}); -typedef $$WordsTableUpdateCompanionBuilder = i1.WordsCompanion Function({ - i0.Value word, - i0.Value usages, - i0.Value rowid, -}); - -class $$WordsTableFilterComposer - extends i0.Composer { - $$WordsTableFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get word => $composableBuilder( - column: $table.word, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get usages => $composableBuilder( - column: $table.usages, builder: (column) => i0.ColumnFilters(column)); -} - -class $$WordsTableOrderingComposer - extends i0.Composer { - $$WordsTableOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get word => $composableBuilder( - column: $table.word, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get usages => $composableBuilder( - column: $table.usages, builder: (column) => i0.ColumnOrderings(column)); -} - -class $$WordsTableAnnotationComposer - extends i0.Composer { - $$WordsTableAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get word => - $composableBuilder(column: $table.word, builder: (column) => column); + if (word != null) 'word': word, + if (usages != null) 'usages': usages, + if (rowid != null) 'rowid': rowid, + }); + } - i0.GeneratedColumn get usages => - $composableBuilder(column: $table.usages, builder: (column) => column); -} + i1.WordsCompanion copyWith( + {i0.Value? word, i0.Value? usages, i0.Value? rowid}) { + return i1.WordsCompanion( + word: word ?? this.word, + usages: usages ?? this.usages, + rowid: rowid ?? this.rowid, + ); + } -class $$WordsTableTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.$WordsTable, - i1.Word, - i1.$$WordsTableFilterComposer, - i1.$$WordsTableOrderingComposer, - i1.$$WordsTableAnnotationComposer, - $$WordsTableCreateCompanionBuilder, - $$WordsTableUpdateCompanionBuilder, - (i1.Word, i0.BaseReferences), - i1.Word, - i0.PrefetchHooks Function()> { - $$WordsTableTableManager(i0.GeneratedDatabase db, i1.$WordsTable table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$$WordsTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$$WordsTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$$WordsTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value word = const i0.Value.absent(), - i0.Value usages = const i0.Value.absent(), - i0.Value rowid = const i0.Value.absent(), - }) => - i1.WordsCompanion( - word: word, - usages: usages, - rowid: rowid, - ), - createCompanionCallback: ({ - required String word, - i0.Value usages = const i0.Value.absent(), - i0.Value rowid = const i0.Value.absent(), - }) => - i1.WordsCompanion.insert( - word: word, - usages: usages, - rowid: rowid, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} + @override + Map toColumns(bool nullToAbsent) { + final map = {}; + if (word.present) { + map['word'] = i0.Variable(word.value); + } + if (usages.present) { + map['usages'] = i0.Variable(usages.value); + } + if (rowid.present) { + map['rowid'] = i0.Variable(rowid.value); + } + return map; + } -typedef $$WordsTableProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.$WordsTable, - i1.Word, - i1.$$WordsTableFilterComposer, - i1.$$WordsTableOrderingComposer, - i1.$$WordsTableAnnotationComposer, - $$WordsTableCreateCompanionBuilder, - $$WordsTableUpdateCompanionBuilder, - (i1.Word, i0.BaseReferences), - i1.Word, - i0.PrefetchHooks Function()>; + @override + String toString() { + return (StringBuffer('WordsCompanion(') + ..write('word: $word, ') + ..write('usages: $usages, ') + ..write('rowid: $rowid') + ..write(')')) + .toString(); + } +} class $MatchResultsTable extends i2.MatchResults with i0.TableInfo<$MatchResultsTable, i1.MatchResult> { @@ -581,159 +736,3 @@ class MatchResultsCompanion extends i0.UpdateCompanion { .toString(); } } - -typedef $$MatchResultsTableCreateCompanionBuilder = i1.MatchResultsCompanion - Function({ - i0.Value id, - required String teamA, - required String teamB, - required bool teamAWon, -}); -typedef $$MatchResultsTableUpdateCompanionBuilder = i1.MatchResultsCompanion - Function({ - i0.Value id, - i0.Value teamA, - i0.Value teamB, - i0.Value teamAWon, -}); - -class $$MatchResultsTableFilterComposer - extends i0.Composer { - $$MatchResultsTableFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get teamA => $composableBuilder( - column: $table.teamA, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get teamB => $composableBuilder( - column: $table.teamB, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get teamAWon => $composableBuilder( - column: $table.teamAWon, builder: (column) => i0.ColumnFilters(column)); -} - -class $$MatchResultsTableOrderingComposer - extends i0.Composer { - $$MatchResultsTableOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get teamA => $composableBuilder( - column: $table.teamA, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get teamB => $composableBuilder( - column: $table.teamB, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get teamAWon => $composableBuilder( - column: $table.teamAWon, builder: (column) => i0.ColumnOrderings(column)); -} - -class $$MatchResultsTableAnnotationComposer - extends i0.Composer { - $$MatchResultsTableAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get teamA => - $composableBuilder(column: $table.teamA, builder: (column) => column); - - i0.GeneratedColumn get teamB => - $composableBuilder(column: $table.teamB, builder: (column) => column); - - i0.GeneratedColumn get teamAWon => - $composableBuilder(column: $table.teamAWon, builder: (column) => column); -} - -class $$MatchResultsTableTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.$MatchResultsTable, - i1.MatchResult, - i1.$$MatchResultsTableFilterComposer, - i1.$$MatchResultsTableOrderingComposer, - i1.$$MatchResultsTableAnnotationComposer, - $$MatchResultsTableCreateCompanionBuilder, - $$MatchResultsTableUpdateCompanionBuilder, - ( - i1.MatchResult, - i0.BaseReferences - ), - i1.MatchResult, - i0.PrefetchHooks Function()> { - $$MatchResultsTableTableManager( - i0.GeneratedDatabase db, i1.$MatchResultsTable table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$$MatchResultsTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$$MatchResultsTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$$MatchResultsTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value teamA = const i0.Value.absent(), - i0.Value teamB = const i0.Value.absent(), - i0.Value teamAWon = const i0.Value.absent(), - }) => - i1.MatchResultsCompanion( - id: id, - teamA: teamA, - teamB: teamB, - teamAWon: teamAWon, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required String teamA, - required String teamB, - required bool teamAWon, - }) => - i1.MatchResultsCompanion.insert( - id: id, - teamA: teamA, - teamB: teamB, - teamAWon: teamAWon, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $$MatchResultsTableProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.$MatchResultsTable, - i1.MatchResult, - i1.$$MatchResultsTableFilterComposer, - i1.$$MatchResultsTableOrderingComposer, - i1.$$MatchResultsTableAnnotationComposer, - $$MatchResultsTableCreateCompanionBuilder, - $$MatchResultsTableUpdateCompanionBuilder, - ( - i1.MatchResult, - i0.BaseReferences - ), - i1.MatchResult, - i0.PrefetchHooks Function()>; diff --git a/drift/CHANGELOG.md b/drift/CHANGELOG.md index bb28b6586..12b4cf96a 100644 --- a/drift/CHANGELOG.md +++ b/drift/CHANGELOG.md @@ -2,8 +2,10 @@ - To infer whether serialization is required for inter-isolate communication, drift now sends a test message instead serializing by default. +- The manager API now ignores references whose target column is a foreign key itself. - The DevTools extension can now clear drift databases. + ## 2.20.2 - Fix upcoming `unreachable_switch_default` lint. diff --git a/drift_dev/lib/src/writer/manager/table_manager_writer.dart b/drift_dev/lib/src/writer/manager/table_manager_writer.dart index 55d0bd523..2b68ff57f 100644 --- a/drift_dev/lib/src/writer/manager/table_manager_writer.dart +++ b/drift_dev/lib/src/writer/manager/table_manager_writer.dart @@ -56,6 +56,19 @@ class _TableManagerWriter { relations.addAll(reverseRelations); } + // Remove relations whose target column is a foreign key itself + relations = relations.where((r) { + if (r.isReverse) { + return r.currentColumn.constraints + .whereType() + .isEmpty; + } else { + return r.referencedColumn.constraints + .whereType() + .isEmpty; + } + }).toList(); + // Get all the field names that could be added for this class // Including ones that access relations final allFieldNames = []; diff --git a/drift_dev/test/writer/writer_test.dart b/drift_dev/test/writer/writer_test.dart index b9f5762bb..2b7effcf4 100644 --- a/drift_dev/test/writer/writer_test.dart +++ b/drift_dev/test/writer/writer_test.dart @@ -121,6 +121,47 @@ CREATE VIEW a AS SELECT nullif(bar, '') FROM foo; }, ); + test( + 'generates valid code for for references whose target columnis a reference column itself', + () async { + final result = await emulateDriftBuild( + inputs: { + 'a|lib/a.dart': r''' +import 'package:drift/drift.dart'; + +class FkToPk0 extends Table { + IntColumn get fk => integer().references(FkToPk0, #fk)(); +} + +class FkToPk1 extends Table { + IntColumn get fk => integer().references(FkToPk2, #fk)(); +} + +class FkToPk2 extends Table { + IntColumn get fk => integer().references(FkToPk3, #id)(); +} + +class FkToPk3 extends Table { + IntColumn get id => integer().autoIncrement()(); +} + +@DriftDatabase(tables: [FkToPk0,FkToPk1,FkToPk2,FkToPk3]) +class MyDatabase {} +''', + }, + logger: loggerThat(neverEmits(anything)), + ); + + checkOutputs( + { + 'a|lib/a.drift.dart': allOf(IsValidDartFile(anything), + decodedMatches(isNot(contains('f.fk.fk')))) + }, + result.dartOutputs, + result.writer, + ); + }); + test('generates valid code for columns containing dollar signs', () async { final result = await emulateDriftBuild( inputs: { diff --git a/examples/migrations_example/lib/database.g.dart b/examples/migrations_example/lib/database.g.dart index dcd7dfe97..4cfe7f4ac 100644 --- a/examples/migrations_example/lib/database.g.dart +++ b/examples/migrations_example/lib/database.g.dart @@ -29,7 +29,10 @@ class $UsersTable extends Users with TableInfo<$UsersTable, User> { @override late final GeneratedColumn birthday = GeneratedColumn( 'birthday', aliasedName, true, - type: DriftSqlType.dateTime, requiredDuringInsert: false); + check: () => + ComparableExpr(birthday).isBiggerThan(Constant(DateTime(1900))), + type: DriftSqlType.dateTime, + requiredDuringInsert: false); static const VerificationMeta _nextUserMeta = const VerificationMeta('nextUser'); @override diff --git a/examples/modular/lib/src/posts.drift.dart b/examples/modular/lib/src/posts.drift.dart index 0f1c6d8ce..e6c79a601 100644 --- a/examples/modular/lib/src/posts.drift.dart +++ b/examples/modular/lib/src/posts.drift.dart @@ -4,6 +4,471 @@ import 'package:modular/src/posts.drift.dart' as i1; import 'package:modular/src/users.drift.dart' as i2; import 'package:drift/internal/modular.dart' as i3; +typedef $PostsCreateCompanionBuilder = i1.PostsCompanion Function({ + i0.Value id, + required int author, + i0.Value content, +}); +typedef $PostsUpdateCompanionBuilder = i1.PostsCompanion Function({ + i0.Value id, + i0.Value author, + i0.Value content, +}); + +class $PostsFilterComposer extends i0.Composer { + $PostsFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get content => $composableBuilder( + column: $table.content, builder: (column) => i0.ColumnFilters(column)); + + i2.$UsersFilterComposer get author { + final i2.$UsersFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.author, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$UsersFilterComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i0.Expression likesRefs( + i0.Expression Function(i1.$LikesFilterComposer f) f) { + final i1.$LikesFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('likes'), + getReferencedColumn: (t) => t.post, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$LikesFilterComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('likes'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return f(composer); + } +} + +class $PostsOrderingComposer + extends i0.Composer { + $PostsOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get content => $composableBuilder( + column: $table.content, builder: (column) => i0.ColumnOrderings(column)); + + i2.$UsersOrderingComposer get author { + final i2.$UsersOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.author, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$UsersOrderingComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $PostsAnnotationComposer + extends i0.Composer { + $PostsAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get content => + $composableBuilder(column: $table.content, builder: (column) => column); + + i2.$UsersAnnotationComposer get author { + final i2.$UsersAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.author, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$UsersAnnotationComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i0.Expression likesRefs( + i0.Expression Function(i1.$LikesAnnotationComposer a) f) { + final i1.$LikesAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('likes'), + getReferencedColumn: (t) => t.post, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$LikesAnnotationComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('likes'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return f(composer); + } +} + +class $PostsTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.Posts, + i1.Post, + i1.$PostsFilterComposer, + i1.$PostsOrderingComposer, + i1.$PostsAnnotationComposer, + $PostsCreateCompanionBuilder, + $PostsUpdateCompanionBuilder, + (i1.Post, i0.BaseReferences), + i1.Post, + i0.PrefetchHooks Function({bool author, bool likesRefs})> { + $PostsTableManager(i0.GeneratedDatabase db, i1.Posts table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$PostsFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$PostsOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$PostsAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value author = const i0.Value.absent(), + i0.Value content = const i0.Value.absent(), + }) => + i1.PostsCompanion( + id: id, + author: author, + content: content, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required int author, + i0.Value content = const i0.Value.absent(), + }) => + i1.PostsCompanion.insert( + id: id, + author: author, + content: content, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $PostsProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.Posts, + i1.Post, + i1.$PostsFilterComposer, + i1.$PostsOrderingComposer, + i1.$PostsAnnotationComposer, + $PostsCreateCompanionBuilder, + $PostsUpdateCompanionBuilder, + (i1.Post, i0.BaseReferences), + i1.Post, + i0.PrefetchHooks Function({bool author, bool likesRefs})>; +typedef $LikesCreateCompanionBuilder = i1.LikesCompanion Function({ + required int post, + required int likedBy, + i0.Value rowid, +}); +typedef $LikesUpdateCompanionBuilder = i1.LikesCompanion Function({ + i0.Value post, + i0.Value likedBy, + i0.Value rowid, +}); + +class $LikesFilterComposer extends i0.Composer { + $LikesFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i1.$PostsFilterComposer get post { + final i1.$PostsFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.post, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('posts'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$PostsFilterComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('posts'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i2.$UsersFilterComposer get likedBy { + final i2.$UsersFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.likedBy, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$UsersFilterComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $LikesOrderingComposer + extends i0.Composer { + $LikesOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i1.$PostsOrderingComposer get post { + final i1.$PostsOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.post, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('posts'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$PostsOrderingComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('posts'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i2.$UsersOrderingComposer get likedBy { + final i2.$UsersOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.likedBy, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$UsersOrderingComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $LikesAnnotationComposer + extends i0.Composer { + $LikesAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i1.$PostsAnnotationComposer get post { + final i1.$PostsAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.post, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('posts'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$PostsAnnotationComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('posts'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i2.$UsersAnnotationComposer get likedBy { + final i2.$UsersAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.likedBy, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$UsersAnnotationComposer( + $db: $db, + $table: + i3.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $LikesTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.Likes, + i1.Like, + i1.$LikesFilterComposer, + i1.$LikesOrderingComposer, + i1.$LikesAnnotationComposer, + $LikesCreateCompanionBuilder, + $LikesUpdateCompanionBuilder, + (i1.Like, i0.BaseReferences), + i1.Like, + i0.PrefetchHooks Function({bool post, bool likedBy})> { + $LikesTableManager(i0.GeneratedDatabase db, i1.Likes table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$LikesFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$LikesOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$LikesAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value post = const i0.Value.absent(), + i0.Value likedBy = const i0.Value.absent(), + i0.Value rowid = const i0.Value.absent(), + }) => + i1.LikesCompanion( + post: post, + likedBy: likedBy, + rowid: rowid, + ), + createCompanionCallback: ({ + required int post, + required int likedBy, + i0.Value rowid = const i0.Value.absent(), + }) => + i1.LikesCompanion.insert( + post: post, + likedBy: likedBy, + rowid: rowid, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $LikesProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.Likes, + i1.Like, + i1.$LikesFilterComposer, + i1.$LikesOrderingComposer, + i1.$LikesAnnotationComposer, + $LikesCreateCompanionBuilder, + $LikesUpdateCompanionBuilder, + (i1.Like, i0.BaseReferences), + i1.Like, + i0.PrefetchHooks Function({bool post, bool likedBy})>; + class Posts extends i0.Table with i0.TableInfo { @override final i0.GeneratedDatabase attachedDatabase; @@ -212,204 +677,18 @@ class PostsCompanion extends i0.UpdateCompanion { map['content'] = i0.Variable(content.value); } return map; - } - - @override - String toString() { - return (StringBuffer('PostsCompanion(') - ..write('id: $id, ') - ..write('author: $author, ') - ..write('content: $content') - ..write(')')) - .toString(); - } -} - -typedef $PostsCreateCompanionBuilder = i1.PostsCompanion Function({ - i0.Value id, - required int author, - i0.Value content, -}); -typedef $PostsUpdateCompanionBuilder = i1.PostsCompanion Function({ - i0.Value id, - i0.Value author, - i0.Value content, -}); - -class $PostsFilterComposer extends i0.Composer { - $PostsFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get content => $composableBuilder( - column: $table.content, builder: (column) => i0.ColumnFilters(column)); - - i2.$UsersFilterComposer get author { - final i2.$UsersFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.author, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$UsersFilterComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $PostsOrderingComposer - extends i0.Composer { - $PostsOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get content => $composableBuilder( - column: $table.content, builder: (column) => i0.ColumnOrderings(column)); - - i2.$UsersOrderingComposer get author { - final i2.$UsersOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.author, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$UsersOrderingComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $PostsAnnotationComposer - extends i0.Composer { - $PostsAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get content => - $composableBuilder(column: $table.content, builder: (column) => column); - - i2.$UsersAnnotationComposer get author { - final i2.$UsersAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.author, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$UsersAnnotationComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $PostsTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.Posts, - i1.Post, - i1.$PostsFilterComposer, - i1.$PostsOrderingComposer, - i1.$PostsAnnotationComposer, - $PostsCreateCompanionBuilder, - $PostsUpdateCompanionBuilder, - (i1.Post, i0.BaseReferences), - i1.Post, - i0.PrefetchHooks Function({bool author})> { - $PostsTableManager(i0.GeneratedDatabase db, i1.Posts table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$PostsFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$PostsOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$PostsAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value author = const i0.Value.absent(), - i0.Value content = const i0.Value.absent(), - }) => - i1.PostsCompanion( - id: id, - author: author, - content: content, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required int author, - i0.Value content = const i0.Value.absent(), - }) => - i1.PostsCompanion.insert( - id: id, - author: author, - content: content, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} + } -typedef $PostsProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.Posts, - i1.Post, - i1.$PostsFilterComposer, - i1.$PostsOrderingComposer, - i1.$PostsAnnotationComposer, - $PostsCreateCompanionBuilder, - $PostsUpdateCompanionBuilder, - (i1.Post, i0.BaseReferences), - i1.Post, - i0.PrefetchHooks Function({bool author})>; + @override + String toString() { + return (StringBuffer('PostsCompanion(') + ..write('id: $id, ') + ..write('author: $author, ') + ..write('content: $content') + ..write(')')) + .toString(); + } +} class Likes extends i0.Table with i0.TableInfo { @override @@ -606,237 +885,3 @@ class LikesCompanion extends i0.UpdateCompanion { .toString(); } } - -typedef $LikesCreateCompanionBuilder = i1.LikesCompanion Function({ - required int post, - required int likedBy, - i0.Value rowid, -}); -typedef $LikesUpdateCompanionBuilder = i1.LikesCompanion Function({ - i0.Value post, - i0.Value likedBy, - i0.Value rowid, -}); - -class $LikesFilterComposer extends i0.Composer { - $LikesFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i1.$PostsFilterComposer get post { - final i1.$PostsFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.post, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('posts'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$PostsFilterComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('posts'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } - - i2.$UsersFilterComposer get likedBy { - final i2.$UsersFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.likedBy, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$UsersFilterComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $LikesOrderingComposer - extends i0.Composer { - $LikesOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i1.$PostsOrderingComposer get post { - final i1.$PostsOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.post, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('posts'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$PostsOrderingComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('posts'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } - - i2.$UsersOrderingComposer get likedBy { - final i2.$UsersOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.likedBy, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$UsersOrderingComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $LikesAnnotationComposer - extends i0.Composer { - $LikesAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i1.$PostsAnnotationComposer get post { - final i1.$PostsAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.post, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('posts'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$PostsAnnotationComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('posts'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } - - i2.$UsersAnnotationComposer get likedBy { - final i2.$UsersAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.likedBy, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$UsersAnnotationComposer( - $db: $db, - $table: - i3.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $LikesTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.Likes, - i1.Like, - i1.$LikesFilterComposer, - i1.$LikesOrderingComposer, - i1.$LikesAnnotationComposer, - $LikesCreateCompanionBuilder, - $LikesUpdateCompanionBuilder, - (i1.Like, i0.BaseReferences), - i1.Like, - i0.PrefetchHooks Function({bool post, bool likedBy})> { - $LikesTableManager(i0.GeneratedDatabase db, i1.Likes table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$LikesFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$LikesOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$LikesAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value post = const i0.Value.absent(), - i0.Value likedBy = const i0.Value.absent(), - i0.Value rowid = const i0.Value.absent(), - }) => - i1.LikesCompanion( - post: post, - likedBy: likedBy, - rowid: rowid, - ), - createCompanionCallback: ({ - required int post, - required int likedBy, - i0.Value rowid = const i0.Value.absent(), - }) => - i1.LikesCompanion.insert( - post: post, - likedBy: likedBy, - rowid: rowid, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $LikesProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.Likes, - i1.Like, - i1.$LikesFilterComposer, - i1.$LikesOrderingComposer, - i1.$LikesAnnotationComposer, - $LikesCreateCompanionBuilder, - $LikesUpdateCompanionBuilder, - (i1.Like, i0.BaseReferences), - i1.Like, - i0.PrefetchHooks Function({bool post, bool likedBy})>; diff --git a/examples/modular/lib/src/search.drift.dart b/examples/modular/lib/src/search.drift.dart index f98f5dc57..c895b8434 100644 --- a/examples/modular/lib/src/search.drift.dart +++ b/examples/modular/lib/src/search.drift.dart @@ -4,6 +4,135 @@ import 'package:modular/src/search.drift.dart' as i1; import 'package:drift/internal/modular.dart' as i2; import 'package:modular/src/posts.drift.dart' as i3; +typedef $SearchInPostsCreateCompanionBuilder = i1.SearchInPostsCompanion + Function({ + required String author, + required String content, + i0.Value rowid, +}); +typedef $SearchInPostsUpdateCompanionBuilder = i1.SearchInPostsCompanion + Function({ + i0.Value author, + i0.Value content, + i0.Value rowid, +}); + +class $SearchInPostsFilterComposer + extends i0.Composer { + $SearchInPostsFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get author => $composableBuilder( + column: $table.author, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get content => $composableBuilder( + column: $table.content, builder: (column) => i0.ColumnFilters(column)); +} + +class $SearchInPostsOrderingComposer + extends i0.Composer { + $SearchInPostsOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get author => $composableBuilder( + column: $table.author, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get content => $composableBuilder( + column: $table.content, builder: (column) => i0.ColumnOrderings(column)); +} + +class $SearchInPostsAnnotationComposer + extends i0.Composer { + $SearchInPostsAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get author => + $composableBuilder(column: $table.author, builder: (column) => column); + + i0.GeneratedColumn get content => + $composableBuilder(column: $table.content, builder: (column) => column); +} + +class $SearchInPostsTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.SearchInPosts, + i1.SearchInPost, + i1.$SearchInPostsFilterComposer, + i1.$SearchInPostsOrderingComposer, + i1.$SearchInPostsAnnotationComposer, + $SearchInPostsCreateCompanionBuilder, + $SearchInPostsUpdateCompanionBuilder, + ( + i1.SearchInPost, + i0.BaseReferences + ), + i1.SearchInPost, + i0.PrefetchHooks Function()> { + $SearchInPostsTableManager(i0.GeneratedDatabase db, i1.SearchInPosts table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$SearchInPostsFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$SearchInPostsOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$SearchInPostsAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value author = const i0.Value.absent(), + i0.Value content = const i0.Value.absent(), + i0.Value rowid = const i0.Value.absent(), + }) => + i1.SearchInPostsCompanion( + author: author, + content: content, + rowid: rowid, + ), + createCompanionCallback: ({ + required String author, + required String content, + i0.Value rowid = const i0.Value.absent(), + }) => + i1.SearchInPostsCompanion.insert( + author: author, + content: content, + rowid: rowid, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $SearchInPostsProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.SearchInPosts, + i1.SearchInPost, + i1.$SearchInPostsFilterComposer, + i1.$SearchInPostsOrderingComposer, + i1.$SearchInPostsAnnotationComposer, + $SearchInPostsCreateCompanionBuilder, + $SearchInPostsUpdateCompanionBuilder, + ( + i1.SearchInPost, + i0.BaseReferences + ), + i1.SearchInPost, + i0.PrefetchHooks Function()>; + class SearchInPosts extends i0.Table with i0.TableInfo, @@ -211,134 +340,6 @@ class SearchInPostsCompanion extends i0.UpdateCompanion { } } -typedef $SearchInPostsCreateCompanionBuilder = i1.SearchInPostsCompanion - Function({ - required String author, - required String content, - i0.Value rowid, -}); -typedef $SearchInPostsUpdateCompanionBuilder = i1.SearchInPostsCompanion - Function({ - i0.Value author, - i0.Value content, - i0.Value rowid, -}); - -class $SearchInPostsFilterComposer - extends i0.Composer { - $SearchInPostsFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get author => $composableBuilder( - column: $table.author, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get content => $composableBuilder( - column: $table.content, builder: (column) => i0.ColumnFilters(column)); -} - -class $SearchInPostsOrderingComposer - extends i0.Composer { - $SearchInPostsOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get author => $composableBuilder( - column: $table.author, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get content => $composableBuilder( - column: $table.content, builder: (column) => i0.ColumnOrderings(column)); -} - -class $SearchInPostsAnnotationComposer - extends i0.Composer { - $SearchInPostsAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get author => - $composableBuilder(column: $table.author, builder: (column) => column); - - i0.GeneratedColumn get content => - $composableBuilder(column: $table.content, builder: (column) => column); -} - -class $SearchInPostsTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.SearchInPosts, - i1.SearchInPost, - i1.$SearchInPostsFilterComposer, - i1.$SearchInPostsOrderingComposer, - i1.$SearchInPostsAnnotationComposer, - $SearchInPostsCreateCompanionBuilder, - $SearchInPostsUpdateCompanionBuilder, - ( - i1.SearchInPost, - i0.BaseReferences - ), - i1.SearchInPost, - i0.PrefetchHooks Function()> { - $SearchInPostsTableManager(i0.GeneratedDatabase db, i1.SearchInPosts table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$SearchInPostsFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$SearchInPostsOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$SearchInPostsAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value author = const i0.Value.absent(), - i0.Value content = const i0.Value.absent(), - i0.Value rowid = const i0.Value.absent(), - }) => - i1.SearchInPostsCompanion( - author: author, - content: content, - rowid: rowid, - ), - createCompanionCallback: ({ - required String author, - required String content, - i0.Value rowid = const i0.Value.absent(), - }) => - i1.SearchInPostsCompanion.insert( - author: author, - content: content, - rowid: rowid, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $SearchInPostsProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.SearchInPosts, - i1.SearchInPost, - i1.$SearchInPostsFilterComposer, - i1.$SearchInPostsOrderingComposer, - i1.$SearchInPostsAnnotationComposer, - $SearchInPostsCreateCompanionBuilder, - $SearchInPostsUpdateCompanionBuilder, - ( - i1.SearchInPost, - i0.BaseReferences - ), - i1.SearchInPost, - i0.PrefetchHooks Function()>; i0.Trigger get postsInsert => i0.Trigger( 'CREATE TRIGGER posts_insert AFTER INSERT ON posts BEGIN INSERT INTO search_in_posts ("rowid", author, content) VALUES (new.id, new.author, new.content);END', 'posts_insert'); diff --git a/examples/modular/lib/src/users.drift.dart b/examples/modular/lib/src/users.drift.dart index 7020b913d..f8e51d28f 100644 --- a/examples/modular/lib/src/users.drift.dart +++ b/examples/modular/lib/src/users.drift.dart @@ -5,6 +5,406 @@ import 'package:modular/src/preferences.dart' as i2; import 'dart:typed_data' as i3; import 'package:drift/internal/modular.dart' as i4; +typedef $UsersCreateCompanionBuilder = i1.UsersCompanion Function({ + i0.Value id, + required String name, + i0.Value biography, + i0.Value preferences, + i0.Value profilePicture, +}); +typedef $UsersUpdateCompanionBuilder = i1.UsersCompanion Function({ + i0.Value id, + i0.Value name, + i0.Value biography, + i0.Value preferences, + i0.Value profilePicture, +}); + +class $UsersFilterComposer extends i0.Composer { + $UsersFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get name => $composableBuilder( + column: $table.name, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get biography => $composableBuilder( + column: $table.biography, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnWithTypeConverterFilters + get preferences => $composableBuilder( + column: $table.preferences, + builder: (column) => i0.ColumnWithTypeConverterFilters(column)); + + i0.ColumnFilters get profilePicture => $composableBuilder( + column: $table.profilePicture, + builder: (column) => i0.ColumnFilters(column)); +} + +class $UsersOrderingComposer + extends i0.Composer { + $UsersOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get name => $composableBuilder( + column: $table.name, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get biography => $composableBuilder( + column: $table.biography, + builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get preferences => $composableBuilder( + column: $table.preferences, + builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get profilePicture => $composableBuilder( + column: $table.profilePicture, + builder: (column) => i0.ColumnOrderings(column)); +} + +class $UsersAnnotationComposer + extends i0.Composer { + $UsersAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get name => + $composableBuilder(column: $table.name, builder: (column) => column); + + i0.GeneratedColumn get biography => + $composableBuilder(column: $table.biography, builder: (column) => column); + + i0.GeneratedColumnWithTypeConverter + get preferences => $composableBuilder( + column: $table.preferences, builder: (column) => column); + + i0.GeneratedColumn get profilePicture => $composableBuilder( + column: $table.profilePicture, builder: (column) => column); +} + +class $UsersTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.Users, + i1.User, + i1.$UsersFilterComposer, + i1.$UsersOrderingComposer, + i1.$UsersAnnotationComposer, + $UsersCreateCompanionBuilder, + $UsersUpdateCompanionBuilder, + (i1.User, i0.BaseReferences), + i1.User, + i0.PrefetchHooks Function()> { + $UsersTableManager(i0.GeneratedDatabase db, i1.Users table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$UsersFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$UsersOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$UsersAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value name = const i0.Value.absent(), + i0.Value biography = const i0.Value.absent(), + i0.Value preferences = const i0.Value.absent(), + i0.Value profilePicture = const i0.Value.absent(), + }) => + i1.UsersCompanion( + id: id, + name: name, + biography: biography, + preferences: preferences, + profilePicture: profilePicture, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required String name, + i0.Value biography = const i0.Value.absent(), + i0.Value preferences = const i0.Value.absent(), + i0.Value profilePicture = const i0.Value.absent(), + }) => + i1.UsersCompanion.insert( + id: id, + name: name, + biography: biography, + preferences: preferences, + profilePicture: profilePicture, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $UsersProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.Users, + i1.User, + i1.$UsersFilterComposer, + i1.$UsersOrderingComposer, + i1.$UsersAnnotationComposer, + $UsersCreateCompanionBuilder, + $UsersUpdateCompanionBuilder, + (i1.User, i0.BaseReferences), + i1.User, + i0.PrefetchHooks Function()>; +typedef $FollowsCreateCompanionBuilder = i1.FollowsCompanion Function({ + required int followed, + required int follower, + i0.Value rowid, +}); +typedef $FollowsUpdateCompanionBuilder = i1.FollowsCompanion Function({ + i0.Value followed, + i0.Value follower, + i0.Value rowid, +}); + +class $FollowsFilterComposer + extends i0.Composer { + $FollowsFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i1.$UsersFilterComposer get followed { + final i1.$UsersFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.followed, + referencedTable: + i4.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$UsersFilterComposer( + $db: $db, + $table: + i4.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i1.$UsersFilterComposer get follower { + final i1.$UsersFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.follower, + referencedTable: + i4.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$UsersFilterComposer( + $db: $db, + $table: + i4.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $FollowsOrderingComposer + extends i0.Composer { + $FollowsOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i1.$UsersOrderingComposer get followed { + final i1.$UsersOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.followed, + referencedTable: + i4.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$UsersOrderingComposer( + $db: $db, + $table: + i4.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i1.$UsersOrderingComposer get follower { + final i1.$UsersOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.follower, + referencedTable: + i4.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$UsersOrderingComposer( + $db: $db, + $table: + i4.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $FollowsAnnotationComposer + extends i0.Composer { + $FollowsAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i1.$UsersAnnotationComposer get followed { + final i1.$UsersAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.followed, + referencedTable: + i4.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$UsersAnnotationComposer( + $db: $db, + $table: + i4.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } + + i1.$UsersAnnotationComposer get follower { + final i1.$UsersAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.follower, + referencedTable: + i4.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$UsersAnnotationComposer( + $db: $db, + $table: + i4.ReadDatabaseContainer($db).resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $FollowsTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.Follows, + i1.Follow, + i1.$FollowsFilterComposer, + i1.$FollowsOrderingComposer, + i1.$FollowsAnnotationComposer, + $FollowsCreateCompanionBuilder, + $FollowsUpdateCompanionBuilder, + (i1.Follow, i0.BaseReferences), + i1.Follow, + i0.PrefetchHooks Function({bool followed, bool follower})> { + $FollowsTableManager(i0.GeneratedDatabase db, i1.Follows table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$FollowsFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$FollowsOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$FollowsAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value followed = const i0.Value.absent(), + i0.Value follower = const i0.Value.absent(), + i0.Value rowid = const i0.Value.absent(), + }) => + i1.FollowsCompanion( + followed: followed, + follower: follower, + rowid: rowid, + ), + createCompanionCallback: ({ + required int followed, + required int follower, + i0.Value rowid = const i0.Value.absent(), + }) => + i1.FollowsCompanion.insert( + followed: followed, + follower: follower, + rowid: rowid, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $FollowsProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.Follows, + i1.Follow, + i1.$FollowsFilterComposer, + i1.$FollowsOrderingComposer, + i1.$FollowsAnnotationComposer, + $FollowsCreateCompanionBuilder, + $FollowsUpdateCompanionBuilder, + (i1.Follow, i0.BaseReferences), + i1.Follow, + i0.PrefetchHooks Function({bool followed, bool follower})>; + class Users extends i0.Table with i0.TableInfo { @override final i0.GeneratedDatabase attachedDatabase; @@ -316,182 +716,17 @@ class UsersCompanion extends i0.UpdateCompanion { @override String toString() { - return (StringBuffer('UsersCompanion(') - ..write('id: $id, ') - ..write('name: $name, ') - ..write('biography: $biography, ') - ..write('preferences: $preferences, ') - ..write('profilePicture: $profilePicture') - ..write(')')) - .toString(); - } -} - -typedef $UsersCreateCompanionBuilder = i1.UsersCompanion Function({ - i0.Value id, - required String name, - i0.Value biography, - i0.Value preferences, - i0.Value profilePicture, -}); -typedef $UsersUpdateCompanionBuilder = i1.UsersCompanion Function({ - i0.Value id, - i0.Value name, - i0.Value biography, - i0.Value preferences, - i0.Value profilePicture, -}); - -class $UsersFilterComposer extends i0.Composer { - $UsersFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get name => $composableBuilder( - column: $table.name, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get biography => $composableBuilder( - column: $table.biography, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnWithTypeConverterFilters - get preferences => $composableBuilder( - column: $table.preferences, - builder: (column) => i0.ColumnWithTypeConverterFilters(column)); - - i0.ColumnFilters get profilePicture => $composableBuilder( - column: $table.profilePicture, - builder: (column) => i0.ColumnFilters(column)); -} - -class $UsersOrderingComposer - extends i0.Composer { - $UsersOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get name => $composableBuilder( - column: $table.name, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get biography => $composableBuilder( - column: $table.biography, - builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get preferences => $composableBuilder( - column: $table.preferences, - builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get profilePicture => $composableBuilder( - column: $table.profilePicture, - builder: (column) => i0.ColumnOrderings(column)); -} - -class $UsersAnnotationComposer - extends i0.Composer { - $UsersAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get name => - $composableBuilder(column: $table.name, builder: (column) => column); - - i0.GeneratedColumn get biography => - $composableBuilder(column: $table.biography, builder: (column) => column); - - i0.GeneratedColumnWithTypeConverter - get preferences => $composableBuilder( - column: $table.preferences, builder: (column) => column); - - i0.GeneratedColumn get profilePicture => $composableBuilder( - column: $table.profilePicture, builder: (column) => column); -} - -class $UsersTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.Users, - i1.User, - i1.$UsersFilterComposer, - i1.$UsersOrderingComposer, - i1.$UsersAnnotationComposer, - $UsersCreateCompanionBuilder, - $UsersUpdateCompanionBuilder, - (i1.User, i0.BaseReferences), - i1.User, - i0.PrefetchHooks Function()> { - $UsersTableManager(i0.GeneratedDatabase db, i1.Users table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$UsersFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$UsersOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$UsersAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value name = const i0.Value.absent(), - i0.Value biography = const i0.Value.absent(), - i0.Value preferences = const i0.Value.absent(), - i0.Value profilePicture = const i0.Value.absent(), - }) => - i1.UsersCompanion( - id: id, - name: name, - biography: biography, - preferences: preferences, - profilePicture: profilePicture, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required String name, - i0.Value biography = const i0.Value.absent(), - i0.Value preferences = const i0.Value.absent(), - i0.Value profilePicture = const i0.Value.absent(), - }) => - i1.UsersCompanion.insert( - id: id, - name: name, - biography: biography, - preferences: preferences, - profilePicture: profilePicture, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); + return (StringBuffer('UsersCompanion(') + ..write('id: $id, ') + ..write('name: $name, ') + ..write('biography: $biography, ') + ..write('preferences: $preferences, ') + ..write('profilePicture: $profilePicture') + ..write(')')) + .toString(); + } } -typedef $UsersProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.Users, - i1.User, - i1.$UsersFilterComposer, - i1.$UsersOrderingComposer, - i1.$UsersAnnotationComposer, - $UsersCreateCompanionBuilder, - $UsersUpdateCompanionBuilder, - (i1.User, i0.BaseReferences), - i1.User, - i0.PrefetchHooks Function()>; i0.Index get usersName => i0.Index('users_name', 'CREATE INDEX users_name ON users (name)'); @@ -696,241 +931,6 @@ class FollowsCompanion extends i0.UpdateCompanion { } } -typedef $FollowsCreateCompanionBuilder = i1.FollowsCompanion Function({ - required int followed, - required int follower, - i0.Value rowid, -}); -typedef $FollowsUpdateCompanionBuilder = i1.FollowsCompanion Function({ - i0.Value followed, - i0.Value follower, - i0.Value rowid, -}); - -class $FollowsFilterComposer - extends i0.Composer { - $FollowsFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i1.$UsersFilterComposer get followed { - final i1.$UsersFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.followed, - referencedTable: - i4.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$UsersFilterComposer( - $db: $db, - $table: - i4.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } - - i1.$UsersFilterComposer get follower { - final i1.$UsersFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.follower, - referencedTable: - i4.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$UsersFilterComposer( - $db: $db, - $table: - i4.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $FollowsOrderingComposer - extends i0.Composer { - $FollowsOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i1.$UsersOrderingComposer get followed { - final i1.$UsersOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.followed, - referencedTable: - i4.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$UsersOrderingComposer( - $db: $db, - $table: - i4.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } - - i1.$UsersOrderingComposer get follower { - final i1.$UsersOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.follower, - referencedTable: - i4.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$UsersOrderingComposer( - $db: $db, - $table: - i4.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $FollowsAnnotationComposer - extends i0.Composer { - $FollowsAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i1.$UsersAnnotationComposer get followed { - final i1.$UsersAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.followed, - referencedTable: - i4.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$UsersAnnotationComposer( - $db: $db, - $table: - i4.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } - - i1.$UsersAnnotationComposer get follower { - final i1.$UsersAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.follower, - referencedTable: - i4.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$UsersAnnotationComposer( - $db: $db, - $table: - i4.ReadDatabaseContainer($db).resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $FollowsTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.Follows, - i1.Follow, - i1.$FollowsFilterComposer, - i1.$FollowsOrderingComposer, - i1.$FollowsAnnotationComposer, - $FollowsCreateCompanionBuilder, - $FollowsUpdateCompanionBuilder, - (i1.Follow, i0.BaseReferences), - i1.Follow, - i0.PrefetchHooks Function({bool followed, bool follower})> { - $FollowsTableManager(i0.GeneratedDatabase db, i1.Follows table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$FollowsFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$FollowsOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$FollowsAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value followed = const i0.Value.absent(), - i0.Value follower = const i0.Value.absent(), - i0.Value rowid = const i0.Value.absent(), - }) => - i1.FollowsCompanion( - followed: followed, - follower: follower, - rowid: rowid, - ), - createCompanionCallback: ({ - required int followed, - required int follower, - i0.Value rowid = const i0.Value.absent(), - }) => - i1.FollowsCompanion.insert( - followed: followed, - follower: follower, - rowid: rowid, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $FollowsProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.Follows, - i1.Follow, - i1.$FollowsFilterComposer, - i1.$FollowsOrderingComposer, - i1.$FollowsAnnotationComposer, - $FollowsCreateCompanionBuilder, - $FollowsUpdateCompanionBuilder, - (i1.Follow, i0.BaseReferences), - i1.Follow, - i0.PrefetchHooks Function({bool followed, bool follower})>; - class PopularUser extends i0.DataClass { final int id; final String name; diff --git a/examples/multi_package/server/lib/database.drift.dart b/examples/multi_package/server/lib/database.drift.dart index 8200c601c..75e7831f3 100644 --- a/examples/multi_package/server/lib/database.drift.dart +++ b/examples/multi_package/server/lib/database.drift.dart @@ -7,6 +7,197 @@ import 'package:shared/shared.drift.dart' as i4; import 'package:drift/internal/modular.dart' as i5; import 'package:server/database.dart' as i6; +typedef $$ActiveSessionsTableCreateCompanionBuilder = i3.ActiveSessionsCompanion + Function({ + required int user, + required String bearerToken, + i0.Value rowid, +}); +typedef $$ActiveSessionsTableUpdateCompanionBuilder = i3.ActiveSessionsCompanion + Function({ + i0.Value user, + i0.Value bearerToken, + i0.Value rowid, +}); + +class $$ActiveSessionsTableFilterComposer + extends i0.Composer { + $$ActiveSessionsTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get bearerToken => $composableBuilder( + column: $table.bearerToken, + builder: (column) => i0.ColumnFilters(column)); + + i1.$$UsersTableFilterComposer get user { + final i1.$$UsersTableFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.user, + referencedTable: + i5.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$$UsersTableFilterComposer( + $db: $db, + $table: i5.ReadDatabaseContainer($db) + .resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $$ActiveSessionsTableOrderingComposer + extends i0.Composer { + $$ActiveSessionsTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get bearerToken => $composableBuilder( + column: $table.bearerToken, + builder: (column) => i0.ColumnOrderings(column)); + + i1.$$UsersTableOrderingComposer get user { + final i1.$$UsersTableOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.user, + referencedTable: + i5.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$$UsersTableOrderingComposer( + $db: $db, + $table: i5.ReadDatabaseContainer($db) + .resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $$ActiveSessionsTableAnnotationComposer + extends i0.Composer { + $$ActiveSessionsTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get bearerToken => $composableBuilder( + column: $table.bearerToken, builder: (column) => column); + + i1.$$UsersTableAnnotationComposer get user { + final i1.$$UsersTableAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.user, + referencedTable: + i5.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i1.$$UsersTableAnnotationComposer( + $db: $db, + $table: i5.ReadDatabaseContainer($db) + .resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $$ActiveSessionsTableTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i3.$ActiveSessionsTable, + i3.ActiveSession, + i3.$$ActiveSessionsTableFilterComposer, + i3.$$ActiveSessionsTableOrderingComposer, + i3.$$ActiveSessionsTableAnnotationComposer, + $$ActiveSessionsTableCreateCompanionBuilder, + $$ActiveSessionsTableUpdateCompanionBuilder, + ( + i3.ActiveSession, + i0.BaseReferences + ), + i3.ActiveSession, + i0.PrefetchHooks Function({bool user})> { + $$ActiveSessionsTableTableManager( + i0.GeneratedDatabase db, i3.$ActiveSessionsTable table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i3.$$ActiveSessionsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i3.$$ActiveSessionsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => i3 + .$$ActiveSessionsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value user = const i0.Value.absent(), + i0.Value bearerToken = const i0.Value.absent(), + i0.Value rowid = const i0.Value.absent(), + }) => + i3.ActiveSessionsCompanion( + user: user, + bearerToken: bearerToken, + rowid: rowid, + ), + createCompanionCallback: ({ + required int user, + required String bearerToken, + i0.Value rowid = const i0.Value.absent(), + }) => + i3.ActiveSessionsCompanion.insert( + user: user, + bearerToken: bearerToken, + rowid: rowid, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$ActiveSessionsTableProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i3.$ActiveSessionsTable, + i3.ActiveSession, + i3.$$ActiveSessionsTableFilterComposer, + i3.$$ActiveSessionsTableOrderingComposer, + i3.$$ActiveSessionsTableAnnotationComposer, + $$ActiveSessionsTableCreateCompanionBuilder, + $$ActiveSessionsTableUpdateCompanionBuilder, + ( + i3.ActiveSession, + i0.BaseReferences + ), + i3.ActiveSession, + i0.PrefetchHooks Function({bool user})>; + abstract class $ServerDatabase extends i0.GeneratedDatabase { $ServerDatabase(i0.QueryExecutor e) : super(e); $ServerDatabaseManager get managers => $ServerDatabaseManager(this); @@ -239,194 +430,3 @@ class ActiveSessionsCompanion extends i0.UpdateCompanion { .toString(); } } - -typedef $$ActiveSessionsTableCreateCompanionBuilder = i3.ActiveSessionsCompanion - Function({ - required int user, - required String bearerToken, - i0.Value rowid, -}); -typedef $$ActiveSessionsTableUpdateCompanionBuilder = i3.ActiveSessionsCompanion - Function({ - i0.Value user, - i0.Value bearerToken, - i0.Value rowid, -}); - -class $$ActiveSessionsTableFilterComposer - extends i0.Composer { - $$ActiveSessionsTableFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get bearerToken => $composableBuilder( - column: $table.bearerToken, - builder: (column) => i0.ColumnFilters(column)); - - i1.$$UsersTableFilterComposer get user { - final i1.$$UsersTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.user, - referencedTable: - i5.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$$UsersTableFilterComposer( - $db: $db, - $table: i5.ReadDatabaseContainer($db) - .resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $$ActiveSessionsTableOrderingComposer - extends i0.Composer { - $$ActiveSessionsTableOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get bearerToken => $composableBuilder( - column: $table.bearerToken, - builder: (column) => i0.ColumnOrderings(column)); - - i1.$$UsersTableOrderingComposer get user { - final i1.$$UsersTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.user, - referencedTable: - i5.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$$UsersTableOrderingComposer( - $db: $db, - $table: i5.ReadDatabaseContainer($db) - .resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $$ActiveSessionsTableAnnotationComposer - extends i0.Composer { - $$ActiveSessionsTableAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get bearerToken => $composableBuilder( - column: $table.bearerToken, builder: (column) => column); - - i1.$$UsersTableAnnotationComposer get user { - final i1.$$UsersTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.user, - referencedTable: - i5.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i1.$$UsersTableAnnotationComposer( - $db: $db, - $table: i5.ReadDatabaseContainer($db) - .resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $$ActiveSessionsTableTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i3.$ActiveSessionsTable, - i3.ActiveSession, - i3.$$ActiveSessionsTableFilterComposer, - i3.$$ActiveSessionsTableOrderingComposer, - i3.$$ActiveSessionsTableAnnotationComposer, - $$ActiveSessionsTableCreateCompanionBuilder, - $$ActiveSessionsTableUpdateCompanionBuilder, - ( - i3.ActiveSession, - i0.BaseReferences - ), - i3.ActiveSession, - i0.PrefetchHooks Function({bool user})> { - $$ActiveSessionsTableTableManager( - i0.GeneratedDatabase db, i3.$ActiveSessionsTable table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i3.$$ActiveSessionsTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i3.$$ActiveSessionsTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => i3 - .$$ActiveSessionsTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value user = const i0.Value.absent(), - i0.Value bearerToken = const i0.Value.absent(), - i0.Value rowid = const i0.Value.absent(), - }) => - i3.ActiveSessionsCompanion( - user: user, - bearerToken: bearerToken, - rowid: rowid, - ), - createCompanionCallback: ({ - required int user, - required String bearerToken, - i0.Value rowid = const i0.Value.absent(), - }) => - i3.ActiveSessionsCompanion.insert( - user: user, - bearerToken: bearerToken, - rowid: rowid, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $$ActiveSessionsTableProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i3.$ActiveSessionsTable, - i3.ActiveSession, - i3.$$ActiveSessionsTableFilterComposer, - i3.$$ActiveSessionsTableOrderingComposer, - i3.$$ActiveSessionsTableAnnotationComposer, - $$ActiveSessionsTableCreateCompanionBuilder, - $$ActiveSessionsTableUpdateCompanionBuilder, - ( - i3.ActiveSession, - i0.BaseReferences - ), - i3.ActiveSession, - i0.PrefetchHooks Function({bool user})>; diff --git a/examples/multi_package/shared/lib/src/posts.drift.dart b/examples/multi_package/shared/lib/src/posts.drift.dart index 15dc6565c..80ce09105 100644 --- a/examples/multi_package/shared/lib/src/posts.drift.dart +++ b/examples/multi_package/shared/lib/src/posts.drift.dart @@ -4,6 +4,183 @@ import 'package:shared/src/posts.drift.dart' as i1; import 'package:shared/src/users.drift.dart' as i2; import 'package:drift/internal/modular.dart' as i3; +typedef $PostsCreateCompanionBuilder = i1.PostsCompanion Function({ + required int author, + i0.Value content, + i0.Value rowid, +}); +typedef $PostsUpdateCompanionBuilder = i1.PostsCompanion Function({ + i0.Value author, + i0.Value content, + i0.Value rowid, +}); + +class $PostsFilterComposer extends i0.Composer { + $PostsFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get content => $composableBuilder( + column: $table.content, builder: (column) => i0.ColumnFilters(column)); + + i2.$$UsersTableFilterComposer get author { + final i2.$$UsersTableFilterComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.author, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$$UsersTableFilterComposer( + $db: $db, + $table: i3.ReadDatabaseContainer($db) + .resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $PostsOrderingComposer + extends i0.Composer { + $PostsOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get content => $composableBuilder( + column: $table.content, builder: (column) => i0.ColumnOrderings(column)); + + i2.$$UsersTableOrderingComposer get author { + final i2.$$UsersTableOrderingComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.author, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$$UsersTableOrderingComposer( + $db: $db, + $table: i3.ReadDatabaseContainer($db) + .resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $PostsAnnotationComposer + extends i0.Composer { + $PostsAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get content => + $composableBuilder(column: $table.content, builder: (column) => column); + + i2.$$UsersTableAnnotationComposer get author { + final i2.$$UsersTableAnnotationComposer composer = $composerBuilder( + composer: this, + getCurrentColumn: (t) => t.author, + referencedTable: + i3.ReadDatabaseContainer($db).resultSet('users'), + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + i2.$$UsersTableAnnotationComposer( + $db: $db, + $table: i3.ReadDatabaseContainer($db) + .resultSet('users'), + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); + return composer; + } +} + +class $PostsTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.Posts, + i1.Post, + i1.$PostsFilterComposer, + i1.$PostsOrderingComposer, + i1.$PostsAnnotationComposer, + $PostsCreateCompanionBuilder, + $PostsUpdateCompanionBuilder, + (i1.Post, i0.BaseReferences), + i1.Post, + i0.PrefetchHooks Function({bool author})> { + $PostsTableManager(i0.GeneratedDatabase db, i1.Posts table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$PostsFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$PostsOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$PostsAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value author = const i0.Value.absent(), + i0.Value content = const i0.Value.absent(), + i0.Value rowid = const i0.Value.absent(), + }) => + i1.PostsCompanion( + author: author, + content: content, + rowid: rowid, + ), + createCompanionCallback: ({ + required int author, + i0.Value content = const i0.Value.absent(), + i0.Value rowid = const i0.Value.absent(), + }) => + i1.PostsCompanion.insert( + author: author, + content: content, + rowid: rowid, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $PostsProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.Posts, + i1.Post, + i1.$PostsFilterComposer, + i1.$PostsOrderingComposer, + i1.$PostsAnnotationComposer, + $PostsCreateCompanionBuilder, + $PostsUpdateCompanionBuilder, + (i1.Post, i0.BaseReferences), + i1.Post, + i0.PrefetchHooks Function({bool author})>; + class Posts extends i0.Table with i0.TableInfo { @override final i0.GeneratedDatabase attachedDatabase; @@ -204,180 +381,3 @@ class PostsCompanion extends i0.UpdateCompanion { .toString(); } } - -typedef $PostsCreateCompanionBuilder = i1.PostsCompanion Function({ - required int author, - i0.Value content, - i0.Value rowid, -}); -typedef $PostsUpdateCompanionBuilder = i1.PostsCompanion Function({ - i0.Value author, - i0.Value content, - i0.Value rowid, -}); - -class $PostsFilterComposer extends i0.Composer { - $PostsFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get content => $composableBuilder( - column: $table.content, builder: (column) => i0.ColumnFilters(column)); - - i2.$$UsersTableFilterComposer get author { - final i2.$$UsersTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.author, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$$UsersTableFilterComposer( - $db: $db, - $table: i3.ReadDatabaseContainer($db) - .resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $PostsOrderingComposer - extends i0.Composer { - $PostsOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get content => $composableBuilder( - column: $table.content, builder: (column) => i0.ColumnOrderings(column)); - - i2.$$UsersTableOrderingComposer get author { - final i2.$$UsersTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.author, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$$UsersTableOrderingComposer( - $db: $db, - $table: i3.ReadDatabaseContainer($db) - .resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $PostsAnnotationComposer - extends i0.Composer { - $PostsAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get content => - $composableBuilder(column: $table.content, builder: (column) => column); - - i2.$$UsersTableAnnotationComposer get author { - final i2.$$UsersTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.author, - referencedTable: - i3.ReadDatabaseContainer($db).resultSet('users'), - getReferencedColumn: (t) => t.id, - builder: (joinBuilder, - {$addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer}) => - i2.$$UsersTableAnnotationComposer( - $db: $db, - $table: i3.ReadDatabaseContainer($db) - .resultSet('users'), - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - )); - return composer; - } -} - -class $PostsTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.Posts, - i1.Post, - i1.$PostsFilterComposer, - i1.$PostsOrderingComposer, - i1.$PostsAnnotationComposer, - $PostsCreateCompanionBuilder, - $PostsUpdateCompanionBuilder, - (i1.Post, i0.BaseReferences), - i1.Post, - i0.PrefetchHooks Function({bool author})> { - $PostsTableManager(i0.GeneratedDatabase db, i1.Posts table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$PostsFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$PostsOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$PostsAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value author = const i0.Value.absent(), - i0.Value content = const i0.Value.absent(), - i0.Value rowid = const i0.Value.absent(), - }) => - i1.PostsCompanion( - author: author, - content: content, - rowid: rowid, - ), - createCompanionCallback: ({ - required int author, - i0.Value content = const i0.Value.absent(), - i0.Value rowid = const i0.Value.absent(), - }) => - i1.PostsCompanion.insert( - author: author, - content: content, - rowid: rowid, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $PostsProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.Posts, - i1.Post, - i1.$PostsFilterComposer, - i1.$PostsOrderingComposer, - i1.$PostsAnnotationComposer, - $PostsCreateCompanionBuilder, - $PostsUpdateCompanionBuilder, - (i1.Post, i0.BaseReferences), - i1.Post, - i0.PrefetchHooks Function({bool author})>; diff --git a/examples/multi_package/shared/lib/src/users.drift.dart b/examples/multi_package/shared/lib/src/users.drift.dart index eb523f787..fedea9c45 100644 --- a/examples/multi_package/shared/lib/src/users.drift.dart +++ b/examples/multi_package/shared/lib/src/users.drift.dart @@ -3,6 +3,121 @@ import 'package:drift/drift.dart' as i0; import 'package:shared/src/users.drift.dart' as i1; import 'package:shared/src/users.dart' as i2; +typedef $$UsersTableCreateCompanionBuilder = i1.UsersCompanion Function({ + i0.Value id, + required String name, +}); +typedef $$UsersTableUpdateCompanionBuilder = i1.UsersCompanion Function({ + i0.Value id, + i0.Value name, +}); + +class $$UsersTableFilterComposer + extends i0.Composer { + $$UsersTableFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get name => $composableBuilder( + column: $table.name, builder: (column) => i0.ColumnFilters(column)); +} + +class $$UsersTableOrderingComposer + extends i0.Composer { + $$UsersTableOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get name => $composableBuilder( + column: $table.name, builder: (column) => i0.ColumnOrderings(column)); +} + +class $$UsersTableAnnotationComposer + extends i0.Composer { + $$UsersTableAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get name => + $composableBuilder(column: $table.name, builder: (column) => column); +} + +class $$UsersTableTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.$UsersTable, + i1.User, + i1.$$UsersTableFilterComposer, + i1.$$UsersTableOrderingComposer, + i1.$$UsersTableAnnotationComposer, + $$UsersTableCreateCompanionBuilder, + $$UsersTableUpdateCompanionBuilder, + (i1.User, i0.BaseReferences), + i1.User, + i0.PrefetchHooks Function()> { + $$UsersTableTableManager(i0.GeneratedDatabase db, i1.$UsersTable table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$$UsersTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$$UsersTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$$UsersTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value name = const i0.Value.absent(), + }) => + i1.UsersCompanion( + id: id, + name: name, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required String name, + }) => + i1.UsersCompanion.insert( + id: id, + name: name, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $$UsersTableProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.$UsersTable, + i1.User, + i1.$$UsersTableFilterComposer, + i1.$$UsersTableOrderingComposer, + i1.$$UsersTableAnnotationComposer, + $$UsersTableCreateCompanionBuilder, + $$UsersTableUpdateCompanionBuilder, + (i1.User, i0.BaseReferences), + i1.User, + i0.PrefetchHooks Function()>; + class $UsersTable extends i2.Users with i0.TableInfo<$UsersTable, i1.User> { @override final i0.GeneratedDatabase attachedDatabase; @@ -179,118 +294,3 @@ class UsersCompanion extends i0.UpdateCompanion { .toString(); } } - -typedef $$UsersTableCreateCompanionBuilder = i1.UsersCompanion Function({ - i0.Value id, - required String name, -}); -typedef $$UsersTableUpdateCompanionBuilder = i1.UsersCompanion Function({ - i0.Value id, - i0.Value name, -}); - -class $$UsersTableFilterComposer - extends i0.Composer { - $$UsersTableFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get name => $composableBuilder( - column: $table.name, builder: (column) => i0.ColumnFilters(column)); -} - -class $$UsersTableOrderingComposer - extends i0.Composer { - $$UsersTableOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get name => $composableBuilder( - column: $table.name, builder: (column) => i0.ColumnOrderings(column)); -} - -class $$UsersTableAnnotationComposer - extends i0.Composer { - $$UsersTableAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get name => - $composableBuilder(column: $table.name, builder: (column) => column); -} - -class $$UsersTableTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.$UsersTable, - i1.User, - i1.$$UsersTableFilterComposer, - i1.$$UsersTableOrderingComposer, - i1.$$UsersTableAnnotationComposer, - $$UsersTableCreateCompanionBuilder, - $$UsersTableUpdateCompanionBuilder, - (i1.User, i0.BaseReferences), - i1.User, - i0.PrefetchHooks Function()> { - $$UsersTableTableManager(i0.GeneratedDatabase db, i1.$UsersTable table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$$UsersTableFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$$UsersTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$$UsersTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value name = const i0.Value.absent(), - }) => - i1.UsersCompanion( - id: id, - name: name, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required String name, - }) => - i1.UsersCompanion.insert( - id: id, - name: name, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $$UsersTableProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.$UsersTable, - i1.User, - i1.$$UsersTableFilterComposer, - i1.$$UsersTableOrderingComposer, - i1.$$UsersTableAnnotationComposer, - $$UsersTableCreateCompanionBuilder, - $$UsersTableUpdateCompanionBuilder, - (i1.User, i0.BaseReferences), - i1.User, - i0.PrefetchHooks Function()>; diff --git a/examples/with_built_value/lib/tables.drift.dart b/examples/with_built_value/lib/tables.drift.dart index 26f146340..30bbb497d 100644 --- a/examples/with_built_value/lib/tables.drift.dart +++ b/examples/with_built_value/lib/tables.drift.dart @@ -2,6 +2,120 @@ import 'package:drift/drift.dart' as i0; import 'package:with_built_value/tables.drift.dart' as i1; +typedef $UsersCreateCompanionBuilder = i1.UsersCompanion Function({ + i0.Value id, + required String name, +}); +typedef $UsersUpdateCompanionBuilder = i1.UsersCompanion Function({ + i0.Value id, + i0.Value name, +}); + +class $UsersFilterComposer extends i0.Composer { + $UsersFilterComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnFilters get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnFilters(column)); + + i0.ColumnFilters get name => $composableBuilder( + column: $table.name, builder: (column) => i0.ColumnFilters(column)); +} + +class $UsersOrderingComposer + extends i0.Composer { + $UsersOrderingComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.ColumnOrderings get id => $composableBuilder( + column: $table.id, builder: (column) => i0.ColumnOrderings(column)); + + i0.ColumnOrderings get name => $composableBuilder( + column: $table.name, builder: (column) => i0.ColumnOrderings(column)); +} + +class $UsersAnnotationComposer + extends i0.Composer { + $UsersAnnotationComposer({ + required super.$db, + required super.$table, + super.joinBuilder, + super.$addJoinBuilderToRootComposer, + super.$removeJoinBuilderFromRootComposer, + }); + i0.GeneratedColumn get id => + $composableBuilder(column: $table.id, builder: (column) => column); + + i0.GeneratedColumn get name => + $composableBuilder(column: $table.name, builder: (column) => column); +} + +class $UsersTableManager extends i0.RootTableManager< + i0.GeneratedDatabase, + i1.Users, + i1.User, + i1.$UsersFilterComposer, + i1.$UsersOrderingComposer, + i1.$UsersAnnotationComposer, + $UsersCreateCompanionBuilder, + $UsersUpdateCompanionBuilder, + (i1.User, i0.BaseReferences), + i1.User, + i0.PrefetchHooks Function()> { + $UsersTableManager(i0.GeneratedDatabase db, i1.Users table) + : super(i0.TableManagerState( + db: db, + table: table, + createFilteringComposer: () => + i1.$UsersFilterComposer($db: db, $table: table), + createOrderingComposer: () => + i1.$UsersOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + i1.$UsersAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + i0.Value name = const i0.Value.absent(), + }) => + i1.UsersCompanion( + id: id, + name: name, + ), + createCompanionCallback: ({ + i0.Value id = const i0.Value.absent(), + required String name, + }) => + i1.UsersCompanion.insert( + id: id, + name: name, + ), + withReferenceMapper: (p0) => p0 + .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) + .toList(), + prefetchHooksCallback: null, + )); +} + +typedef $UsersProcessedTableManager = i0.ProcessedTableManager< + i0.GeneratedDatabase, + i1.Users, + i1.User, + i1.$UsersFilterComposer, + i1.$UsersOrderingComposer, + i1.$UsersAnnotationComposer, + $UsersCreateCompanionBuilder, + $UsersUpdateCompanionBuilder, + (i1.User, i0.BaseReferences), + i1.User, + i0.PrefetchHooks Function()>; + class Users extends i0.Table with i0.TableInfo { @override final i0.GeneratedDatabase attachedDatabase; @@ -180,117 +294,3 @@ class UsersCompanion extends i0.UpdateCompanion { .toString(); } } - -typedef $UsersCreateCompanionBuilder = i1.UsersCompanion Function({ - i0.Value id, - required String name, -}); -typedef $UsersUpdateCompanionBuilder = i1.UsersCompanion Function({ - i0.Value id, - i0.Value name, -}); - -class $UsersFilterComposer extends i0.Composer { - $UsersFilterComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnFilters get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnFilters(column)); - - i0.ColumnFilters get name => $composableBuilder( - column: $table.name, builder: (column) => i0.ColumnFilters(column)); -} - -class $UsersOrderingComposer - extends i0.Composer { - $UsersOrderingComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.ColumnOrderings get id => $composableBuilder( - column: $table.id, builder: (column) => i0.ColumnOrderings(column)); - - i0.ColumnOrderings get name => $composableBuilder( - column: $table.name, builder: (column) => i0.ColumnOrderings(column)); -} - -class $UsersAnnotationComposer - extends i0.Composer { - $UsersAnnotationComposer({ - required super.$db, - required super.$table, - super.joinBuilder, - super.$addJoinBuilderToRootComposer, - super.$removeJoinBuilderFromRootComposer, - }); - i0.GeneratedColumn get id => - $composableBuilder(column: $table.id, builder: (column) => column); - - i0.GeneratedColumn get name => - $composableBuilder(column: $table.name, builder: (column) => column); -} - -class $UsersTableManager extends i0.RootTableManager< - i0.GeneratedDatabase, - i1.Users, - i1.User, - i1.$UsersFilterComposer, - i1.$UsersOrderingComposer, - i1.$UsersAnnotationComposer, - $UsersCreateCompanionBuilder, - $UsersUpdateCompanionBuilder, - (i1.User, i0.BaseReferences), - i1.User, - i0.PrefetchHooks Function()> { - $UsersTableManager(i0.GeneratedDatabase db, i1.Users table) - : super(i0.TableManagerState( - db: db, - table: table, - createFilteringComposer: () => - i1.$UsersFilterComposer($db: db, $table: table), - createOrderingComposer: () => - i1.$UsersOrderingComposer($db: db, $table: table), - createComputedFieldComposer: () => - i1.$UsersAnnotationComposer($db: db, $table: table), - updateCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - i0.Value name = const i0.Value.absent(), - }) => - i1.UsersCompanion( - id: id, - name: name, - ), - createCompanionCallback: ({ - i0.Value id = const i0.Value.absent(), - required String name, - }) => - i1.UsersCompanion.insert( - id: id, - name: name, - ), - withReferenceMapper: (p0) => p0 - .map((e) => (e.readTable(table), i0.BaseReferences(db, table, e))) - .toList(), - prefetchHooksCallback: null, - )); -} - -typedef $UsersProcessedTableManager = i0.ProcessedTableManager< - i0.GeneratedDatabase, - i1.Users, - i1.User, - i1.$UsersFilterComposer, - i1.$UsersOrderingComposer, - i1.$UsersAnnotationComposer, - $UsersCreateCompanionBuilder, - $UsersUpdateCompanionBuilder, - (i1.User, i0.BaseReferences), - i1.User, - i0.PrefetchHooks Function()>;