// GENERATED CODE - DO NOT MODIFY BY HAND part of 'database.dart'; // ignore_for_file: type=lint class $CategoriesTable extends Categories with TableInfo<$CategoriesTable, Category> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $CategoriesTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _nameMeta = const VerificationMeta('name'); @override late final GeneratedColumn name = GeneratedColumn( 'name', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); @override late final GeneratedColumnWithTypeConverter color = GeneratedColumn('color', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true) .withConverter($CategoriesTable.$convertercolor); @override List get $columns => [id, name, color]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'categories'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('name')) { context.handle( _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); } else if (isInserting) { context.missing(_nameMeta); } return context; } @override Set get $primaryKey => {id}; @override Category map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Category( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, name: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}name'])!, color: $CategoriesTable.$convertercolor.fromSql(attachedDatabase .typeMapping .read(DriftSqlType.int, data['${effectivePrefix}color'])!), ); } @override $CategoriesTable createAlias(String alias) { return $CategoriesTable(attachedDatabase, alias); } static TypeConverter $convertercolor = const ColorConverter(); } class Category extends DataClass implements Insertable { final int id; final String name; final Color color; const Category({required this.id, required this.name, required this.color}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); { map['color'] = Variable($CategoriesTable.$convertercolor.toSql(color)); } return map; } CategoriesCompanion toCompanion(bool nullToAbsent) { return CategoriesCompanion( id: Value(id), name: Value(name), color: Value(color), ); } factory Category.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Category( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), color: serializer.fromJson(json['color']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), 'color': serializer.toJson(color), }; } Category copyWith({int? id, String? name, Color? color}) => Category( id: id ?? this.id, name: name ?? this.name, color: color ?? this.color, ); Category copyWithCompanion(CategoriesCompanion data) { return Category( id: data.id.present ? data.id.value : this.id, name: data.name.present ? data.name.value : this.name, color: data.color.present ? data.color.value : this.color, ); } @override String toString() { return (StringBuffer('Category(') ..write('id: $id, ') ..write('name: $name, ') ..write('color: $color') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, name, color); @override bool operator ==(Object other) => identical(this, other) || (other is Category && other.id == this.id && other.name == this.name && other.color == this.color); } class CategoriesCompanion extends UpdateCompanion { final Value id; final Value name; final Value color; const CategoriesCompanion({ this.id = const Value.absent(), this.name = const Value.absent(), this.color = const Value.absent(), }); CategoriesCompanion.insert({ this.id = const Value.absent(), required String name, required Color color, }) : name = Value(name), color = Value(color); static Insertable custom({ Expression? id, Expression? name, Expression? color, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (name != null) 'name': name, if (color != null) 'color': color, }); } CategoriesCompanion copyWith( {Value? id, Value? name, Value? color}) { return CategoriesCompanion( id: id ?? this.id, name: name ?? this.name, color: color ?? this.color, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (name.present) { map['name'] = Variable(name.value); } if (color.present) { map['color'] = Variable($CategoriesTable.$convertercolor.toSql(color.value)); } return map; } @override String toString() { return (StringBuffer('CategoriesCompanion(') ..write('id: $id, ') ..write('name: $name, ') ..write('color: $color') ..write(')')) .toString(); } } class $TodoEntriesTable extends TodoEntries with TableInfo<$TodoEntriesTable, TodoEntry> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $TodoEntriesTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _descriptionMeta = const VerificationMeta('description'); @override late final GeneratedColumn description = GeneratedColumn( 'description', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _categoryMeta = const VerificationMeta('category'); @override late final GeneratedColumn category = GeneratedColumn( 'category', aliasedName, true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('REFERENCES categories (id)')); static const VerificationMeta _dueDateMeta = const VerificationMeta('dueDate'); @override late final GeneratedColumn dueDate = GeneratedColumn( 'due_date', aliasedName, true, type: DriftSqlType.dateTime, requiredDuringInsert: false); @override List get $columns => [id, description, category, dueDate]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'todo_entries'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta)); } if (data.containsKey('description')) { context.handle( _descriptionMeta, description.isAcceptableOrUnknown( data['description']!, _descriptionMeta)); } else if (isInserting) { context.missing(_descriptionMeta); } if (data.containsKey('category')) { context.handle(_categoryMeta, category.isAcceptableOrUnknown(data['category']!, _categoryMeta)); } if (data.containsKey('due_date')) { context.handle(_dueDateMeta, dueDate.isAcceptableOrUnknown(data['due_date']!, _dueDateMeta)); } return context; } @override Set get $primaryKey => {id}; @override TodoEntry map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return TodoEntry( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, description: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}description'])!, category: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}category']), dueDate: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}due_date']), ); } @override $TodoEntriesTable createAlias(String alias) { return $TodoEntriesTable(attachedDatabase, alias); } } class TodoEntry extends DataClass implements Insertable { final int id; final String description; final int? category; final DateTime? dueDate; const TodoEntry( {required this.id, required this.description, this.category, this.dueDate}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['description'] = Variable(description); if (!nullToAbsent || category != null) { map['category'] = Variable(category); } if (!nullToAbsent || dueDate != null) { map['due_date'] = Variable(dueDate); } return map; } TodoEntriesCompanion toCompanion(bool nullToAbsent) { return TodoEntriesCompanion( id: Value(id), description: Value(description), category: category == null && nullToAbsent ? const Value.absent() : Value(category), dueDate: dueDate == null && nullToAbsent ? const Value.absent() : Value(dueDate), ); } factory TodoEntry.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return TodoEntry( id: serializer.fromJson(json['id']), description: serializer.fromJson(json['description']), category: serializer.fromJson(json['category']), dueDate: serializer.fromJson(json['dueDate']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'description': serializer.toJson(description), 'category': serializer.toJson(category), 'dueDate': serializer.toJson(dueDate), }; } TodoEntry copyWith( {int? id, String? description, Value category = const Value.absent(), Value dueDate = const Value.absent()}) => TodoEntry( id: id ?? this.id, description: description ?? this.description, category: category.present ? category.value : this.category, dueDate: dueDate.present ? dueDate.value : this.dueDate, ); TodoEntry copyWithCompanion(TodoEntriesCompanion data) { return TodoEntry( id: data.id.present ? data.id.value : this.id, description: data.description.present ? data.description.value : this.description, category: data.category.present ? data.category.value : this.category, dueDate: data.dueDate.present ? data.dueDate.value : this.dueDate, ); } @override String toString() { return (StringBuffer('TodoEntry(') ..write('id: $id, ') ..write('description: $description, ') ..write('category: $category, ') ..write('dueDate: $dueDate') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, description, category, dueDate); @override bool operator ==(Object other) => identical(this, other) || (other is TodoEntry && other.id == this.id && other.description == this.description && other.category == this.category && other.dueDate == this.dueDate); } class TodoEntriesCompanion extends UpdateCompanion { final Value id; final Value description; final Value category; final Value dueDate; const TodoEntriesCompanion({ this.id = const Value.absent(), this.description = const Value.absent(), this.category = const Value.absent(), this.dueDate = const Value.absent(), }); TodoEntriesCompanion.insert({ this.id = const Value.absent(), required String description, this.category = const Value.absent(), this.dueDate = const Value.absent(), }) : description = Value(description); static Insertable custom({ Expression? id, Expression? description, Expression? category, Expression? dueDate, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (description != null) 'description': description, if (category != null) 'category': category, if (dueDate != null) 'due_date': dueDate, }); } TodoEntriesCompanion copyWith( {Value? id, Value? description, Value? category, Value? dueDate}) { return TodoEntriesCompanion( id: id ?? this.id, description: description ?? this.description, category: category ?? this.category, dueDate: dueDate ?? this.dueDate, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (description.present) { map['description'] = Variable(description.value); } if (category.present) { map['category'] = Variable(category.value); } if (dueDate.present) { map['due_date'] = Variable(dueDate.value); } return map; } @override String toString() { return (StringBuffer('TodoEntriesCompanion(') ..write('id: $id, ') ..write('description: $description, ') ..write('category: $category, ') ..write('dueDate: $dueDate') ..write(')')) .toString(); } } class TextEntries extends Table with TableInfo, VirtualTableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; TextEntries(this.attachedDatabase, [this._alias]); static const VerificationMeta _descriptionMeta = const VerificationMeta('description'); late final GeneratedColumn description = GeneratedColumn( 'description', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: ''); @override List get $columns => [description]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'text_entries'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('description')) { context.handle( _descriptionMeta, description.isAcceptableOrUnknown( data['description']!, _descriptionMeta)); } else if (isInserting) { context.missing(_descriptionMeta); } return context; } @override Set get $primaryKey => const {}; @override TextEntry map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return TextEntry( description: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}description'])!, ); } @override TextEntries createAlias(String alias) { return TextEntries(attachedDatabase, alias); } @override bool get dontWriteConstraints => true; @override String get moduleAndArgs => 'fts5(description, content=todo_entries, content_rowid=id)'; } class TextEntry extends DataClass implements Insertable { final String description; const TextEntry({required this.description}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['description'] = Variable(description); return map; } TextEntriesCompanion toCompanion(bool nullToAbsent) { return TextEntriesCompanion( description: Value(description), ); } factory TextEntry.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return TextEntry( description: serializer.fromJson(json['description']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'description': serializer.toJson(description), }; } TextEntry copyWith({String? description}) => TextEntry( description: description ?? this.description, ); TextEntry copyWithCompanion(TextEntriesCompanion data) { return TextEntry( description: data.description.present ? data.description.value : this.description, ); } @override String toString() { return (StringBuffer('TextEntry(') ..write('description: $description') ..write(')')) .toString(); } @override int get hashCode => description.hashCode; @override bool operator ==(Object other) => identical(this, other) || (other is TextEntry && other.description == this.description); } class TextEntriesCompanion extends UpdateCompanion { final Value description; final Value rowid; const TextEntriesCompanion({ this.description = const Value.absent(), this.rowid = const Value.absent(), }); TextEntriesCompanion.insert({ required String description, this.rowid = const Value.absent(), }) : description = Value(description); static Insertable custom({ Expression? description, Expression? rowid, }) { return RawValuesInsertable({ if (description != null) 'description': description, if (rowid != null) 'rowid': rowid, }); } TextEntriesCompanion copyWith( {Value? description, Value? rowid}) { return TextEntriesCompanion( description: description ?? this.description, rowid: rowid ?? this.rowid, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (description.present) { map['description'] = Variable(description.value); } if (rowid.present) { map['rowid'] = Variable(rowid.value); } return map; } @override String toString() { return (StringBuffer('TextEntriesCompanion(') ..write('description: $description, ') ..write('rowid: $rowid') ..write(')')) .toString(); } } abstract class _$AppDatabase extends GeneratedDatabase { _$AppDatabase(QueryExecutor e) : super(e); $AppDatabaseManager get managers => $AppDatabaseManager(this); late final $CategoriesTable categories = $CategoriesTable(this); late final $TodoEntriesTable todoEntries = $TodoEntriesTable(this); late final TextEntries textEntries = TextEntries(this); late final Trigger todosInsert = Trigger( 'CREATE TRIGGER todos_insert AFTER INSERT ON todo_entries BEGIN INSERT INTO text_entries ("rowid", description) VALUES (new.id, new.description);END', 'todos_insert'); late final Trigger todosDelete = Trigger( 'CREATE TRIGGER todos_delete AFTER DELETE ON todo_entries BEGIN INSERT INTO text_entries (text_entries, "rowid", description) VALUES (\'delete\', old.id, old.description);END', 'todos_delete'); late final Trigger todosUpdate = Trigger( 'CREATE TRIGGER todos_update AFTER UPDATE ON todo_entries BEGIN INSERT INTO text_entries (text_entries, "rowid", description) VALUES (\'delete\', new.id, new.description);INSERT INTO text_entries ("rowid", description) VALUES (new.id, new.description);END', 'todos_update'); Selectable _categoriesWithCount() { return customSelect( 'SELECT c.*, (SELECT COUNT(*) FROM todo_entries WHERE category = c.id) AS amount FROM categories AS c UNION ALL SELECT NULL, NULL, NULL, (SELECT COUNT(*) FROM todo_entries WHERE category IS NULL)', variables: [], readsFrom: { todoEntries, categories, }).map((QueryRow row) => CategoriesWithCountResult( id: row.readNullable('id'), name: row.readNullable('name'), color: NullAwareTypeConverter.wrapFromSql( $CategoriesTable.$convertercolor, row.readNullable('color')), amount: row.read('amount'), )); } Selectable _search(String query) { return customSelect( 'SELECT"todos"."id" AS "nested_0.id", "todos"."description" AS "nested_0.description", "todos"."category" AS "nested_0.category", "todos"."due_date" AS "nested_0.due_date","cat"."id" AS "nested_1.id", "cat"."name" AS "nested_1.name", "cat"."color" AS "nested_1.color" FROM text_entries INNER JOIN todo_entries AS todos ON todos.id = text_entries."rowid" LEFT OUTER JOIN categories AS cat ON cat.id = todos.category WHERE text_entries MATCH ?1 ORDER BY rank', variables: [ Variable(query) ], readsFrom: { textEntries, todoEntries, categories, }).asyncMap((QueryRow row) async => SearchResult( todos: await todoEntries.mapFromRow(row, tablePrefix: 'nested_0'), cat: await categories.mapFromRowOrNull(row, tablePrefix: 'nested_1'), )); } @override Iterable> get allTables => allSchemaEntities.whereType>(); @override List get allSchemaEntities => [ categories, todoEntries, textEntries, todosInsert, todosDelete, todosUpdate ]; @override StreamQueryUpdateRules get streamUpdateRules => const StreamQueryUpdateRules( [ WritePropagation( on: TableUpdateQuery.onTableName('todo_entries', limitUpdateKind: UpdateKind.insert), result: [ TableUpdate('text_entries', kind: UpdateKind.insert), ], ), WritePropagation( on: TableUpdateQuery.onTableName('todo_entries', limitUpdateKind: UpdateKind.delete), result: [ TableUpdate('text_entries', kind: UpdateKind.insert), ], ), WritePropagation( on: TableUpdateQuery.onTableName('todo_entries', limitUpdateKind: UpdateKind.update), result: [ TableUpdate('text_entries', kind: UpdateKind.insert), ], ), ], ); } typedef $$CategoriesTableCreateCompanionBuilder = CategoriesCompanion Function({ Value id, required String name, required Color color, }); typedef $$CategoriesTableUpdateCompanionBuilder = CategoriesCompanion Function({ Value id, Value name, Value color, }); final class $$CategoriesTableReferences extends BaseReferences<_$AppDatabase, $CategoriesTable, Category> { $$CategoriesTableReferences(super.$_db, super.$_table, super.$_typedResult); static MultiTypedResultKey<$TodoEntriesTable, List> _todoEntriesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable( db.todoEntries, aliasName: $_aliasNameGenerator(db.categories.id, db.todoEntries.category)); $$TodoEntriesTableProcessedTableManager get todoEntriesRefs { final manager = $$TodoEntriesTableTableManager($_db, $_db.todoEntries) .filter((f) => f.category.id.sqlEquals($_itemColumn('id')!)); final cache = $_typedResult.readTableOrNull(_todoEntriesRefsTable($_db)); return ProcessedTableManager( manager.$state.copyWith(prefetchedData: cache)); } } class $$CategoriesTableFilterComposer extends Composer<_$AppDatabase, $CategoriesTable> { $$CategoriesTableFilterComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get id => $composableBuilder( column: $table.id, builder: (column) => ColumnFilters(column)); ColumnFilters get name => $composableBuilder( column: $table.name, builder: (column) => ColumnFilters(column)); ColumnWithTypeConverterFilters get color => $composableBuilder( column: $table.color, builder: (column) => ColumnWithTypeConverterFilters(column)); Expression todoEntriesRefs( Expression Function($$TodoEntriesTableFilterComposer f) f) { final $$TodoEntriesTableFilterComposer composer = $composerBuilder( composer: this, getCurrentColumn: (t) => t.id, referencedTable: $db.todoEntries, getReferencedColumn: (t) => t.category, builder: (joinBuilder, {$addJoinBuilderToRootComposer, $removeJoinBuilderFromRootComposer}) => $$TodoEntriesTableFilterComposer( $db: $db, $table: $db.todoEntries, $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, joinBuilder: joinBuilder, $removeJoinBuilderFromRootComposer: $removeJoinBuilderFromRootComposer, )); return f(composer); } } class $$CategoriesTableOrderingComposer extends Composer<_$AppDatabase, $CategoriesTable> { $$CategoriesTableOrderingComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get id => $composableBuilder( column: $table.id, builder: (column) => ColumnOrderings(column)); ColumnOrderings get name => $composableBuilder( column: $table.name, builder: (column) => ColumnOrderings(column)); ColumnOrderings get color => $composableBuilder( column: $table.color, builder: (column) => ColumnOrderings(column)); } class $$CategoriesTableAnnotationComposer extends Composer<_$AppDatabase, $CategoriesTable> { $$CategoriesTableAnnotationComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); GeneratedColumn get name => $composableBuilder(column: $table.name, builder: (column) => column); GeneratedColumnWithTypeConverter get color => $composableBuilder(column: $table.color, builder: (column) => column); Expression todoEntriesRefs( Expression Function($$TodoEntriesTableAnnotationComposer a) f) { final $$TodoEntriesTableAnnotationComposer composer = $composerBuilder( composer: this, getCurrentColumn: (t) => t.id, referencedTable: $db.todoEntries, getReferencedColumn: (t) => t.category, builder: (joinBuilder, {$addJoinBuilderToRootComposer, $removeJoinBuilderFromRootComposer}) => $$TodoEntriesTableAnnotationComposer( $db: $db, $table: $db.todoEntries, $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, joinBuilder: joinBuilder, $removeJoinBuilderFromRootComposer: $removeJoinBuilderFromRootComposer, )); return f(composer); } } class $$CategoriesTableTableManager extends RootTableManager< _$AppDatabase, $CategoriesTable, Category, $$CategoriesTableFilterComposer, $$CategoriesTableOrderingComposer, $$CategoriesTableAnnotationComposer, $$CategoriesTableCreateCompanionBuilder, $$CategoriesTableUpdateCompanionBuilder, (Category, $$CategoriesTableReferences), Category, PrefetchHooks Function({bool todoEntriesRefs})> { $$CategoriesTableTableManager(_$AppDatabase db, $CategoriesTable table) : super(TableManagerState( db: db, table: table, createFilteringComposer: () => $$CategoriesTableFilterComposer($db: db, $table: table), createOrderingComposer: () => $$CategoriesTableOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => $$CategoriesTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value id = const Value.absent(), Value name = const Value.absent(), Value color = const Value.absent(), }) => CategoriesCompanion( id: id, name: name, color: color, ), createCompanionCallback: ({ Value id = const Value.absent(), required String name, required Color color, }) => CategoriesCompanion.insert( id: id, name: name, color: color, ), withReferenceMapper: (p0) => p0 .map((e) => ( e.readTable(table), $$CategoriesTableReferences(db, table, e) )) .toList(), prefetchHooksCallback: ({todoEntriesRefs = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [if (todoEntriesRefs) db.todoEntries], addJoins: null, getPrefetchedDataCallback: (items) async { return [ if (todoEntriesRefs) await $_getPrefetchedData( currentTable: table, referencedTable: $$CategoriesTableReferences ._todoEntriesRefsTable(db), managerFromTypedResult: (p0) => $$CategoriesTableReferences(db, table, p0) .todoEntriesRefs, referencedItemsForCurrentItem: (item, referencedItems) => referencedItems.where((e) => e.category == item.id), typedResults: items) ]; }, ); }, )); } typedef $$CategoriesTableProcessedTableManager = ProcessedTableManager< _$AppDatabase, $CategoriesTable, Category, $$CategoriesTableFilterComposer, $$CategoriesTableOrderingComposer, $$CategoriesTableAnnotationComposer, $$CategoriesTableCreateCompanionBuilder, $$CategoriesTableUpdateCompanionBuilder, (Category, $$CategoriesTableReferences), Category, PrefetchHooks Function({bool todoEntriesRefs})>; typedef $$TodoEntriesTableCreateCompanionBuilder = TodoEntriesCompanion Function({ Value id, required String description, Value category, Value dueDate, }); typedef $$TodoEntriesTableUpdateCompanionBuilder = TodoEntriesCompanion Function({ Value id, Value description, Value category, Value dueDate, }); final class $$TodoEntriesTableReferences extends BaseReferences<_$AppDatabase, $TodoEntriesTable, TodoEntry> { $$TodoEntriesTableReferences(super.$_db, super.$_table, super.$_typedResult); static $CategoriesTable _categoryTable(_$AppDatabase db) => db.categories.createAlias( $_aliasNameGenerator(db.todoEntries.category, db.categories.id)); $$CategoriesTableProcessedTableManager? get category { final $_column = $_itemColumn('category'); if ($_column == null) return null; final manager = $$CategoriesTableTableManager($_db, $_db.categories) .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_categoryTable($_db)); if (item == null) return manager; return ProcessedTableManager( manager.$state.copyWith(prefetchedData: [item])); } } class $$TodoEntriesTableFilterComposer extends Composer<_$AppDatabase, $TodoEntriesTable> { $$TodoEntriesTableFilterComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get id => $composableBuilder( column: $table.id, builder: (column) => ColumnFilters(column)); ColumnFilters get description => $composableBuilder( column: $table.description, builder: (column) => ColumnFilters(column)); ColumnFilters get dueDate => $composableBuilder( column: $table.dueDate, builder: (column) => ColumnFilters(column)); $$CategoriesTableFilterComposer get category { final $$CategoriesTableFilterComposer composer = $composerBuilder( composer: this, getCurrentColumn: (t) => t.category, referencedTable: $db.categories, getReferencedColumn: (t) => t.id, builder: (joinBuilder, {$addJoinBuilderToRootComposer, $removeJoinBuilderFromRootComposer}) => $$CategoriesTableFilterComposer( $db: $db, $table: $db.categories, $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, joinBuilder: joinBuilder, $removeJoinBuilderFromRootComposer: $removeJoinBuilderFromRootComposer, )); return composer; } } class $$TodoEntriesTableOrderingComposer extends Composer<_$AppDatabase, $TodoEntriesTable> { $$TodoEntriesTableOrderingComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get id => $composableBuilder( column: $table.id, builder: (column) => ColumnOrderings(column)); ColumnOrderings get description => $composableBuilder( column: $table.description, builder: (column) => ColumnOrderings(column)); ColumnOrderings get dueDate => $composableBuilder( column: $table.dueDate, builder: (column) => ColumnOrderings(column)); $$CategoriesTableOrderingComposer get category { final $$CategoriesTableOrderingComposer composer = $composerBuilder( composer: this, getCurrentColumn: (t) => t.category, referencedTable: $db.categories, getReferencedColumn: (t) => t.id, builder: (joinBuilder, {$addJoinBuilderToRootComposer, $removeJoinBuilderFromRootComposer}) => $$CategoriesTableOrderingComposer( $db: $db, $table: $db.categories, $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, joinBuilder: joinBuilder, $removeJoinBuilderFromRootComposer: $removeJoinBuilderFromRootComposer, )); return composer; } } class $$TodoEntriesTableAnnotationComposer extends Composer<_$AppDatabase, $TodoEntriesTable> { $$TodoEntriesTableAnnotationComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); GeneratedColumn get id => $composableBuilder(column: $table.id, builder: (column) => column); GeneratedColumn get description => $composableBuilder( column: $table.description, builder: (column) => column); GeneratedColumn get dueDate => $composableBuilder(column: $table.dueDate, builder: (column) => column); $$CategoriesTableAnnotationComposer get category { final $$CategoriesTableAnnotationComposer composer = $composerBuilder( composer: this, getCurrentColumn: (t) => t.category, referencedTable: $db.categories, getReferencedColumn: (t) => t.id, builder: (joinBuilder, {$addJoinBuilderToRootComposer, $removeJoinBuilderFromRootComposer}) => $$CategoriesTableAnnotationComposer( $db: $db, $table: $db.categories, $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, joinBuilder: joinBuilder, $removeJoinBuilderFromRootComposer: $removeJoinBuilderFromRootComposer, )); return composer; } } class $$TodoEntriesTableTableManager extends RootTableManager< _$AppDatabase, $TodoEntriesTable, TodoEntry, $$TodoEntriesTableFilterComposer, $$TodoEntriesTableOrderingComposer, $$TodoEntriesTableAnnotationComposer, $$TodoEntriesTableCreateCompanionBuilder, $$TodoEntriesTableUpdateCompanionBuilder, (TodoEntry, $$TodoEntriesTableReferences), TodoEntry, PrefetchHooks Function({bool category})> { $$TodoEntriesTableTableManager(_$AppDatabase db, $TodoEntriesTable table) : super(TableManagerState( db: db, table: table, createFilteringComposer: () => $$TodoEntriesTableFilterComposer($db: db, $table: table), createOrderingComposer: () => $$TodoEntriesTableOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => $$TodoEntriesTableAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value id = const Value.absent(), Value description = const Value.absent(), Value category = const Value.absent(), Value dueDate = const Value.absent(), }) => TodoEntriesCompanion( id: id, description: description, category: category, dueDate: dueDate, ), createCompanionCallback: ({ Value id = const Value.absent(), required String description, Value category = const Value.absent(), Value dueDate = const Value.absent(), }) => TodoEntriesCompanion.insert( id: id, description: description, category: category, dueDate: dueDate, ), withReferenceMapper: (p0) => p0 .map((e) => ( e.readTable(table), $$TodoEntriesTableReferences(db, table, e) )) .toList(), prefetchHooksCallback: ({category = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [], addJoins: < T extends TableManagerState< dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic, dynamic>>(state) { if (category) { state = state.withJoin( currentTable: table, currentColumn: table.category, referencedTable: $$TodoEntriesTableReferences._categoryTable(db), referencedColumn: $$TodoEntriesTableReferences._categoryTable(db).id, ) as T; } return state; }, getPrefetchedDataCallback: (items) async { return []; }, ); }, )); } typedef $$TodoEntriesTableProcessedTableManager = ProcessedTableManager< _$AppDatabase, $TodoEntriesTable, TodoEntry, $$TodoEntriesTableFilterComposer, $$TodoEntriesTableOrderingComposer, $$TodoEntriesTableAnnotationComposer, $$TodoEntriesTableCreateCompanionBuilder, $$TodoEntriesTableUpdateCompanionBuilder, (TodoEntry, $$TodoEntriesTableReferences), TodoEntry, PrefetchHooks Function({bool category})>; typedef $TextEntriesCreateCompanionBuilder = TextEntriesCompanion Function({ required String description, Value rowid, }); typedef $TextEntriesUpdateCompanionBuilder = TextEntriesCompanion Function({ Value description, Value rowid, }); class $TextEntriesFilterComposer extends Composer<_$AppDatabase, TextEntries> { $TextEntriesFilterComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get description => $composableBuilder( column: $table.description, builder: (column) => ColumnFilters(column)); } class $TextEntriesOrderingComposer extends Composer<_$AppDatabase, TextEntries> { $TextEntriesOrderingComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get description => $composableBuilder( column: $table.description, builder: (column) => ColumnOrderings(column)); } class $TextEntriesAnnotationComposer extends Composer<_$AppDatabase, TextEntries> { $TextEntriesAnnotationComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); GeneratedColumn get description => $composableBuilder( column: $table.description, builder: (column) => column); } class $TextEntriesTableManager extends RootTableManager< _$AppDatabase, TextEntries, TextEntry, $TextEntriesFilterComposer, $TextEntriesOrderingComposer, $TextEntriesAnnotationComposer, $TextEntriesCreateCompanionBuilder, $TextEntriesUpdateCompanionBuilder, (TextEntry, BaseReferences<_$AppDatabase, TextEntries, TextEntry>), TextEntry, PrefetchHooks Function()> { $TextEntriesTableManager(_$AppDatabase db, TextEntries table) : super(TableManagerState( db: db, table: table, createFilteringComposer: () => $TextEntriesFilterComposer($db: db, $table: table), createOrderingComposer: () => $TextEntriesOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => $TextEntriesAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value description = const Value.absent(), Value rowid = const Value.absent(), }) => TextEntriesCompanion( description: description, rowid: rowid, ), createCompanionCallback: ({ required String description, Value rowid = const Value.absent(), }) => TextEntriesCompanion.insert( description: description, rowid: rowid, ), withReferenceMapper: (p0) => p0 .map((e) => (e.readTable(table), BaseReferences(db, table, e))) .toList(), prefetchHooksCallback: null, )); } typedef $TextEntriesProcessedTableManager = ProcessedTableManager< _$AppDatabase, TextEntries, TextEntry, $TextEntriesFilterComposer, $TextEntriesOrderingComposer, $TextEntriesAnnotationComposer, $TextEntriesCreateCompanionBuilder, $TextEntriesUpdateCompanionBuilder, (TextEntry, BaseReferences<_$AppDatabase, TextEntries, TextEntry>), TextEntry, PrefetchHooks Function()>; class $AppDatabaseManager { final _$AppDatabase _db; $AppDatabaseManager(this._db); $$CategoriesTableTableManager get categories => $$CategoriesTableTableManager(_db, _db.categories); $$TodoEntriesTableTableManager get todoEntries => $$TodoEntriesTableTableManager(_db, _db.todoEntries); $TextEntriesTableManager get textEntries => $TextEntriesTableManager(_db, _db.textEntries); } class CategoriesWithCountResult { final int? id; final String? name; final Color? color; final int amount; CategoriesWithCountResult({ this.id, this.name, this.color, required this.amount, }); } class SearchResult { final TodoEntry todos; final Category? cat; SearchResult({ required this.todos, this.cat, }); }