diff --git a/analysis_options.yaml b/analysis_options.yaml index 0d29021..6c2ffb4 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -26,3 +26,8 @@ linter: # Additional information about this file can be found at # https://dart.dev/guides/language/analysis-options +analyzer: + exclude: + - "**/*.g.dart" + - build/** + - .dart_tool/** \ No newline at end of file diff --git a/lib/database/sqlite.dart b/lib/database/sqlite.dart index bab0760..bf83c51 100644 --- a/lib/database/sqlite.dart +++ b/lib/database/sqlite.dart @@ -56,9 +56,8 @@ class Budgets extends Table { class BudgetsDto { final Budget budget; - final List budgetItems; - BudgetsDto({required this.budget, required this.budgetItems}); + BudgetsDto({required this.budget}); } class Loans extends Table { @@ -373,6 +372,12 @@ class ExpenseCategoriesDao extends DatabaseAccessor return select(expenseCategories).get(); } + + Future upsertCategory(ExpenseCategoriesCompanion category) { + return into( + expenseCategories, + ).insertReturning(category, mode: InsertMode.insertOrReplace); + } } @DriftAccessor(tables: [Budgets, BudgetItems]) @@ -391,11 +396,7 @@ class BudgetsDao extends DatabaseAccessor .watch() .map((rows) { return rows.map((row) { - return BudgetsDto( - budget: row.readTable(budgets), - // TODO - budgetItems: List.empty(), - ); + return BudgetsDto(budget: row.readTable(budgets)); }).toList(); }); } @@ -405,20 +406,28 @@ class BudgetsDao extends DatabaseAccessor return Future.value(List.empty()); } - return (select(budgets)..where((b) => b.accountId.equals(account.id))) + return (select(budgets) + ..where((b) => b.accountId.equals(account.id))).get().then((rows) { + return rows.map((row) { + return BudgetsDto(budget: row); + }).toList(); + }); + } + + Stream> watchBudgetItems(Budget budget) { + return (select(budgetItems)..where((b) => b.budgetId.equals(budget.id))) .join([ leftOuterJoin( - budgetItems, - budgetItems.budgetId.equalsExp(budgets.id), + expenseCategories, + expenseCategories.id.equalsExp(budgetItems.expenseCategoryId), ), ]) - .get() - .then((rows) { + .watch() + .map((rows) { return rows.map((row) { - return BudgetsDto( - budget: row.readTable(budgets), - // TODO - budgetItems: List.empty(), + return BudgetItemDto( + expenseCategory: row.readTable(expenseCategories), + item: row.readTable(budgetItems), ); }).toList(); }); diff --git a/lib/database/sqlite.g.dart b/lib/database/sqlite.g.dart index db8ec36..2bb367c 100644 --- a/lib/database/sqlite.g.dart +++ b/lib/database/sqlite.g.dart @@ -11,25 +11,17 @@ class $AccountsTable extends Accounts with TableInfo<$AccountsTable, Account> { 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', - ), - ); + '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, - ); + 'name', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); @override List get $columns => [id, name]; @override @@ -38,10 +30,8 @@ class $AccountsTable extends Accounts with TableInfo<$AccountsTable, Account> { String get actualTableName => $name; static const String $name = 'accounts'; @override - VerificationContext validateIntegrity( - Insertable instance, { - bool isInserting = false, - }) { + VerificationContext validateIntegrity(Insertable instance, + {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { @@ -49,9 +39,7 @@ class $AccountsTable extends Accounts with TableInfo<$AccountsTable, Account> { } if (data.containsKey('name')) { context.handle( - _nameMeta, - name.isAcceptableOrUnknown(data['name']!, _nameMeta), - ); + _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); } else if (isInserting) { context.missing(_nameMeta); } @@ -64,16 +52,10 @@ class $AccountsTable extends Accounts with TableInfo<$AccountsTable, Account> { Account map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Account( - id: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}id'], - )!, - name: - attachedDatabase.typeMapping.read( - DriftSqlType.string, - data['${effectivePrefix}name'], - )!, + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + name: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}name'])!, ); } @@ -96,13 +78,14 @@ class Account extends DataClass implements Insertable { } AccountsCompanion toCompanion(bool nullToAbsent) { - return AccountsCompanion(id: Value(id), name: Value(name)); + return AccountsCompanion( + id: Value(id), + name: Value(name), + ); } - factory Account.fromJson( - Map json, { - ValueSerializer? serializer, - }) { + factory Account.fromJson(Map json, + {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Account( id: serializer.fromJson(json['id']), @@ -118,8 +101,10 @@ class Account extends DataClass implements Insertable { }; } - Account copyWith({int? id, String? name}) => - Account(id: id ?? this.id, name: name ?? this.name); + Account copyWith({int? id, String? name}) => Account( + id: id ?? this.id, + name: name ?? this.name, + ); Account copyWithCompanion(AccountsCompanion data) { return Account( id: data.id.present ? data.id.value : this.id, @@ -166,7 +151,10 @@ class AccountsCompanion extends UpdateCompanion { } AccountsCompanion copyWith({Value? id, Value? name}) { - return AccountsCompanion(id: id ?? this.id, name: name ?? this.name); + return AccountsCompanion( + id: id ?? this.id, + name: name ?? this.name, + ); } @override @@ -200,60 +188,39 @@ class $BeneficiariesTable extends Beneficiaries 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', - ), - ); + '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, - defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'), - ); + 'name', aliasedName, false, + type: DriftSqlType.string, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE')); @override late final GeneratedColumnWithTypeConverter type = - GeneratedColumn( - 'type', - aliasedName, - false, - type: DriftSqlType.string, - requiredDuringInsert: true, - ).withConverter($BeneficiariesTable.$convertertype); - static const VerificationMeta _accountIdMeta = const VerificationMeta( - 'accountId', - ); + GeneratedColumn('type', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true) + .withConverter($BeneficiariesTable.$convertertype); + static const VerificationMeta _accountIdMeta = + const VerificationMeta('accountId'); @override late final GeneratedColumn accountId = GeneratedColumn( - 'account_id', - aliasedName, - true, - type: DriftSqlType.int, - requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES accounts (id)', - ), - ); - static const VerificationMeta _imagePathMeta = const VerificationMeta( - 'imagePath', - ); + 'account_id', aliasedName, true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('REFERENCES accounts (id)')); + static const VerificationMeta _imagePathMeta = + const VerificationMeta('imagePath'); @override late final GeneratedColumn imagePath = GeneratedColumn( - 'image_path', - aliasedName, - true, - type: DriftSqlType.string, - requiredDuringInsert: false, - ); + 'image_path', aliasedName, true, + type: DriftSqlType.string, requiredDuringInsert: false); @override List get $columns => [id, name, type, accountId, imagePath]; @override @@ -262,10 +229,8 @@ class $BeneficiariesTable extends Beneficiaries String get actualTableName => $name; static const String $name = 'beneficiaries'; @override - VerificationContext validateIntegrity( - Insertable instance, { - bool isInserting = false, - }) { + VerificationContext validateIntegrity(Insertable instance, + {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { @@ -273,23 +238,17 @@ class $BeneficiariesTable extends Beneficiaries } if (data.containsKey('name')) { context.handle( - _nameMeta, - name.isAcceptableOrUnknown(data['name']!, _nameMeta), - ); + _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); } else if (isInserting) { context.missing(_nameMeta); } if (data.containsKey('account_id')) { - context.handle( - _accountIdMeta, - accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta), - ); + context.handle(_accountIdMeta, + accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta)); } if (data.containsKey('image_path')) { - context.handle( - _imagePathMeta, - imagePath.isAcceptableOrUnknown(data['image_path']!, _imagePathMeta), - ); + context.handle(_imagePathMeta, + imagePath.isAcceptableOrUnknown(data['image_path']!, _imagePathMeta)); } return context; } @@ -300,30 +259,17 @@ class $BeneficiariesTable extends Beneficiaries Beneficiary map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Beneficiary( - id: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}id'], - )!, - name: - attachedDatabase.typeMapping.read( - DriftSqlType.string, - data['${effectivePrefix}name'], - )!, - type: $BeneficiariesTable.$convertertype.fromSql( - attachedDatabase.typeMapping.read( - DriftSqlType.string, - data['${effectivePrefix}type'], - )!, - ), - accountId: attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}account_id'], - ), - imagePath: attachedDatabase.typeMapping.read( - DriftSqlType.string, - data['${effectivePrefix}image_path'], - ), + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + name: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}name'])!, + type: $BeneficiariesTable.$convertertype.fromSql(attachedDatabase + .typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}type'])!), + accountId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}account_id']), + imagePath: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}image_path']), ); } @@ -342,22 +288,20 @@ class Beneficiary extends DataClass implements Insertable { final BeneficiaryType type; final int? accountId; final String? imagePath; - const Beneficiary({ - required this.id, - required this.name, - required this.type, - this.accountId, - this.imagePath, - }); + const Beneficiary( + {required this.id, + required this.name, + required this.type, + this.accountId, + this.imagePath}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); { - map['type'] = Variable( - $BeneficiariesTable.$convertertype.toSql(type), - ); + map['type'] = + Variable($BeneficiariesTable.$convertertype.toSql(type)); } if (!nullToAbsent || accountId != null) { map['account_id'] = Variable(accountId); @@ -373,28 +317,23 @@ class Beneficiary extends DataClass implements Insertable { id: Value(id), name: Value(name), type: Value(type), - accountId: - accountId == null && nullToAbsent - ? const Value.absent() - : Value(accountId), - imagePath: - imagePath == null && nullToAbsent - ? const Value.absent() - : Value(imagePath), + accountId: accountId == null && nullToAbsent + ? const Value.absent() + : Value(accountId), + imagePath: imagePath == null && nullToAbsent + ? const Value.absent() + : Value(imagePath), ); } - factory Beneficiary.fromJson( - Map json, { - ValueSerializer? serializer, - }) { + factory Beneficiary.fromJson(Map json, + {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Beneficiary( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), - type: $BeneficiariesTable.$convertertype.fromJson( - serializer.fromJson(json['type']), - ), + type: $BeneficiariesTable.$convertertype + .fromJson(serializer.fromJson(json['type'])), accountId: serializer.fromJson(json['accountId']), imagePath: serializer.fromJson(json['imagePath']), ); @@ -405,27 +344,26 @@ class Beneficiary extends DataClass implements Insertable { return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), - 'type': serializer.toJson( - $BeneficiariesTable.$convertertype.toJson(type), - ), + 'type': serializer + .toJson($BeneficiariesTable.$convertertype.toJson(type)), 'accountId': serializer.toJson(accountId), 'imagePath': serializer.toJson(imagePath), }; } - Beneficiary copyWith({ - int? id, - String? name, - BeneficiaryType? type, - Value accountId = const Value.absent(), - Value imagePath = const Value.absent(), - }) => Beneficiary( - id: id ?? this.id, - name: name ?? this.name, - type: type ?? this.type, - accountId: accountId.present ? accountId.value : this.accountId, - imagePath: imagePath.present ? imagePath.value : this.imagePath, - ); + Beneficiary copyWith( + {int? id, + String? name, + BeneficiaryType? type, + Value accountId = const Value.absent(), + Value imagePath = const Value.absent()}) => + Beneficiary( + id: id ?? this.id, + name: name ?? this.name, + type: type ?? this.type, + accountId: accountId.present ? accountId.value : this.accountId, + imagePath: imagePath.present ? imagePath.value : this.imagePath, + ); Beneficiary copyWithCompanion(BeneficiariesCompanion data) { return Beneficiary( id: data.id.present ? data.id.value : this.id, @@ -480,8 +418,8 @@ class BeneficiariesCompanion extends UpdateCompanion { required BeneficiaryType type, this.accountId = const Value.absent(), this.imagePath = const Value.absent(), - }) : name = Value(name), - type = Value(type); + }) : name = Value(name), + type = Value(type); static Insertable custom({ Expression? id, Expression? name, @@ -498,13 +436,12 @@ class BeneficiariesCompanion extends UpdateCompanion { }); } - BeneficiariesCompanion copyWith({ - Value? id, - Value? name, - Value? type, - Value? accountId, - Value? imagePath, - }) { + BeneficiariesCompanion copyWith( + {Value? id, + Value? name, + Value? type, + Value? accountId, + Value? imagePath}) { return BeneficiariesCompanion( id: id ?? this.id, name: name ?? this.name, @@ -525,8 +462,7 @@ class BeneficiariesCompanion extends UpdateCompanion { } if (type.present) { map['type'] = Variable( - $BeneficiariesTable.$convertertype.toSql(type.value), - ); + $BeneficiariesTable.$convertertype.toSql(type.value)); } if (accountId.present) { map['account_id'] = Variable(accountId.value); @@ -558,90 +494,56 @@ class $BudgetsTable extends Budgets with TableInfo<$BudgetsTable, Budget> { 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', - ), - ); + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); @override late final GeneratedColumnWithTypeConverter period = - GeneratedColumn( - 'period', - aliasedName, - false, - type: DriftSqlType.string, - requiredDuringInsert: true, - ).withConverter($BudgetsTable.$converterperiod); + GeneratedColumn('period', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true) + .withConverter($BudgetsTable.$converterperiod); static const VerificationMeta _nameMeta = const VerificationMeta('name'); @override late final GeneratedColumn name = GeneratedColumn( - 'name', - aliasedName, - false, - type: DriftSqlType.string, - requiredDuringInsert: true, - ); + 'name', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _incomeMeta = const VerificationMeta('income'); @override late final GeneratedColumn income = GeneratedColumn( - 'income', - aliasedName, - false, - type: DriftSqlType.double, - requiredDuringInsert: true, - ); + 'income', aliasedName, false, + type: DriftSqlType.double, requiredDuringInsert: true); static const VerificationMeta _includeOtherSpendingsMeta = const VerificationMeta('includeOtherSpendings'); @override late final GeneratedColumn includeOtherSpendings = - GeneratedColumn( - 'include_other_spendings', - aliasedName, - false, - type: DriftSqlType.bool, - requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'CHECK ("include_other_spendings" IN (0, 1))', - ), - ); - static const VerificationMeta _accountIdMeta = const VerificationMeta( - 'accountId', - ); + GeneratedColumn('include_other_spendings', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'CHECK ("include_other_spendings" IN (0, 1))')); + static const VerificationMeta _accountIdMeta = + const VerificationMeta('accountId'); @override late final GeneratedColumn accountId = GeneratedColumn( - 'account_id', - aliasedName, - false, - type: DriftSqlType.int, - requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES accounts (id)', - ), - ); + 'account_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('REFERENCES accounts (id)')); @override - List get $columns => [ - id, - period, - name, - income, - includeOtherSpendings, - accountId, - ]; + List get $columns => + [id, period, name, income, includeOtherSpendings, accountId]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'budgets'; @override - VerificationContext validateIntegrity( - Insertable instance, { - bool isInserting = false, - }) { + VerificationContext validateIntegrity(Insertable instance, + {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { @@ -649,36 +551,27 @@ class $BudgetsTable extends Budgets with TableInfo<$BudgetsTable, Budget> { } if (data.containsKey('name')) { context.handle( - _nameMeta, - name.isAcceptableOrUnknown(data['name']!, _nameMeta), - ); + _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); } else if (isInserting) { context.missing(_nameMeta); } if (data.containsKey('income')) { - context.handle( - _incomeMeta, - income.isAcceptableOrUnknown(data['income']!, _incomeMeta), - ); + context.handle(_incomeMeta, + income.isAcceptableOrUnknown(data['income']!, _incomeMeta)); } else if (isInserting) { context.missing(_incomeMeta); } if (data.containsKey('include_other_spendings')) { context.handle( - _includeOtherSpendingsMeta, - includeOtherSpendings.isAcceptableOrUnknown( - data['include_other_spendings']!, _includeOtherSpendingsMeta, - ), - ); + includeOtherSpendings.isAcceptableOrUnknown( + data['include_other_spendings']!, _includeOtherSpendingsMeta)); } else if (isInserting) { context.missing(_includeOtherSpendingsMeta); } if (data.containsKey('account_id')) { - context.handle( - _accountIdMeta, - accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta), - ); + context.handle(_accountIdMeta, + accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta)); } else if (isInserting) { context.missing(_accountIdMeta); } @@ -691,37 +584,20 @@ class $BudgetsTable extends Budgets with TableInfo<$BudgetsTable, Budget> { Budget map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Budget( - id: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}id'], - )!, - period: $BudgetsTable.$converterperiod.fromSql( - attachedDatabase.typeMapping.read( - DriftSqlType.string, - data['${effectivePrefix}period'], - )!, - ), - name: - attachedDatabase.typeMapping.read( - DriftSqlType.string, - data['${effectivePrefix}name'], - )!, - income: - attachedDatabase.typeMapping.read( - DriftSqlType.double, - data['${effectivePrefix}income'], - )!, - includeOtherSpendings: - attachedDatabase.typeMapping.read( - DriftSqlType.bool, - data['${effectivePrefix}include_other_spendings'], - )!, - accountId: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}account_id'], - )!, + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + period: $BudgetsTable.$converterperiod.fromSql(attachedDatabase + .typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}period'])!), + name: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}name'])!, + income: attachedDatabase.typeMapping + .read(DriftSqlType.double, data['${effectivePrefix}income'])!, + includeOtherSpendings: attachedDatabase.typeMapping.read( + DriftSqlType.bool, + data['${effectivePrefix}include_other_spendings'])!, + accountId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}account_id'])!, ); } @@ -741,22 +617,20 @@ class Budget extends DataClass implements Insertable { final double income; final bool includeOtherSpendings; final int accountId; - const Budget({ - required this.id, - required this.period, - required this.name, - required this.income, - required this.includeOtherSpendings, - required this.accountId, - }); + const Budget( + {required this.id, + required this.period, + required this.name, + required this.income, + required this.includeOtherSpendings, + required this.accountId}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); { - map['period'] = Variable( - $BudgetsTable.$converterperiod.toSql(period), - ); + map['period'] = + Variable($BudgetsTable.$converterperiod.toSql(period)); } map['name'] = Variable(name); map['income'] = Variable(income); @@ -776,21 +650,17 @@ class Budget extends DataClass implements Insertable { ); } - factory Budget.fromJson( - Map json, { - ValueSerializer? serializer, - }) { + factory Budget.fromJson(Map json, + {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Budget( id: serializer.fromJson(json['id']), - period: $BudgetsTable.$converterperiod.fromJson( - serializer.fromJson(json['period']), - ), + period: $BudgetsTable.$converterperiod + .fromJson(serializer.fromJson(json['period'])), name: serializer.fromJson(json['name']), income: serializer.fromJson(json['income']), - includeOtherSpendings: serializer.fromJson( - json['includeOtherSpendings'], - ), + includeOtherSpendings: + serializer.fromJson(json['includeOtherSpendings']), accountId: serializer.fromJson(json['accountId']), ); } @@ -799,9 +669,8 @@ class Budget extends DataClass implements Insertable { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), - 'period': serializer.toJson( - $BudgetsTable.$converterperiod.toJson(period), - ), + 'period': serializer + .toJson($BudgetsTable.$converterperiod.toJson(period)), 'name': serializer.toJson(name), 'income': serializer.toJson(income), 'includeOtherSpendings': serializer.toJson(includeOtherSpendings), @@ -809,31 +678,31 @@ class Budget extends DataClass implements Insertable { }; } - Budget copyWith({ - int? id, - BudgetPeriod? period, - String? name, - double? income, - bool? includeOtherSpendings, - int? accountId, - }) => Budget( - id: id ?? this.id, - period: period ?? this.period, - name: name ?? this.name, - income: income ?? this.income, - includeOtherSpendings: includeOtherSpendings ?? this.includeOtherSpendings, - accountId: accountId ?? this.accountId, - ); + Budget copyWith( + {int? id, + BudgetPeriod? period, + String? name, + double? income, + bool? includeOtherSpendings, + int? accountId}) => + Budget( + id: id ?? this.id, + period: period ?? this.period, + name: name ?? this.name, + income: income ?? this.income, + includeOtherSpendings: + includeOtherSpendings ?? this.includeOtherSpendings, + accountId: accountId ?? this.accountId, + ); Budget copyWithCompanion(BudgetsCompanion data) { return Budget( id: data.id.present ? data.id.value : this.id, period: data.period.present ? data.period.value : this.period, name: data.name.present ? data.name.value : this.name, income: data.income.present ? data.income.value : this.income, - includeOtherSpendings: - data.includeOtherSpendings.present - ? data.includeOtherSpendings.value - : this.includeOtherSpendings, + includeOtherSpendings: data.includeOtherSpendings.present + ? data.includeOtherSpendings.value + : this.includeOtherSpendings, accountId: data.accountId.present ? data.accountId.value : this.accountId, ); } @@ -888,11 +757,11 @@ class BudgetsCompanion extends UpdateCompanion { required double income, required bool includeOtherSpendings, required int accountId, - }) : period = Value(period), - name = Value(name), - income = Value(income), - includeOtherSpendings = Value(includeOtherSpendings), - accountId = Value(accountId); + }) : period = Value(period), + name = Value(name), + income = Value(income), + includeOtherSpendings = Value(includeOtherSpendings), + accountId = Value(accountId); static Insertable custom({ Expression? id, Expression? period, @@ -912,14 +781,13 @@ class BudgetsCompanion extends UpdateCompanion { }); } - BudgetsCompanion copyWith({ - Value? id, - Value? period, - Value? name, - Value? income, - Value? includeOtherSpendings, - Value? accountId, - }) { + BudgetsCompanion copyWith( + {Value? id, + Value? period, + Value? name, + Value? income, + Value? includeOtherSpendings, + Value? accountId}) { return BudgetsCompanion( id: id ?? this.id, period: period ?? this.period, @@ -938,9 +806,8 @@ class BudgetsCompanion extends UpdateCompanion { map['id'] = Variable(id.value); } if (period.present) { - map['period'] = Variable( - $BudgetsTable.$converterperiod.toSql(period.value), - ); + map['period'] = + Variable($BudgetsTable.$converterperiod.toSql(period.value)); } if (name.present) { map['name'] = Variable(name.value); @@ -949,9 +816,8 @@ class BudgetsCompanion extends UpdateCompanion { map['income'] = Variable(income.value); } if (includeOtherSpendings.present) { - map['include_other_spendings'] = Variable( - includeOtherSpendings.value, - ); + map['include_other_spendings'] = + Variable(includeOtherSpendings.value); } if (accountId.present) { map['account_id'] = Variable(accountId.value); @@ -982,25 +848,17 @@ class $ExpenseCategoriesTable extends ExpenseCategories 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', - ), - ); + '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, - ); + 'name', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); @override List get $columns => [id, name]; @override @@ -1009,10 +867,8 @@ class $ExpenseCategoriesTable extends ExpenseCategories String get actualTableName => $name; static const String $name = 'expense_categories'; @override - VerificationContext validateIntegrity( - Insertable instance, { - bool isInserting = false, - }) { + VerificationContext validateIntegrity(Insertable instance, + {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { @@ -1020,9 +876,7 @@ class $ExpenseCategoriesTable extends ExpenseCategories } if (data.containsKey('name')) { context.handle( - _nameMeta, - name.isAcceptableOrUnknown(data['name']!, _nameMeta), - ); + _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); } else if (isInserting) { context.missing(_nameMeta); } @@ -1035,16 +889,10 @@ class $ExpenseCategoriesTable extends ExpenseCategories ExpenseCategory map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return ExpenseCategory( - id: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}id'], - )!, - name: - attachedDatabase.typeMapping.read( - DriftSqlType.string, - data['${effectivePrefix}name'], - )!, + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + name: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}name'])!, ); } @@ -1067,13 +915,14 @@ class ExpenseCategory extends DataClass implements Insertable { } ExpenseCategoriesCompanion toCompanion(bool nullToAbsent) { - return ExpenseCategoriesCompanion(id: Value(id), name: Value(name)); + return ExpenseCategoriesCompanion( + id: Value(id), + name: Value(name), + ); } - factory ExpenseCategory.fromJson( - Map json, { - ValueSerializer? serializer, - }) { + factory ExpenseCategory.fromJson(Map json, + {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return ExpenseCategory( id: serializer.fromJson(json['id']), @@ -1089,8 +938,10 @@ class ExpenseCategory extends DataClass implements Insertable { }; } - ExpenseCategory copyWith({int? id, String? name}) => - ExpenseCategory(id: id ?? this.id, name: name ?? this.name); + ExpenseCategory copyWith({int? id, String? name}) => ExpenseCategory( + id: id ?? this.id, + name: name ?? this.name, + ); ExpenseCategory copyWithCompanion(ExpenseCategoriesCompanion data) { return ExpenseCategory( id: data.id.present ? data.id.value : this.id, @@ -1176,99 +1027,68 @@ class $BudgetItemsTable extends BudgetItems 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', - ), - ); + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _amountMeta = const VerificationMeta('amount'); @override late final GeneratedColumn amount = GeneratedColumn( - 'amount', - aliasedName, - false, - type: DriftSqlType.double, - requiredDuringInsert: true, - ); - static const VerificationMeta _expenseCategoryIdMeta = const VerificationMeta( - 'expenseCategoryId', - ); + 'amount', aliasedName, false, + type: DriftSqlType.double, requiredDuringInsert: true); + static const VerificationMeta _expenseCategoryIdMeta = + const VerificationMeta('expenseCategoryId'); @override late final GeneratedColumn expenseCategoryId = GeneratedColumn( - 'expense_category_id', - aliasedName, - false, - type: DriftSqlType.int, - requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES expense_categories (id)', - ), - ); - static const VerificationMeta _budgetIdMeta = const VerificationMeta( - 'budgetId', - ); + 'expense_category_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES expense_categories (id)')); + static const VerificationMeta _budgetIdMeta = + const VerificationMeta('budgetId'); @override late final GeneratedColumn budgetId = GeneratedColumn( - 'budget_id', - aliasedName, - false, - type: DriftSqlType.int, - requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES budgets (id)', - ), - ); + 'budget_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('REFERENCES budgets (id)')); @override - List get $columns => [ - id, - amount, - expenseCategoryId, - budgetId, - ]; + List get $columns => + [id, amount, expenseCategoryId, budgetId]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'budget_items'; @override - VerificationContext validateIntegrity( - Insertable instance, { - bool isInserting = false, - }) { + 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('amount')) { - context.handle( - _amountMeta, - amount.isAcceptableOrUnknown(data['amount']!, _amountMeta), - ); + context.handle(_amountMeta, + amount.isAcceptableOrUnknown(data['amount']!, _amountMeta)); } else if (isInserting) { context.missing(_amountMeta); } if (data.containsKey('expense_category_id')) { context.handle( - _expenseCategoryIdMeta, - expenseCategoryId.isAcceptableOrUnknown( - data['expense_category_id']!, _expenseCategoryIdMeta, - ), - ); + expenseCategoryId.isAcceptableOrUnknown( + data['expense_category_id']!, _expenseCategoryIdMeta)); } else if (isInserting) { context.missing(_expenseCategoryIdMeta); } if (data.containsKey('budget_id')) { - context.handle( - _budgetIdMeta, - budgetId.isAcceptableOrUnknown(data['budget_id']!, _budgetIdMeta), - ); + context.handle(_budgetIdMeta, + budgetId.isAcceptableOrUnknown(data['budget_id']!, _budgetIdMeta)); } else if (isInserting) { context.missing(_budgetIdMeta); } @@ -1281,26 +1101,14 @@ class $BudgetItemsTable extends BudgetItems BudgetItem map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return BudgetItem( - id: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}id'], - )!, - amount: - attachedDatabase.typeMapping.read( - DriftSqlType.double, - data['${effectivePrefix}amount'], - )!, - expenseCategoryId: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}expense_category_id'], - )!, - budgetId: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}budget_id'], - )!, + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + amount: attachedDatabase.typeMapping + .read(DriftSqlType.double, data['${effectivePrefix}amount'])!, + expenseCategoryId: attachedDatabase.typeMapping.read( + DriftSqlType.int, data['${effectivePrefix}expense_category_id'])!, + budgetId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}budget_id'])!, ); } @@ -1315,12 +1123,11 @@ class BudgetItem extends DataClass implements Insertable { final double amount; final int expenseCategoryId; final int budgetId; - const BudgetItem({ - required this.id, - required this.amount, - required this.expenseCategoryId, - required this.budgetId, - }); + const BudgetItem( + {required this.id, + required this.amount, + required this.expenseCategoryId, + required this.budgetId}); @override Map toColumns(bool nullToAbsent) { final map = {}; @@ -1340,10 +1147,8 @@ class BudgetItem extends DataClass implements Insertable { ); } - factory BudgetItem.fromJson( - Map json, { - ValueSerializer? serializer, - }) { + factory BudgetItem.fromJson(Map json, + {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return BudgetItem( id: serializer.fromJson(json['id']), @@ -1363,25 +1168,21 @@ class BudgetItem extends DataClass implements Insertable { }; } - BudgetItem copyWith({ - int? id, - double? amount, - int? expenseCategoryId, - int? budgetId, - }) => BudgetItem( - id: id ?? this.id, - amount: amount ?? this.amount, - expenseCategoryId: expenseCategoryId ?? this.expenseCategoryId, - budgetId: budgetId ?? this.budgetId, - ); + BudgetItem copyWith( + {int? id, double? amount, int? expenseCategoryId, int? budgetId}) => + BudgetItem( + id: id ?? this.id, + amount: amount ?? this.amount, + expenseCategoryId: expenseCategoryId ?? this.expenseCategoryId, + budgetId: budgetId ?? this.budgetId, + ); BudgetItem copyWithCompanion(BudgetItemsCompanion data) { return BudgetItem( id: data.id.present ? data.id.value : this.id, amount: data.amount.present ? data.amount.value : this.amount, - expenseCategoryId: - data.expenseCategoryId.present - ? data.expenseCategoryId.value - : this.expenseCategoryId, + expenseCategoryId: data.expenseCategoryId.present + ? data.expenseCategoryId.value + : this.expenseCategoryId, budgetId: data.budgetId.present ? data.budgetId.value : this.budgetId, ); } @@ -1425,9 +1226,9 @@ class BudgetItemsCompanion extends UpdateCompanion { required double amount, required int expenseCategoryId, required int budgetId, - }) : amount = Value(amount), - expenseCategoryId = Value(expenseCategoryId), - budgetId = Value(budgetId); + }) : amount = Value(amount), + expenseCategoryId = Value(expenseCategoryId), + budgetId = Value(budgetId); static Insertable custom({ Expression? id, Expression? amount, @@ -1442,12 +1243,11 @@ class BudgetItemsCompanion extends UpdateCompanion { }); } - BudgetItemsCompanion copyWith({ - Value? id, - Value? amount, - Value? expenseCategoryId, - Value? budgetId, - }) { + BudgetItemsCompanion copyWith( + {Value? id, + Value? amount, + Value? expenseCategoryId, + Value? budgetId}) { return BudgetItemsCompanion( id: id ?? this.id, amount: amount ?? this.amount, @@ -1494,30 +1294,21 @@ class $LoansTable extends Loans with TableInfo<$LoansTable, Loan> { 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 _beneficiaryIdMeta = const VerificationMeta( - 'beneficiaryId', - ); + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); + static const VerificationMeta _beneficiaryIdMeta = + const VerificationMeta('beneficiaryId'); @override late final GeneratedColumn beneficiaryId = GeneratedColumn( - 'beneficiary_id', - aliasedName, - false, - type: DriftSqlType.int, - requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES beneficiaries (id)', - ), - ); + 'beneficiary_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('REFERENCES beneficiaries (id)')); @override List get $columns => [id, beneficiaryId]; @override @@ -1526,10 +1317,8 @@ class $LoansTable extends Loans with TableInfo<$LoansTable, Loan> { String get actualTableName => $name; static const String $name = 'loans'; @override - VerificationContext validateIntegrity( - Insertable instance, { - bool isInserting = false, - }) { + VerificationContext validateIntegrity(Insertable instance, + {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { @@ -1537,12 +1326,9 @@ class $LoansTable extends Loans with TableInfo<$LoansTable, Loan> { } if (data.containsKey('beneficiary_id')) { context.handle( - _beneficiaryIdMeta, - beneficiaryId.isAcceptableOrUnknown( - data['beneficiary_id']!, _beneficiaryIdMeta, - ), - ); + beneficiaryId.isAcceptableOrUnknown( + data['beneficiary_id']!, _beneficiaryIdMeta)); } else if (isInserting) { context.missing(_beneficiaryIdMeta); } @@ -1555,16 +1341,10 @@ class $LoansTable extends Loans with TableInfo<$LoansTable, Loan> { Loan map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Loan( - id: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}id'], - )!, - beneficiaryId: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}beneficiary_id'], - )!, + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + beneficiaryId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}beneficiary_id'])!, ); } @@ -1587,13 +1367,14 @@ class Loan extends DataClass implements Insertable { } LoansCompanion toCompanion(bool nullToAbsent) { - return LoansCompanion(id: Value(id), beneficiaryId: Value(beneficiaryId)); + return LoansCompanion( + id: Value(id), + beneficiaryId: Value(beneficiaryId), + ); } - factory Loan.fromJson( - Map json, { - ValueSerializer? serializer, - }) { + factory Loan.fromJson(Map json, + {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Loan( id: serializer.fromJson(json['id']), @@ -1610,16 +1391,15 @@ class Loan extends DataClass implements Insertable { } Loan copyWith({int? id, int? beneficiaryId}) => Loan( - id: id ?? this.id, - beneficiaryId: beneficiaryId ?? this.beneficiaryId, - ); + id: id ?? this.id, + beneficiaryId: beneficiaryId ?? this.beneficiaryId, + ); Loan copyWithCompanion(LoansCompanion data) { return Loan( id: data.id.present ? data.id.value : this.id, - beneficiaryId: - data.beneficiaryId.present - ? data.beneficiaryId.value - : this.beneficiaryId, + beneficiaryId: data.beneficiaryId.present + ? data.beneficiaryId.value + : this.beneficiaryId, ); } @@ -1701,46 +1481,30 @@ class $LoanChangesTable extends LoanChanges 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', - ), - ); + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _loanIdMeta = const VerificationMeta('loanId'); @override late final GeneratedColumn loanId = GeneratedColumn( - 'loan_id', - aliasedName, - false, - type: DriftSqlType.int, - requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES loans (id)', - ), - ); + 'loan_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('REFERENCES loans (id)')); static const VerificationMeta _amountMeta = const VerificationMeta('amount'); @override late final GeneratedColumn amount = GeneratedColumn( - 'amount', - aliasedName, - false, - type: DriftSqlType.double, - requiredDuringInsert: true, - ); + 'amount', aliasedName, false, + type: DriftSqlType.double, requiredDuringInsert: true); static const VerificationMeta _dateMeta = const VerificationMeta('date'); @override late final GeneratedColumn date = GeneratedColumn( - 'date', - aliasedName, - false, - type: DriftSqlType.dateTime, - requiredDuringInsert: true, - ); + 'date', aliasedName, false, + type: DriftSqlType.dateTime, requiredDuringInsert: true); @override List get $columns => [id, loanId, amount, date]; @override @@ -1749,36 +1513,28 @@ class $LoanChangesTable extends LoanChanges String get actualTableName => $name; static const String $name = 'loan_changes'; @override - VerificationContext validateIntegrity( - Insertable instance, { - bool isInserting = false, - }) { + 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('loan_id')) { - context.handle( - _loanIdMeta, - loanId.isAcceptableOrUnknown(data['loan_id']!, _loanIdMeta), - ); + context.handle(_loanIdMeta, + loanId.isAcceptableOrUnknown(data['loan_id']!, _loanIdMeta)); } else if (isInserting) { context.missing(_loanIdMeta); } if (data.containsKey('amount')) { - context.handle( - _amountMeta, - amount.isAcceptableOrUnknown(data['amount']!, _amountMeta), - ); + context.handle(_amountMeta, + amount.isAcceptableOrUnknown(data['amount']!, _amountMeta)); } else if (isInserting) { context.missing(_amountMeta); } if (data.containsKey('date')) { context.handle( - _dateMeta, - date.isAcceptableOrUnknown(data['date']!, _dateMeta), - ); + _dateMeta, date.isAcceptableOrUnknown(data['date']!, _dateMeta)); } else if (isInserting) { context.missing(_dateMeta); } @@ -1791,26 +1547,14 @@ class $LoanChangesTable extends LoanChanges LoanChange map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return LoanChange( - id: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}id'], - )!, - loanId: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}loan_id'], - )!, - amount: - attachedDatabase.typeMapping.read( - DriftSqlType.double, - data['${effectivePrefix}amount'], - )!, - date: - attachedDatabase.typeMapping.read( - DriftSqlType.dateTime, - data['${effectivePrefix}date'], - )!, + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + loanId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}loan_id'])!, + amount: attachedDatabase.typeMapping + .read(DriftSqlType.double, data['${effectivePrefix}amount'])!, + date: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}date'])!, ); } @@ -1825,12 +1569,11 @@ class LoanChange extends DataClass implements Insertable { final int loanId; final double amount; final DateTime date; - const LoanChange({ - required this.id, - required this.loanId, - required this.amount, - required this.date, - }); + const LoanChange( + {required this.id, + required this.loanId, + required this.amount, + required this.date}); @override Map toColumns(bool nullToAbsent) { final map = {}; @@ -1850,10 +1593,8 @@ class LoanChange extends DataClass implements Insertable { ); } - factory LoanChange.fromJson( - Map json, { - ValueSerializer? serializer, - }) { + factory LoanChange.fromJson(Map json, + {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return LoanChange( id: serializer.fromJson(json['id']), @@ -1928,9 +1669,9 @@ class LoanChangesCompanion extends UpdateCompanion { required int loanId, required double amount, required DateTime date, - }) : loanId = Value(loanId), - amount = Value(amount), - date = Value(date); + }) : loanId = Value(loanId), + amount = Value(amount), + date = Value(date); static Insertable custom({ Expression? id, Expression? loanId, @@ -1945,12 +1686,11 @@ class LoanChangesCompanion extends UpdateCompanion { }); } - LoanChangesCompanion copyWith({ - Value? id, - Value? loanId, - Value? amount, - Value? date, - }) { + LoanChangesCompanion copyWith( + {Value? id, + Value? loanId, + Value? amount, + Value? date}) { return LoanChangesCompanion( id: id ?? this.id, loanId: loanId ?? this.loanId, @@ -1998,100 +1738,68 @@ class $TransactionTemplatesTable extends TransactionTemplates 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', - ), - ); + '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, - ); + 'name', aliasedName, false, + type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _amountMeta = const VerificationMeta('amount'); @override late final GeneratedColumn amount = GeneratedColumn( - 'amount', - aliasedName, - false, - type: DriftSqlType.double, - requiredDuringInsert: true, - ); - static const VerificationMeta _recurringMeta = const VerificationMeta( - 'recurring', - ); + 'amount', aliasedName, false, + type: DriftSqlType.double, requiredDuringInsert: true); + static const VerificationMeta _recurringMeta = + const VerificationMeta('recurring'); @override late final GeneratedColumn recurring = GeneratedColumn( - 'recurring', - aliasedName, - false, - type: DriftSqlType.bool, - requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'CHECK ("recurring" IN (0, 1))', - ), - ); - static const VerificationMeta _expenseCategoryIdMeta = const VerificationMeta( - 'expenseCategoryId', - ); + 'recurring', aliasedName, false, + type: DriftSqlType.bool, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('CHECK ("recurring" IN (0, 1))')); + static const VerificationMeta _expenseCategoryIdMeta = + const VerificationMeta('expenseCategoryId'); @override late final GeneratedColumn expenseCategoryId = GeneratedColumn( - 'expense_category_id', - aliasedName, - true, - type: DriftSqlType.int, - requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES expense_categories (id)', - ), - ); - static const VerificationMeta _beneficiaryIdMeta = const VerificationMeta( - 'beneficiaryId', - ); + 'expense_category_id', aliasedName, true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES expense_categories (id)')); + static const VerificationMeta _beneficiaryIdMeta = + const VerificationMeta('beneficiaryId'); @override late final GeneratedColumn beneficiaryId = GeneratedColumn( - 'beneficiary_id', - aliasedName, - false, - type: DriftSqlType.int, - requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES beneficiaries (id)', - ), - ); - static const VerificationMeta _accountIdMeta = const VerificationMeta( - 'accountId', - ); + 'beneficiary_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('REFERENCES beneficiaries (id)')); + static const VerificationMeta _accountIdMeta = + const VerificationMeta('accountId'); @override late final GeneratedColumn accountId = GeneratedColumn( - 'account_id', - aliasedName, - false, - type: DriftSqlType.int, - requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES accounts (id)', - ), - ); + 'account_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('REFERENCES accounts (id)')); @override List get $columns => [ - id, - name, - amount, - recurring, - expenseCategoryId, - beneficiaryId, - accountId, - ]; + id, + name, + amount, + recurring, + expenseCategoryId, + beneficiaryId, + accountId + ]; @override String get aliasedName => _alias ?? actualTableName; @override @@ -2099,9 +1807,8 @@ class $TransactionTemplatesTable extends TransactionTemplates static const String $name = 'transaction_templates'; @override VerificationContext validateIntegrity( - Insertable instance, { - bool isInserting = false, - }) { + Insertable instance, + {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { @@ -2109,53 +1816,39 @@ class $TransactionTemplatesTable extends TransactionTemplates } if (data.containsKey('name')) { context.handle( - _nameMeta, - name.isAcceptableOrUnknown(data['name']!, _nameMeta), - ); + _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); } else if (isInserting) { context.missing(_nameMeta); } if (data.containsKey('amount')) { - context.handle( - _amountMeta, - amount.isAcceptableOrUnknown(data['amount']!, _amountMeta), - ); + context.handle(_amountMeta, + amount.isAcceptableOrUnknown(data['amount']!, _amountMeta)); } else if (isInserting) { context.missing(_amountMeta); } if (data.containsKey('recurring')) { - context.handle( - _recurringMeta, - recurring.isAcceptableOrUnknown(data['recurring']!, _recurringMeta), - ); + context.handle(_recurringMeta, + recurring.isAcceptableOrUnknown(data['recurring']!, _recurringMeta)); } else if (isInserting) { context.missing(_recurringMeta); } if (data.containsKey('expense_category_id')) { context.handle( - _expenseCategoryIdMeta, - expenseCategoryId.isAcceptableOrUnknown( - data['expense_category_id']!, _expenseCategoryIdMeta, - ), - ); + expenseCategoryId.isAcceptableOrUnknown( + data['expense_category_id']!, _expenseCategoryIdMeta)); } if (data.containsKey('beneficiary_id')) { context.handle( - _beneficiaryIdMeta, - beneficiaryId.isAcceptableOrUnknown( - data['beneficiary_id']!, _beneficiaryIdMeta, - ), - ); + beneficiaryId.isAcceptableOrUnknown( + data['beneficiary_id']!, _beneficiaryIdMeta)); } else if (isInserting) { context.missing(_beneficiaryIdMeta); } if (data.containsKey('account_id')) { - context.handle( - _accountIdMeta, - accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta), - ); + context.handle(_accountIdMeta, + accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta)); } else if (isInserting) { context.missing(_accountIdMeta); } @@ -2168,40 +1861,20 @@ class $TransactionTemplatesTable extends TransactionTemplates TransactionTemplate map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return TransactionTemplate( - id: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}id'], - )!, - name: - attachedDatabase.typeMapping.read( - DriftSqlType.string, - data['${effectivePrefix}name'], - )!, - amount: - attachedDatabase.typeMapping.read( - DriftSqlType.double, - data['${effectivePrefix}amount'], - )!, - recurring: - attachedDatabase.typeMapping.read( - DriftSqlType.bool, - data['${effectivePrefix}recurring'], - )!, + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + name: attachedDatabase.typeMapping + .read(DriftSqlType.string, data['${effectivePrefix}name'])!, + amount: attachedDatabase.typeMapping + .read(DriftSqlType.double, data['${effectivePrefix}amount'])!, + recurring: attachedDatabase.typeMapping + .read(DriftSqlType.bool, data['${effectivePrefix}recurring'])!, expenseCategoryId: attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}expense_category_id'], - ), - beneficiaryId: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}beneficiary_id'], - )!, - accountId: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}account_id'], - )!, + DriftSqlType.int, data['${effectivePrefix}expense_category_id']), + beneficiaryId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}beneficiary_id'])!, + accountId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}account_id'])!, ); } @@ -2220,15 +1893,14 @@ class TransactionTemplate extends DataClass final int? expenseCategoryId; final int beneficiaryId; final int accountId; - const TransactionTemplate({ - required this.id, - required this.name, - required this.amount, - required this.recurring, - this.expenseCategoryId, - required this.beneficiaryId, - required this.accountId, - }); + const TransactionTemplate( + {required this.id, + required this.name, + required this.amount, + required this.recurring, + this.expenseCategoryId, + required this.beneficiaryId, + required this.accountId}); @override Map toColumns(bool nullToAbsent) { final map = {}; @@ -2250,19 +1922,16 @@ class TransactionTemplate extends DataClass name: Value(name), amount: Value(amount), recurring: Value(recurring), - expenseCategoryId: - expenseCategoryId == null && nullToAbsent - ? const Value.absent() - : Value(expenseCategoryId), + expenseCategoryId: expenseCategoryId == null && nullToAbsent + ? const Value.absent() + : Value(expenseCategoryId), beneficiaryId: Value(beneficiaryId), accountId: Value(accountId), ); } - factory TransactionTemplate.fromJson( - Map json, { - ValueSerializer? serializer, - }) { + factory TransactionTemplate.fromJson(Map json, + {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return TransactionTemplate( id: serializer.fromJson(json['id']), @@ -2288,40 +1957,37 @@ class TransactionTemplate extends DataClass }; } - TransactionTemplate copyWith({ - int? id, - String? name, - double? amount, - bool? recurring, - Value expenseCategoryId = const Value.absent(), - int? beneficiaryId, - int? accountId, - }) => TransactionTemplate( - id: id ?? this.id, - name: name ?? this.name, - amount: amount ?? this.amount, - recurring: recurring ?? this.recurring, - expenseCategoryId: - expenseCategoryId.present + TransactionTemplate copyWith( + {int? id, + String? name, + double? amount, + bool? recurring, + Value expenseCategoryId = const Value.absent(), + int? beneficiaryId, + int? accountId}) => + TransactionTemplate( + id: id ?? this.id, + name: name ?? this.name, + amount: amount ?? this.amount, + recurring: recurring ?? this.recurring, + expenseCategoryId: expenseCategoryId.present ? expenseCategoryId.value : this.expenseCategoryId, - beneficiaryId: beneficiaryId ?? this.beneficiaryId, - accountId: accountId ?? this.accountId, - ); + beneficiaryId: beneficiaryId ?? this.beneficiaryId, + accountId: accountId ?? this.accountId, + ); TransactionTemplate copyWithCompanion(TransactionTemplatesCompanion data) { return TransactionTemplate( id: data.id.present ? data.id.value : this.id, name: data.name.present ? data.name.value : this.name, amount: data.amount.present ? data.amount.value : this.amount, recurring: data.recurring.present ? data.recurring.value : this.recurring, - expenseCategoryId: - data.expenseCategoryId.present - ? data.expenseCategoryId.value - : this.expenseCategoryId, - beneficiaryId: - data.beneficiaryId.present - ? data.beneficiaryId.value - : this.beneficiaryId, + expenseCategoryId: data.expenseCategoryId.present + ? data.expenseCategoryId.value + : this.expenseCategoryId, + beneficiaryId: data.beneficiaryId.present + ? data.beneficiaryId.value + : this.beneficiaryId, accountId: data.accountId.present ? data.accountId.value : this.accountId, ); } @@ -2342,14 +2008,7 @@ class TransactionTemplate extends DataClass @override int get hashCode => Object.hash( - id, - name, - amount, - recurring, - expenseCategoryId, - beneficiaryId, - accountId, - ); + id, name, amount, recurring, expenseCategoryId, beneficiaryId, accountId); @override bool operator ==(Object other) => identical(this, other) || @@ -2389,11 +2048,11 @@ class TransactionTemplatesCompanion this.expenseCategoryId = const Value.absent(), required int beneficiaryId, required int accountId, - }) : name = Value(name), - amount = Value(amount), - recurring = Value(recurring), - beneficiaryId = Value(beneficiaryId), - accountId = Value(accountId); + }) : name = Value(name), + amount = Value(amount), + recurring = Value(recurring), + beneficiaryId = Value(beneficiaryId), + accountId = Value(accountId); static Insertable custom({ Expression? id, Expression? name, @@ -2414,15 +2073,14 @@ class TransactionTemplatesCompanion }); } - TransactionTemplatesCompanion copyWith({ - Value? id, - Value? name, - Value? amount, - Value? recurring, - Value? expenseCategoryId, - Value? beneficiaryId, - Value? accountId, - }) { + TransactionTemplatesCompanion copyWith( + {Value? id, + Value? name, + Value? amount, + Value? recurring, + Value? expenseCategoryId, + Value? beneficiaryId, + Value? accountId}) { return TransactionTemplatesCompanion( id: id ?? this.id, name: name ?? this.name, @@ -2485,73 +2143,44 @@ class $RecurringTransactionsTable extends RecurringTransactions 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', - ), - ); + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _daysMeta = const VerificationMeta('days'); @override late final GeneratedColumn days = GeneratedColumn( - 'days', - aliasedName, - false, - type: DriftSqlType.int, - requiredDuringInsert: true, - ); - static const VerificationMeta _lastExecutionMeta = const VerificationMeta( - 'lastExecution', - ); + 'days', aliasedName, false, + type: DriftSqlType.int, requiredDuringInsert: true); + static const VerificationMeta _lastExecutionMeta = + const VerificationMeta('lastExecution'); @override late final GeneratedColumn lastExecution = - GeneratedColumn( - 'last_execution', - aliasedName, - true, - type: DriftSqlType.dateTime, - requiredDuringInsert: false, - ); - static const VerificationMeta _templateIdMeta = const VerificationMeta( - 'templateId', - ); + GeneratedColumn('last_execution', aliasedName, true, + type: DriftSqlType.dateTime, requiredDuringInsert: false); + static const VerificationMeta _templateIdMeta = + const VerificationMeta('templateId'); @override late final GeneratedColumn templateId = GeneratedColumn( - 'template_id', - aliasedName, - false, - type: DriftSqlType.int, - requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES transaction_templates (id)', - ), - ); - static const VerificationMeta _accountIdMeta = const VerificationMeta( - 'accountId', - ); + 'template_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES transaction_templates (id)')); + static const VerificationMeta _accountIdMeta = + const VerificationMeta('accountId'); @override late final GeneratedColumn accountId = GeneratedColumn( - 'account_id', - aliasedName, - false, - type: DriftSqlType.int, - requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES accounts (id)', - ), - ); + 'account_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('REFERENCES accounts (id)')); @override - List get $columns => [ - id, - days, - lastExecution, - templateId, - accountId, - ]; + List get $columns => + [id, days, lastExecution, templateId, accountId]; @override String get aliasedName => _alias ?? actualTableName; @override @@ -2559,9 +2188,8 @@ class $RecurringTransactionsTable extends RecurringTransactions static const String $name = 'recurring_transactions'; @override VerificationContext validateIntegrity( - Insertable instance, { - bool isInserting = false, - }) { + Insertable instance, + {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { @@ -2569,34 +2197,27 @@ class $RecurringTransactionsTable extends RecurringTransactions } if (data.containsKey('days')) { context.handle( - _daysMeta, - days.isAcceptableOrUnknown(data['days']!, _daysMeta), - ); + _daysMeta, days.isAcceptableOrUnknown(data['days']!, _daysMeta)); } else if (isInserting) { context.missing(_daysMeta); } if (data.containsKey('last_execution')) { context.handle( - _lastExecutionMeta, - lastExecution.isAcceptableOrUnknown( - data['last_execution']!, _lastExecutionMeta, - ), - ); + lastExecution.isAcceptableOrUnknown( + data['last_execution']!, _lastExecutionMeta)); } if (data.containsKey('template_id')) { context.handle( - _templateIdMeta, - templateId.isAcceptableOrUnknown(data['template_id']!, _templateIdMeta), - ); + _templateIdMeta, + templateId.isAcceptableOrUnknown( + data['template_id']!, _templateIdMeta)); } else if (isInserting) { context.missing(_templateIdMeta); } if (data.containsKey('account_id')) { - context.handle( - _accountIdMeta, - accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta), - ); + context.handle(_accountIdMeta, + accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta)); } else if (isInserting) { context.missing(_accountIdMeta); } @@ -2609,30 +2230,16 @@ class $RecurringTransactionsTable extends RecurringTransactions RecurringTransaction map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return RecurringTransaction( - id: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}id'], - )!, - days: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}days'], - )!, + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + days: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}days'])!, lastExecution: attachedDatabase.typeMapping.read( - DriftSqlType.dateTime, - data['${effectivePrefix}last_execution'], - ), - templateId: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}template_id'], - )!, - accountId: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}account_id'], - )!, + DriftSqlType.dateTime, data['${effectivePrefix}last_execution']), + templateId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}template_id'])!, + accountId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}account_id'])!, ); } @@ -2649,13 +2256,12 @@ class RecurringTransaction extends DataClass final DateTime? lastExecution; final int templateId; final int accountId; - const RecurringTransaction({ - required this.id, - required this.days, - this.lastExecution, - required this.templateId, - required this.accountId, - }); + const RecurringTransaction( + {required this.id, + required this.days, + this.lastExecution, + required this.templateId, + required this.accountId}); @override Map toColumns(bool nullToAbsent) { final map = {}; @@ -2673,19 +2279,16 @@ class RecurringTransaction extends DataClass return RecurringTransactionsCompanion( id: Value(id), days: Value(days), - lastExecution: - lastExecution == null && nullToAbsent - ? const Value.absent() - : Value(lastExecution), + lastExecution: lastExecution == null && nullToAbsent + ? const Value.absent() + : Value(lastExecution), templateId: Value(templateId), accountId: Value(accountId), ); } - factory RecurringTransaction.fromJson( - Map json, { - ValueSerializer? serializer, - }) { + factory RecurringTransaction.fromJson(Map json, + {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return RecurringTransaction( id: serializer.fromJson(json['id']), @@ -2707,28 +2310,27 @@ class RecurringTransaction extends DataClass }; } - RecurringTransaction copyWith({ - int? id, - int? days, - Value lastExecution = const Value.absent(), - int? templateId, - int? accountId, - }) => RecurringTransaction( - id: id ?? this.id, - days: days ?? this.days, - lastExecution: - lastExecution.present ? lastExecution.value : this.lastExecution, - templateId: templateId ?? this.templateId, - accountId: accountId ?? this.accountId, - ); + RecurringTransaction copyWith( + {int? id, + int? days, + Value lastExecution = const Value.absent(), + int? templateId, + int? accountId}) => + RecurringTransaction( + id: id ?? this.id, + days: days ?? this.days, + lastExecution: + lastExecution.present ? lastExecution.value : this.lastExecution, + templateId: templateId ?? this.templateId, + accountId: accountId ?? this.accountId, + ); RecurringTransaction copyWithCompanion(RecurringTransactionsCompanion data) { return RecurringTransaction( id: data.id.present ? data.id.value : this.id, days: data.days.present ? data.days.value : this.days, - lastExecution: - data.lastExecution.present - ? data.lastExecution.value - : this.lastExecution, + lastExecution: data.lastExecution.present + ? data.lastExecution.value + : this.lastExecution, templateId: data.templateId.present ? data.templateId.value : this.templateId, accountId: data.accountId.present ? data.accountId.value : this.accountId, @@ -2781,9 +2383,9 @@ class RecurringTransactionsCompanion this.lastExecution = const Value.absent(), required int templateId, required int accountId, - }) : days = Value(days), - templateId = Value(templateId), - accountId = Value(accountId); + }) : days = Value(days), + templateId = Value(templateId), + accountId = Value(accountId); static Insertable custom({ Expression? id, Expression? days, @@ -2800,13 +2402,12 @@ class RecurringTransactionsCompanion }); } - RecurringTransactionsCompanion copyWith({ - Value? id, - Value? days, - Value? lastExecution, - Value? templateId, - Value? accountId, - }) { + RecurringTransactionsCompanion copyWith( + {Value? id, + Value? days, + Value? lastExecution, + Value? templateId, + Value? accountId}) { return RecurringTransactionsCompanion( id: id ?? this.id, days: days ?? this.days, @@ -2859,141 +2460,94 @@ class $TransactionsTable extends Transactions 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', - ), - ); + 'id', aliasedName, false, + hasAutoIncrement: true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: + GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _amountMeta = const VerificationMeta('amount'); @override late final GeneratedColumn amount = GeneratedColumn( - 'amount', - aliasedName, - false, - type: DriftSqlType.double, - requiredDuringInsert: true, - ); + 'amount', aliasedName, false, + type: DriftSqlType.double, requiredDuringInsert: true); static const VerificationMeta _dateMeta = const VerificationMeta('date'); @override late final GeneratedColumn date = GeneratedColumn( - 'date', - aliasedName, - false, - type: DriftSqlType.dateTime, - requiredDuringInsert: true, - ); - static const VerificationMeta _expenseCategoryIdMeta = const VerificationMeta( - 'expenseCategoryId', - ); + 'date', aliasedName, false, + type: DriftSqlType.dateTime, requiredDuringInsert: true); + static const VerificationMeta _expenseCategoryIdMeta = + const VerificationMeta('expenseCategoryId'); @override late final GeneratedColumn expenseCategoryId = GeneratedColumn( - 'expense_category_id', - aliasedName, - true, - type: DriftSqlType.int, - requiredDuringInsert: false, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES expense_categories (id)', - ), - ); - static const VerificationMeta _accountIdMeta = const VerificationMeta( - 'accountId', - ); + 'expense_category_id', aliasedName, true, + type: DriftSqlType.int, + requiredDuringInsert: false, + defaultConstraints: GeneratedColumn.constraintIsAlways( + 'REFERENCES expense_categories (id)')); + static const VerificationMeta _accountIdMeta = + const VerificationMeta('accountId'); @override late final GeneratedColumn accountId = GeneratedColumn( - 'account_id', - aliasedName, - false, - type: DriftSqlType.int, - requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES accounts (id)', - ), - ); - static const VerificationMeta _beneficiaryIdMeta = const VerificationMeta( - 'beneficiaryId', - ); + 'account_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('REFERENCES accounts (id)')); + static const VerificationMeta _beneficiaryIdMeta = + const VerificationMeta('beneficiaryId'); @override late final GeneratedColumn beneficiaryId = GeneratedColumn( - 'beneficiary_id', - aliasedName, - false, - type: DriftSqlType.int, - requiredDuringInsert: true, - defaultConstraints: GeneratedColumn.constraintIsAlways( - 'REFERENCES beneficiaries (id)', - ), - ); + 'beneficiary_id', aliasedName, false, + type: DriftSqlType.int, + requiredDuringInsert: true, + defaultConstraints: + GeneratedColumn.constraintIsAlways('REFERENCES beneficiaries (id)')); @override - List get $columns => [ - id, - amount, - date, - expenseCategoryId, - accountId, - beneficiaryId, - ]; + List get $columns => + [id, amount, date, expenseCategoryId, accountId, beneficiaryId]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'transactions'; @override - VerificationContext validateIntegrity( - Insertable instance, { - bool isInserting = false, - }) { + 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('amount')) { - context.handle( - _amountMeta, - amount.isAcceptableOrUnknown(data['amount']!, _amountMeta), - ); + context.handle(_amountMeta, + amount.isAcceptableOrUnknown(data['amount']!, _amountMeta)); } else if (isInserting) { context.missing(_amountMeta); } if (data.containsKey('date')) { context.handle( - _dateMeta, - date.isAcceptableOrUnknown(data['date']!, _dateMeta), - ); + _dateMeta, date.isAcceptableOrUnknown(data['date']!, _dateMeta)); } else if (isInserting) { context.missing(_dateMeta); } if (data.containsKey('expense_category_id')) { context.handle( - _expenseCategoryIdMeta, - expenseCategoryId.isAcceptableOrUnknown( - data['expense_category_id']!, _expenseCategoryIdMeta, - ), - ); + expenseCategoryId.isAcceptableOrUnknown( + data['expense_category_id']!, _expenseCategoryIdMeta)); } if (data.containsKey('account_id')) { - context.handle( - _accountIdMeta, - accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta), - ); + context.handle(_accountIdMeta, + accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta)); } else if (isInserting) { context.missing(_accountIdMeta); } if (data.containsKey('beneficiary_id')) { context.handle( - _beneficiaryIdMeta, - beneficiaryId.isAcceptableOrUnknown( - data['beneficiary_id']!, _beneficiaryIdMeta, - ), - ); + beneficiaryId.isAcceptableOrUnknown( + data['beneficiary_id']!, _beneficiaryIdMeta)); } else if (isInserting) { context.missing(_beneficiaryIdMeta); } @@ -3006,35 +2560,18 @@ class $TransactionsTable extends Transactions Transaction map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Transaction( - id: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}id'], - )!, - amount: - attachedDatabase.typeMapping.read( - DriftSqlType.double, - data['${effectivePrefix}amount'], - )!, - date: - attachedDatabase.typeMapping.read( - DriftSqlType.dateTime, - data['${effectivePrefix}date'], - )!, + id: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}id'])!, + amount: attachedDatabase.typeMapping + .read(DriftSqlType.double, data['${effectivePrefix}amount'])!, + date: attachedDatabase.typeMapping + .read(DriftSqlType.dateTime, data['${effectivePrefix}date'])!, expenseCategoryId: attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}expense_category_id'], - ), - accountId: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}account_id'], - )!, - beneficiaryId: - attachedDatabase.typeMapping.read( - DriftSqlType.int, - data['${effectivePrefix}beneficiary_id'], - )!, + DriftSqlType.int, data['${effectivePrefix}expense_category_id']), + accountId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}account_id'])!, + beneficiaryId: attachedDatabase.typeMapping + .read(DriftSqlType.int, data['${effectivePrefix}beneficiary_id'])!, ); } @@ -3051,14 +2588,13 @@ class Transaction extends DataClass implements Insertable { final int? expenseCategoryId; final int accountId; final int beneficiaryId; - const Transaction({ - required this.id, - required this.amount, - required this.date, - this.expenseCategoryId, - required this.accountId, - required this.beneficiaryId, - }); + const Transaction( + {required this.id, + required this.amount, + required this.date, + this.expenseCategoryId, + required this.accountId, + required this.beneficiaryId}); @override Map toColumns(bool nullToAbsent) { final map = {}; @@ -3078,19 +2614,16 @@ class Transaction extends DataClass implements Insertable { id: Value(id), amount: Value(amount), date: Value(date), - expenseCategoryId: - expenseCategoryId == null && nullToAbsent - ? const Value.absent() - : Value(expenseCategoryId), + expenseCategoryId: expenseCategoryId == null && nullToAbsent + ? const Value.absent() + : Value(expenseCategoryId), accountId: Value(accountId), beneficiaryId: Value(beneficiaryId), ); } - factory Transaction.fromJson( - Map json, { - ValueSerializer? serializer, - }) { + factory Transaction.fromJson(Map json, + {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Transaction( id: serializer.fromJson(json['id']), @@ -3114,38 +2647,35 @@ class Transaction extends DataClass implements Insertable { }; } - Transaction copyWith({ - int? id, - double? amount, - DateTime? date, - Value expenseCategoryId = const Value.absent(), - int? accountId, - int? beneficiaryId, - }) => Transaction( - id: id ?? this.id, - amount: amount ?? this.amount, - date: date ?? this.date, - expenseCategoryId: - expenseCategoryId.present + Transaction copyWith( + {int? id, + double? amount, + DateTime? date, + Value expenseCategoryId = const Value.absent(), + int? accountId, + int? beneficiaryId}) => + Transaction( + id: id ?? this.id, + amount: amount ?? this.amount, + date: date ?? this.date, + expenseCategoryId: expenseCategoryId.present ? expenseCategoryId.value : this.expenseCategoryId, - accountId: accountId ?? this.accountId, - beneficiaryId: beneficiaryId ?? this.beneficiaryId, - ); + accountId: accountId ?? this.accountId, + beneficiaryId: beneficiaryId ?? this.beneficiaryId, + ); Transaction copyWithCompanion(TransactionsCompanion data) { return Transaction( id: data.id.present ? data.id.value : this.id, amount: data.amount.present ? data.amount.value : this.amount, date: data.date.present ? data.date.value : this.date, - expenseCategoryId: - data.expenseCategoryId.present - ? data.expenseCategoryId.value - : this.expenseCategoryId, + expenseCategoryId: data.expenseCategoryId.present + ? data.expenseCategoryId.value + : this.expenseCategoryId, accountId: data.accountId.present ? data.accountId.value : this.accountId, - beneficiaryId: - data.beneficiaryId.present - ? data.beneficiaryId.value - : this.beneficiaryId, + beneficiaryId: data.beneficiaryId.present + ? data.beneficiaryId.value + : this.beneficiaryId, ); } @@ -3164,13 +2694,7 @@ class Transaction extends DataClass implements Insertable { @override int get hashCode => Object.hash( - id, - amount, - date, - expenseCategoryId, - accountId, - beneficiaryId, - ); + id, amount, date, expenseCategoryId, accountId, beneficiaryId); @override bool operator ==(Object other) => identical(this, other) || @@ -3205,10 +2729,10 @@ class TransactionsCompanion extends UpdateCompanion { this.expenseCategoryId = const Value.absent(), required int accountId, required int beneficiaryId, - }) : amount = Value(amount), - date = Value(date), - accountId = Value(accountId), - beneficiaryId = Value(beneficiaryId); + }) : amount = Value(amount), + date = Value(date), + accountId = Value(accountId), + beneficiaryId = Value(beneficiaryId); static Insertable custom({ Expression? id, Expression? amount, @@ -3227,14 +2751,13 @@ class TransactionsCompanion extends UpdateCompanion { }); } - TransactionsCompanion copyWith({ - Value? id, - Value? amount, - Value? date, - Value? expenseCategoryId, - Value? accountId, - Value? beneficiaryId, - }) { + TransactionsCompanion copyWith( + {Value? id, + Value? amount, + Value? date, + Value? expenseCategoryId, + Value? accountId, + Value? beneficiaryId}) { return TransactionsCompanion( id: id ?? this.id, amount: amount ?? this.amount, @@ -3300,157 +2823,130 @@ abstract class _$OkaneDatabase extends GeneratedDatabase { $RecurringTransactionsTable(this); late final $TransactionsTable transactions = $TransactionsTable(this); late final AccountsDao accountsDao = AccountsDao(this as OkaneDatabase); - late final BeneficiariesDao beneficiariesDao = BeneficiariesDao( - this as OkaneDatabase, - ); + late final BeneficiariesDao beneficiariesDao = + BeneficiariesDao(this as OkaneDatabase); late final BudgetsDao budgetsDao = BudgetsDao(this as OkaneDatabase); - late final ExpenseCategoriesDao expenseCategoriesDao = ExpenseCategoriesDao( - this as OkaneDatabase, - ); + late final ExpenseCategoriesDao expenseCategoriesDao = + ExpenseCategoriesDao(this as OkaneDatabase); late final LoansDao loansDao = LoansDao(this as OkaneDatabase); late final RecurringTransactionsDao recurringTransactionsDao = RecurringTransactionsDao(this as OkaneDatabase); late final TransactionTemplatesDao transactionTemplatesDao = TransactionTemplatesDao(this as OkaneDatabase); - late final TransactionsDao transactionsDao = TransactionsDao( - this as OkaneDatabase, - ); + late final TransactionsDao transactionsDao = + TransactionsDao(this as OkaneDatabase); @override Iterable> get allTables => allSchemaEntities.whereType>(); @override List get allSchemaEntities => [ - accounts, - beneficiaries, - budgets, - expenseCategories, - budgetItems, - loans, - loanChanges, - transactionTemplates, - recurringTransactions, - transactions, - ]; + accounts, + beneficiaries, + budgets, + expenseCategories, + budgetItems, + loans, + loanChanges, + transactionTemplates, + recurringTransactions, + transactions + ]; } -typedef $$AccountsTableCreateCompanionBuilder = - AccountsCompanion Function({Value id, required String name}); -typedef $$AccountsTableUpdateCompanionBuilder = - AccountsCompanion Function({Value id, Value name}); +typedef $$AccountsTableCreateCompanionBuilder = AccountsCompanion Function({ + Value id, + required String name, +}); +typedef $$AccountsTableUpdateCompanionBuilder = AccountsCompanion Function({ + Value id, + Value name, +}); final class $$AccountsTableReferences extends BaseReferences<_$OkaneDatabase, $AccountsTable, Account> { $$AccountsTableReferences(super.$_db, super.$_table, super.$_typedResult); static MultiTypedResultKey<$BeneficiariesTable, List> - _beneficiariesRefsTable(_$OkaneDatabase db) => MultiTypedResultKey.fromTable( - db.beneficiaries, - aliasName: $_aliasNameGenerator(db.accounts.id, db.beneficiaries.accountId), - ); + _beneficiariesRefsTable(_$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.beneficiaries, + aliasName: $_aliasNameGenerator( + db.accounts.id, db.beneficiaries.accountId)); $$BeneficiariesTableProcessedTableManager get beneficiariesRefs { - final manager = $$BeneficiariesTableTableManager( - $_db, - $_db.beneficiaries, - ).filter((f) => f.accountId.id.sqlEquals($_itemColumn('id')!)); + final manager = $$BeneficiariesTableTableManager($_db, $_db.beneficiaries) + .filter((f) => f.accountId.id.sqlEquals($_itemColumn('id')!)); final cache = $_typedResult.readTableOrNull(_beneficiariesRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } static MultiTypedResultKey<$BudgetsTable, List> _budgetsRefsTable( - _$OkaneDatabase db, - ) => MultiTypedResultKey.fromTable( - db.budgets, - aliasName: $_aliasNameGenerator(db.accounts.id, db.budgets.accountId), - ); + _$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.budgets, + aliasName: + $_aliasNameGenerator(db.accounts.id, db.budgets.accountId)); $$BudgetsTableProcessedTableManager get budgetsRefs { - final manager = $$BudgetsTableTableManager( - $_db, - $_db.budgets, - ).filter((f) => f.accountId.id.sqlEquals($_itemColumn('id')!)); + final manager = $$BudgetsTableTableManager($_db, $_db.budgets) + .filter((f) => f.accountId.id.sqlEquals($_itemColumn('id')!)); final cache = $_typedResult.readTableOrNull(_budgetsRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } - static MultiTypedResultKey< - $TransactionTemplatesTable, - List - > - _transactionTemplatesRefsTable(_$OkaneDatabase db) => - MultiTypedResultKey.fromTable( - db.transactionTemplates, - aliasName: $_aliasNameGenerator( - db.accounts.id, - db.transactionTemplates.accountId, - ), - ); + static MultiTypedResultKey<$TransactionTemplatesTable, + List> _transactionTemplatesRefsTable( + _$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.transactionTemplates, + aliasName: $_aliasNameGenerator( + db.accounts.id, db.transactionTemplates.accountId)); $$TransactionTemplatesTableProcessedTableManager - get transactionTemplatesRefs { - final manager = $$TransactionTemplatesTableTableManager( - $_db, - $_db.transactionTemplates, - ).filter((f) => f.accountId.id.sqlEquals($_itemColumn('id')!)); + get transactionTemplatesRefs { + final manager = + $$TransactionTemplatesTableTableManager($_db, $_db.transactionTemplates) + .filter((f) => f.accountId.id.sqlEquals($_itemColumn('id')!)); - final cache = $_typedResult.readTableOrNull( - _transactionTemplatesRefsTable($_db), - ); + final cache = + $_typedResult.readTableOrNull(_transactionTemplatesRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } - static MultiTypedResultKey< - $RecurringTransactionsTable, - List - > - _recurringTransactionsRefsTable(_$OkaneDatabase db) => - MultiTypedResultKey.fromTable( - db.recurringTransactions, - aliasName: $_aliasNameGenerator( - db.accounts.id, - db.recurringTransactions.accountId, - ), - ); + static MultiTypedResultKey<$RecurringTransactionsTable, + List> _recurringTransactionsRefsTable( + _$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.recurringTransactions, + aliasName: $_aliasNameGenerator( + db.accounts.id, db.recurringTransactions.accountId)); $$RecurringTransactionsTableProcessedTableManager - get recurringTransactionsRefs { + get recurringTransactionsRefs { final manager = $$RecurringTransactionsTableTableManager( - $_db, - $_db.recurringTransactions, - ).filter((f) => f.accountId.id.sqlEquals($_itemColumn('id')!)); + $_db, $_db.recurringTransactions) + .filter((f) => f.accountId.id.sqlEquals($_itemColumn('id')!)); - final cache = $_typedResult.readTableOrNull( - _recurringTransactionsRefsTable($_db), - ); + final cache = + $_typedResult.readTableOrNull(_recurringTransactionsRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } static MultiTypedResultKey<$TransactionsTable, List> - _transactionsRefsTable(_$OkaneDatabase db) => MultiTypedResultKey.fromTable( - db.transactions, - aliasName: $_aliasNameGenerator(db.accounts.id, db.transactions.accountId), - ); + _transactionsRefsTable(_$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.transactions, + aliasName: $_aliasNameGenerator( + db.accounts.id, db.transactions.accountId)); $$TransactionsTableProcessedTableManager get transactionsRefs { - final manager = $$TransactionsTableTableManager( - $_db, - $_db.transactions, - ).filter((f) => f.accountId.id.sqlEquals($_itemColumn('id')!)); + final manager = $$TransactionsTableTableManager($_db, $_db.transactions) + .filter((f) => f.accountId.id.sqlEquals($_itemColumn('id')!)); final cache = $_typedResult.readTableOrNull(_transactionsRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } } @@ -3464,138 +2960,116 @@ class $$AccountsTableFilterComposer super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnFilters(column), - ); + column: $table.id, builder: (column) => ColumnFilters(column)); ColumnFilters get name => $composableBuilder( - column: $table.name, - builder: (column) => ColumnFilters(column), - ); + column: $table.name, builder: (column) => ColumnFilters(column)); Expression beneficiariesRefs( - Expression Function($$BeneficiariesTableFilterComposer f) f, - ) { + Expression Function($$BeneficiariesTableFilterComposer f) f) { final $$BeneficiariesTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.beneficiaries, - getReferencedColumn: (t) => t.accountId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BeneficiariesTableFilterComposer( - $db: $db, - $table: $db.beneficiaries, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.beneficiaries, + getReferencedColumn: (t) => t.accountId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BeneficiariesTableFilterComposer( + $db: $db, + $table: $db.beneficiaries, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression budgetsRefs( - Expression Function($$BudgetsTableFilterComposer f) f, - ) { + Expression Function($$BudgetsTableFilterComposer f) f) { final $$BudgetsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.budgets, - getReferencedColumn: (t) => t.accountId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BudgetsTableFilterComposer( - $db: $db, - $table: $db.budgets, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.budgets, + getReferencedColumn: (t) => t.accountId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BudgetsTableFilterComposer( + $db: $db, + $table: $db.budgets, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression transactionTemplatesRefs( - Expression Function($$TransactionTemplatesTableFilterComposer f) f, - ) { + Expression Function($$TransactionTemplatesTableFilterComposer f) + f) { final $$TransactionTemplatesTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.transactionTemplates, - getReferencedColumn: (t) => t.accountId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionTemplatesTableFilterComposer( - $db: $db, - $table: $db.transactionTemplates, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.transactionTemplates, + getReferencedColumn: (t) => t.accountId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionTemplatesTableFilterComposer( + $db: $db, + $table: $db.transactionTemplates, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression recurringTransactionsRefs( - Expression Function($$RecurringTransactionsTableFilterComposer f) f, - ) { + Expression Function($$RecurringTransactionsTableFilterComposer f) + f) { final $$RecurringTransactionsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.recurringTransactions, - getReferencedColumn: (t) => t.accountId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$RecurringTransactionsTableFilterComposer( - $db: $db, - $table: $db.recurringTransactions, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.recurringTransactions, + getReferencedColumn: (t) => t.accountId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$RecurringTransactionsTableFilterComposer( + $db: $db, + $table: $db.recurringTransactions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression transactionsRefs( - Expression Function($$TransactionsTableFilterComposer f) f, - ) { + Expression Function($$TransactionsTableFilterComposer f) f) { final $$TransactionsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.transactions, - getReferencedColumn: (t) => t.accountId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionsTableFilterComposer( - $db: $db, - $table: $db.transactions, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.transactions, + getReferencedColumn: (t) => t.accountId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionsTableFilterComposer( + $db: $db, + $table: $db.transactions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } } @@ -3610,14 +3084,10 @@ class $$AccountsTableOrderingComposer super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnOrderings(column), - ); + column: $table.id, builder: (column) => ColumnOrderings(column)); ColumnOrderings get name => $composableBuilder( - column: $table.name, - builder: (column) => ColumnOrderings(column), - ); + column: $table.name, builder: (column) => ColumnOrderings(column)); } class $$AccountsTableAnnotationComposer @@ -3636,190 +3106,168 @@ class $$AccountsTableAnnotationComposer $composableBuilder(column: $table.name, builder: (column) => column); Expression beneficiariesRefs( - Expression Function($$BeneficiariesTableAnnotationComposer a) f, - ) { + Expression Function($$BeneficiariesTableAnnotationComposer a) f) { final $$BeneficiariesTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.beneficiaries, - getReferencedColumn: (t) => t.accountId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BeneficiariesTableAnnotationComposer( - $db: $db, - $table: $db.beneficiaries, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.beneficiaries, + getReferencedColumn: (t) => t.accountId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BeneficiariesTableAnnotationComposer( + $db: $db, + $table: $db.beneficiaries, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression budgetsRefs( - Expression Function($$BudgetsTableAnnotationComposer a) f, - ) { + Expression Function($$BudgetsTableAnnotationComposer a) f) { final $$BudgetsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.budgets, - getReferencedColumn: (t) => t.accountId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BudgetsTableAnnotationComposer( - $db: $db, - $table: $db.budgets, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.budgets, + getReferencedColumn: (t) => t.accountId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BudgetsTableAnnotationComposer( + $db: $db, + $table: $db.budgets, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression transactionTemplatesRefs( - Expression Function($$TransactionTemplatesTableAnnotationComposer a) f, - ) { + Expression Function($$TransactionTemplatesTableAnnotationComposer a) + f) { final $$TransactionTemplatesTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.transactionTemplates, - getReferencedColumn: (t) => t.accountId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionTemplatesTableAnnotationComposer( - $db: $db, - $table: $db.transactionTemplates, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.transactionTemplates, + getReferencedColumn: (t) => t.accountId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionTemplatesTableAnnotationComposer( + $db: $db, + $table: $db.transactionTemplates, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression recurringTransactionsRefs( - Expression Function($$RecurringTransactionsTableAnnotationComposer a) f, - ) { + Expression Function($$RecurringTransactionsTableAnnotationComposer a) + f) { final $$RecurringTransactionsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.recurringTransactions, - getReferencedColumn: (t) => t.accountId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$RecurringTransactionsTableAnnotationComposer( - $db: $db, - $table: $db.recurringTransactions, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.recurringTransactions, + getReferencedColumn: (t) => t.accountId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$RecurringTransactionsTableAnnotationComposer( + $db: $db, + $table: $db.recurringTransactions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression transactionsRefs( - Expression Function($$TransactionsTableAnnotationComposer a) f, - ) { + Expression Function($$TransactionsTableAnnotationComposer a) f) { final $$TransactionsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.transactions, - getReferencedColumn: (t) => t.accountId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionsTableAnnotationComposer( - $db: $db, - $table: $db.transactions, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.transactions, + getReferencedColumn: (t) => t.accountId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionsTableAnnotationComposer( + $db: $db, + $table: $db.transactions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } } -class $$AccountsTableTableManager - extends - RootTableManager< - _$OkaneDatabase, - $AccountsTable, - Account, - $$AccountsTableFilterComposer, - $$AccountsTableOrderingComposer, - $$AccountsTableAnnotationComposer, - $$AccountsTableCreateCompanionBuilder, - $$AccountsTableUpdateCompanionBuilder, - (Account, $$AccountsTableReferences), - Account, - PrefetchHooks Function({ - bool beneficiariesRefs, - bool budgetsRefs, - bool transactionTemplatesRefs, - bool recurringTransactionsRefs, - bool transactionsRefs, - }) - > { +class $$AccountsTableTableManager extends RootTableManager< + _$OkaneDatabase, + $AccountsTable, + Account, + $$AccountsTableFilterComposer, + $$AccountsTableOrderingComposer, + $$AccountsTableAnnotationComposer, + $$AccountsTableCreateCompanionBuilder, + $$AccountsTableUpdateCompanionBuilder, + (Account, $$AccountsTableReferences), + Account, + PrefetchHooks Function( + {bool beneficiariesRefs, + bool budgetsRefs, + bool transactionTemplatesRefs, + bool recurringTransactionsRefs, + bool transactionsRefs})> { $$AccountsTableTableManager(_$OkaneDatabase db, $AccountsTable table) - : super( - TableManagerState( + : super(TableManagerState( db: db, table: table, - createFilteringComposer: - () => $$AccountsTableFilterComposer($db: db, $table: table), - createOrderingComposer: - () => $$AccountsTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: - () => $$AccountsTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: - ({ - Value id = const Value.absent(), - Value name = const Value.absent(), - }) => AccountsCompanion(id: id, name: name), - createCompanionCallback: - ({Value id = const Value.absent(), required String name}) => - AccountsCompanion.insert(id: id, name: name), - withReferenceMapper: - (p0) => - p0 - .map( - (e) => ( - e.readTable(table), - $$AccountsTableReferences(db, table, e), - ), - ) - .toList(), - prefetchHooksCallback: ({ - beneficiariesRefs = false, - budgetsRefs = false, - transactionTemplatesRefs = false, - recurringTransactionsRefs = false, - transactionsRefs = false, - }) { + createFilteringComposer: () => + $$AccountsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$AccountsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$AccountsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value name = const Value.absent(), + }) => + AccountsCompanion( + id: id, + name: name, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required String name, + }) => + AccountsCompanion.insert( + id: id, + name: name, + ), + withReferenceMapper: (p0) => p0 + .map((e) => + (e.readTable(table), $$AccountsTableReferences(db, table, e))) + .toList(), + prefetchHooksCallback: ( + {beneficiariesRefs = false, + budgetsRefs = false, + transactionTemplatesRefs = false, + recurringTransactionsRefs = false, + transactionsRefs = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [ @@ -3827,258 +3275,183 @@ class $$AccountsTableTableManager if (budgetsRefs) db.budgets, if (transactionTemplatesRefs) db.transactionTemplates, if (recurringTransactionsRefs) db.recurringTransactions, - if (transactionsRefs) db.transactions, + if (transactionsRefs) db.transactions ], addJoins: null, getPrefetchedDataCallback: (items) async { return [ if (beneficiariesRefs) - await $_getPrefetchedData< - Account, - $AccountsTable, - Beneficiary - >( - currentTable: table, - referencedTable: $$AccountsTableReferences - ._beneficiariesRefsTable(db), - managerFromTypedResult: - (p0) => - $$AccountsTableReferences( - db, - table, - p0, - ).beneficiariesRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => referencedItems.where( - (e) => e.accountId == item.id, - ), - typedResults: items, - ), + await $_getPrefetchedData( + currentTable: table, + referencedTable: $$AccountsTableReferences + ._beneficiariesRefsTable(db), + managerFromTypedResult: (p0) => + $$AccountsTableReferences(db, table, p0) + .beneficiariesRefs, + referencedItemsForCurrentItem: + (item, referencedItems) => referencedItems + .where((e) => e.accountId == item.id), + typedResults: items), if (budgetsRefs) await $_getPrefetchedData( - currentTable: table, - referencedTable: $$AccountsTableReferences - ._budgetsRefsTable(db), - managerFromTypedResult: - (p0) => - $$AccountsTableReferences( - db, - table, - p0, - ).budgetsRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => referencedItems.where( - (e) => e.accountId == item.id, - ), - typedResults: items, - ), + currentTable: table, + referencedTable: + $$AccountsTableReferences._budgetsRefsTable(db), + managerFromTypedResult: (p0) => + $$AccountsTableReferences(db, table, p0) + .budgetsRefs, + referencedItemsForCurrentItem: + (item, referencedItems) => referencedItems + .where((e) => e.accountId == item.id), + typedResults: items), if (transactionTemplatesRefs) - await $_getPrefetchedData< - Account, - $AccountsTable, - TransactionTemplate - >( - currentTable: table, - referencedTable: $$AccountsTableReferences - ._transactionTemplatesRefsTable(db), - managerFromTypedResult: - (p0) => - $$AccountsTableReferences( - db, - table, - p0, - ).transactionTemplatesRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => referencedItems.where( - (e) => e.accountId == item.id, - ), - typedResults: items, - ), + await $_getPrefetchedData( + currentTable: table, + referencedTable: $$AccountsTableReferences + ._transactionTemplatesRefsTable(db), + managerFromTypedResult: (p0) => + $$AccountsTableReferences(db, table, p0) + .transactionTemplatesRefs, + referencedItemsForCurrentItem: + (item, referencedItems) => referencedItems + .where((e) => e.accountId == item.id), + typedResults: items), if (recurringTransactionsRefs) - await $_getPrefetchedData< - Account, - $AccountsTable, - RecurringTransaction - >( - currentTable: table, - referencedTable: $$AccountsTableReferences - ._recurringTransactionsRefsTable(db), - managerFromTypedResult: - (p0) => - $$AccountsTableReferences( - db, - table, - p0, - ).recurringTransactionsRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => referencedItems.where( - (e) => e.accountId == item.id, - ), - typedResults: items, - ), + await $_getPrefetchedData( + currentTable: table, + referencedTable: $$AccountsTableReferences + ._recurringTransactionsRefsTable(db), + managerFromTypedResult: (p0) => + $$AccountsTableReferences(db, table, p0) + .recurringTransactionsRefs, + referencedItemsForCurrentItem: + (item, referencedItems) => referencedItems + .where((e) => e.accountId == item.id), + typedResults: items), if (transactionsRefs) - await $_getPrefetchedData< - Account, - $AccountsTable, - Transaction - >( - currentTable: table, - referencedTable: $$AccountsTableReferences - ._transactionsRefsTable(db), - managerFromTypedResult: - (p0) => - $$AccountsTableReferences( - db, - table, - p0, - ).transactionsRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => referencedItems.where( - (e) => e.accountId == item.id, - ), - typedResults: items, - ), + await $_getPrefetchedData( + currentTable: table, + referencedTable: $$AccountsTableReferences + ._transactionsRefsTable(db), + managerFromTypedResult: (p0) => + $$AccountsTableReferences(db, table, p0) + .transactionsRefs, + referencedItemsForCurrentItem: + (item, referencedItems) => referencedItems + .where((e) => e.accountId == item.id), + typedResults: items) ]; }, ); }, - ), - ); + )); } -typedef $$AccountsTableProcessedTableManager = - ProcessedTableManager< - _$OkaneDatabase, - $AccountsTable, - Account, - $$AccountsTableFilterComposer, - $$AccountsTableOrderingComposer, - $$AccountsTableAnnotationComposer, - $$AccountsTableCreateCompanionBuilder, - $$AccountsTableUpdateCompanionBuilder, - (Account, $$AccountsTableReferences), - Account, - PrefetchHooks Function({ - bool beneficiariesRefs, +typedef $$AccountsTableProcessedTableManager = ProcessedTableManager< + _$OkaneDatabase, + $AccountsTable, + Account, + $$AccountsTableFilterComposer, + $$AccountsTableOrderingComposer, + $$AccountsTableAnnotationComposer, + $$AccountsTableCreateCompanionBuilder, + $$AccountsTableUpdateCompanionBuilder, + (Account, $$AccountsTableReferences), + Account, + PrefetchHooks Function( + {bool beneficiariesRefs, bool budgetsRefs, bool transactionTemplatesRefs, bool recurringTransactionsRefs, - bool transactionsRefs, - }) - >; -typedef $$BeneficiariesTableCreateCompanionBuilder = - BeneficiariesCompanion Function({ - Value id, - required String name, - required BeneficiaryType type, - Value accountId, - Value imagePath, - }); -typedef $$BeneficiariesTableUpdateCompanionBuilder = - BeneficiariesCompanion Function({ - Value id, - Value name, - Value type, - Value accountId, - Value imagePath, - }); + bool transactionsRefs})>; +typedef $$BeneficiariesTableCreateCompanionBuilder = BeneficiariesCompanion + Function({ + Value id, + required String name, + required BeneficiaryType type, + Value accountId, + Value imagePath, +}); +typedef $$BeneficiariesTableUpdateCompanionBuilder = BeneficiariesCompanion + Function({ + Value id, + Value name, + Value type, + Value accountId, + Value imagePath, +}); final class $$BeneficiariesTableReferences extends BaseReferences<_$OkaneDatabase, $BeneficiariesTable, Beneficiary> { $$BeneficiariesTableReferences( - super.$_db, - super.$_table, - super.$_typedResult, - ); + super.$_db, super.$_table, super.$_typedResult); static $AccountsTable _accountIdTable(_$OkaneDatabase db) => db.accounts.createAlias( - $_aliasNameGenerator(db.beneficiaries.accountId, db.accounts.id), - ); + $_aliasNameGenerator(db.beneficiaries.accountId, db.accounts.id)); $$AccountsTableProcessedTableManager? get accountId { final $_column = $_itemColumn('account_id'); if ($_column == null) return null; - final manager = $$AccountsTableTableManager( - $_db, - $_db.accounts, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = $$AccountsTableTableManager($_db, $_db.accounts) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_accountIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } static MultiTypedResultKey<$LoansTable, List> _loansRefsTable( - _$OkaneDatabase db, - ) => MultiTypedResultKey.fromTable( - db.loans, - aliasName: $_aliasNameGenerator( - db.beneficiaries.id, - db.loans.beneficiaryId, - ), - ); + _$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.loans, + aliasName: $_aliasNameGenerator( + db.beneficiaries.id, db.loans.beneficiaryId)); $$LoansTableProcessedTableManager get loansRefs { - final manager = $$LoansTableTableManager( - $_db, - $_db.loans, - ).filter((f) => f.beneficiaryId.id.sqlEquals($_itemColumn('id')!)); + final manager = $$LoansTableTableManager($_db, $_db.loans) + .filter((f) => f.beneficiaryId.id.sqlEquals($_itemColumn('id')!)); final cache = $_typedResult.readTableOrNull(_loansRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } - static MultiTypedResultKey< - $TransactionTemplatesTable, - List - > - _transactionTemplatesRefsTable(_$OkaneDatabase db) => - MultiTypedResultKey.fromTable( - db.transactionTemplates, - aliasName: $_aliasNameGenerator( - db.beneficiaries.id, - db.transactionTemplates.beneficiaryId, - ), - ); + static MultiTypedResultKey<$TransactionTemplatesTable, + List> _transactionTemplatesRefsTable( + _$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.transactionTemplates, + aliasName: $_aliasNameGenerator( + db.beneficiaries.id, db.transactionTemplates.beneficiaryId)); $$TransactionTemplatesTableProcessedTableManager - get transactionTemplatesRefs { + get transactionTemplatesRefs { final manager = $$TransactionTemplatesTableTableManager( - $_db, - $_db.transactionTemplates, - ).filter((f) => f.beneficiaryId.id.sqlEquals($_itemColumn('id')!)); + $_db, $_db.transactionTemplates) + .filter((f) => f.beneficiaryId.id.sqlEquals($_itemColumn('id')!)); - final cache = $_typedResult.readTableOrNull( - _transactionTemplatesRefsTable($_db), - ); + final cache = + $_typedResult.readTableOrNull(_transactionTemplatesRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } static MultiTypedResultKey<$TransactionsTable, List> - _transactionsRefsTable(_$OkaneDatabase db) => MultiTypedResultKey.fromTable( - db.transactions, - aliasName: $_aliasNameGenerator( - db.beneficiaries.id, - db.transactions.beneficiaryId, - ), - ); + _transactionsRefsTable(_$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.transactions, + aliasName: $_aliasNameGenerator( + db.beneficiaries.id, db.transactions.beneficiaryId)); $$TransactionsTableProcessedTableManager get transactionsRefs { - final manager = $$TransactionsTableTableManager( - $_db, - $_db.transactions, - ).filter((f) => f.beneficiaryId.id.sqlEquals($_itemColumn('id')!)); + final manager = $$TransactionsTableTableManager($_db, $_db.transactions) + .filter((f) => f.beneficiaryId.id.sqlEquals($_itemColumn('id')!)); final cache = $_typedResult.readTableOrNull(_transactionsRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } } @@ -4092,121 +3465,100 @@ class $$BeneficiariesTableFilterComposer super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnFilters(column), - ); + column: $table.id, builder: (column) => ColumnFilters(column)); ColumnFilters get name => $composableBuilder( - column: $table.name, - builder: (column) => ColumnFilters(column), - ); + column: $table.name, builder: (column) => ColumnFilters(column)); ColumnWithTypeConverterFilters - get type => $composableBuilder( - column: $table.type, - builder: (column) => ColumnWithTypeConverterFilters(column), - ); + get type => $composableBuilder( + column: $table.type, + builder: (column) => ColumnWithTypeConverterFilters(column)); ColumnFilters get imagePath => $composableBuilder( - column: $table.imagePath, - builder: (column) => ColumnFilters(column), - ); + column: $table.imagePath, builder: (column) => ColumnFilters(column)); $$AccountsTableFilterComposer get accountId { final $$AccountsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableFilterComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableFilterComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } Expression loansRefs( - Expression Function($$LoansTableFilterComposer f) f, - ) { + Expression Function($$LoansTableFilterComposer f) f) { final $$LoansTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.loans, - getReferencedColumn: (t) => t.beneficiaryId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$LoansTableFilterComposer( - $db: $db, - $table: $db.loans, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.loans, + getReferencedColumn: (t) => t.beneficiaryId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$LoansTableFilterComposer( + $db: $db, + $table: $db.loans, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression transactionTemplatesRefs( - Expression Function($$TransactionTemplatesTableFilterComposer f) f, - ) { + Expression Function($$TransactionTemplatesTableFilterComposer f) + f) { final $$TransactionTemplatesTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.transactionTemplates, - getReferencedColumn: (t) => t.beneficiaryId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionTemplatesTableFilterComposer( - $db: $db, - $table: $db.transactionTemplates, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.transactionTemplates, + getReferencedColumn: (t) => t.beneficiaryId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionTemplatesTableFilterComposer( + $db: $db, + $table: $db.transactionTemplates, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression transactionsRefs( - Expression Function($$TransactionsTableFilterComposer f) f, - ) { + Expression Function($$TransactionsTableFilterComposer f) f) { final $$TransactionsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.transactions, - getReferencedColumn: (t) => t.beneficiaryId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionsTableFilterComposer( - $db: $db, - $table: $db.transactions, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.transactions, + getReferencedColumn: (t) => t.beneficiaryId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionsTableFilterComposer( + $db: $db, + $table: $db.transactions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } } @@ -4221,45 +3573,34 @@ class $$BeneficiariesTableOrderingComposer super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnOrderings(column), - ); + column: $table.id, builder: (column) => ColumnOrderings(column)); ColumnOrderings get name => $composableBuilder( - column: $table.name, - builder: (column) => ColumnOrderings(column), - ); + column: $table.name, builder: (column) => ColumnOrderings(column)); ColumnOrderings get type => $composableBuilder( - column: $table.type, - builder: (column) => ColumnOrderings(column), - ); + column: $table.type, builder: (column) => ColumnOrderings(column)); ColumnOrderings get imagePath => $composableBuilder( - column: $table.imagePath, - builder: (column) => ColumnOrderings(column), - ); + column: $table.imagePath, builder: (column) => ColumnOrderings(column)); $$AccountsTableOrderingComposer get accountId { final $$AccountsTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableOrderingComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableOrderingComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } @@ -4287,220 +3628,185 @@ class $$BeneficiariesTableAnnotationComposer $$AccountsTableAnnotationComposer get accountId { final $$AccountsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableAnnotationComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableAnnotationComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } Expression loansRefs( - Expression Function($$LoansTableAnnotationComposer a) f, - ) { + Expression Function($$LoansTableAnnotationComposer a) f) { final $$LoansTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.loans, - getReferencedColumn: (t) => t.beneficiaryId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$LoansTableAnnotationComposer( - $db: $db, - $table: $db.loans, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.loans, + getReferencedColumn: (t) => t.beneficiaryId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$LoansTableAnnotationComposer( + $db: $db, + $table: $db.loans, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression transactionTemplatesRefs( - Expression Function($$TransactionTemplatesTableAnnotationComposer a) f, - ) { + Expression Function($$TransactionTemplatesTableAnnotationComposer a) + f) { final $$TransactionTemplatesTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.transactionTemplates, - getReferencedColumn: (t) => t.beneficiaryId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionTemplatesTableAnnotationComposer( - $db: $db, - $table: $db.transactionTemplates, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.transactionTemplates, + getReferencedColumn: (t) => t.beneficiaryId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionTemplatesTableAnnotationComposer( + $db: $db, + $table: $db.transactionTemplates, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression transactionsRefs( - Expression Function($$TransactionsTableAnnotationComposer a) f, - ) { + Expression Function($$TransactionsTableAnnotationComposer a) f) { final $$TransactionsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.transactions, - getReferencedColumn: (t) => t.beneficiaryId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionsTableAnnotationComposer( - $db: $db, - $table: $db.transactions, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.transactions, + getReferencedColumn: (t) => t.beneficiaryId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionsTableAnnotationComposer( + $db: $db, + $table: $db.transactions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } } -class $$BeneficiariesTableTableManager - extends - RootTableManager< - _$OkaneDatabase, - $BeneficiariesTable, - Beneficiary, - $$BeneficiariesTableFilterComposer, - $$BeneficiariesTableOrderingComposer, - $$BeneficiariesTableAnnotationComposer, - $$BeneficiariesTableCreateCompanionBuilder, - $$BeneficiariesTableUpdateCompanionBuilder, - (Beneficiary, $$BeneficiariesTableReferences), - Beneficiary, - PrefetchHooks Function({ - bool accountId, - bool loansRefs, - bool transactionTemplatesRefs, - bool transactionsRefs, - }) - > { +class $$BeneficiariesTableTableManager extends RootTableManager< + _$OkaneDatabase, + $BeneficiariesTable, + Beneficiary, + $$BeneficiariesTableFilterComposer, + $$BeneficiariesTableOrderingComposer, + $$BeneficiariesTableAnnotationComposer, + $$BeneficiariesTableCreateCompanionBuilder, + $$BeneficiariesTableUpdateCompanionBuilder, + (Beneficiary, $$BeneficiariesTableReferences), + Beneficiary, + PrefetchHooks Function( + {bool accountId, + bool loansRefs, + bool transactionTemplatesRefs, + bool transactionsRefs})> { $$BeneficiariesTableTableManager( - _$OkaneDatabase db, - $BeneficiariesTable table, - ) : super( - TableManagerState( + _$OkaneDatabase db, $BeneficiariesTable table) + : super(TableManagerState( db: db, table: table, - createFilteringComposer: - () => $$BeneficiariesTableFilterComposer($db: db, $table: table), - createOrderingComposer: - () => - $$BeneficiariesTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: - () => $$BeneficiariesTableAnnotationComposer( - $db: db, - $table: table, - ), - updateCompanionCallback: - ({ - Value id = const Value.absent(), - Value name = const Value.absent(), - Value type = const Value.absent(), - Value accountId = const Value.absent(), - Value imagePath = const Value.absent(), - }) => BeneficiariesCompanion( - id: id, - name: name, - type: type, - accountId: accountId, - imagePath: imagePath, - ), - createCompanionCallback: - ({ - Value id = const Value.absent(), - required String name, - required BeneficiaryType type, - Value accountId = const Value.absent(), - Value imagePath = const Value.absent(), - }) => BeneficiariesCompanion.insert( - id: id, - name: name, - type: type, - accountId: accountId, - imagePath: imagePath, - ), - withReferenceMapper: - (p0) => - p0 - .map( - (e) => ( - e.readTable(table), - $$BeneficiariesTableReferences(db, table, e), - ), - ) - .toList(), - prefetchHooksCallback: ({ - accountId = false, - loansRefs = false, - transactionTemplatesRefs = false, - transactionsRefs = false, - }) { + createFilteringComposer: () => + $$BeneficiariesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$BeneficiariesTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$BeneficiariesTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value name = const Value.absent(), + Value type = const Value.absent(), + Value accountId = const Value.absent(), + Value imagePath = const Value.absent(), + }) => + BeneficiariesCompanion( + id: id, + name: name, + type: type, + accountId: accountId, + imagePath: imagePath, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required String name, + required BeneficiaryType type, + Value accountId = const Value.absent(), + Value imagePath = const Value.absent(), + }) => + BeneficiariesCompanion.insert( + id: id, + name: name, + type: type, + accountId: accountId, + imagePath: imagePath, + ), + withReferenceMapper: (p0) => p0 + .map((e) => ( + e.readTable(table), + $$BeneficiariesTableReferences(db, table, e) + )) + .toList(), + prefetchHooksCallback: ( + {accountId = false, + loansRefs = false, + transactionTemplatesRefs = false, + transactionsRefs = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [ if (loansRefs) db.loans, if (transactionTemplatesRefs) db.transactionTemplates, - if (transactionsRefs) db.transactions, + if (transactionsRefs) db.transactions ], addJoins: < - T extends TableManagerState< - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic - > - >(state) { + T extends TableManagerState< + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic>>(state) { if (accountId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.accountId, - referencedTable: $$BeneficiariesTableReferences - ._accountIdTable(db), - referencedColumn: - $$BeneficiariesTableReferences - ._accountIdTable(db) - .id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.accountId, + referencedTable: + $$BeneficiariesTableReferences._accountIdTable(db), + referencedColumn: + $$BeneficiariesTableReferences._accountIdTable(db).id, + ) as T; } return state; @@ -4508,116 +3814,83 @@ class $$BeneficiariesTableTableManager getPrefetchedDataCallback: (items) async { return [ if (loansRefs) - await $_getPrefetchedData< - Beneficiary, - $BeneficiariesTable, - Loan - >( - currentTable: table, - referencedTable: $$BeneficiariesTableReferences - ._loansRefsTable(db), - managerFromTypedResult: - (p0) => - $$BeneficiariesTableReferences( - db, - table, - p0, - ).loansRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => referencedItems.where( - (e) => e.beneficiaryId == item.id, - ), - typedResults: items, - ), + await $_getPrefetchedData( + currentTable: table, + referencedTable: + $$BeneficiariesTableReferences._loansRefsTable(db), + managerFromTypedResult: (p0) => + $$BeneficiariesTableReferences(db, table, p0) + .loansRefs, + referencedItemsForCurrentItem: + (item, referencedItems) => referencedItems + .where((e) => e.beneficiaryId == item.id), + typedResults: items), if (transactionTemplatesRefs) - await $_getPrefetchedData< - Beneficiary, - $BeneficiariesTable, - TransactionTemplate - >( - currentTable: table, - referencedTable: $$BeneficiariesTableReferences - ._transactionTemplatesRefsTable(db), - managerFromTypedResult: - (p0) => - $$BeneficiariesTableReferences( - db, - table, - p0, - ).transactionTemplatesRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => referencedItems.where( - (e) => e.beneficiaryId == item.id, - ), - typedResults: items, - ), + await $_getPrefetchedData( + currentTable: table, + referencedTable: $$BeneficiariesTableReferences + ._transactionTemplatesRefsTable(db), + managerFromTypedResult: (p0) => + $$BeneficiariesTableReferences(db, table, p0) + .transactionTemplatesRefs, + referencedItemsForCurrentItem: + (item, referencedItems) => referencedItems + .where((e) => e.beneficiaryId == item.id), + typedResults: items), if (transactionsRefs) - await $_getPrefetchedData< - Beneficiary, - $BeneficiariesTable, - Transaction - >( - currentTable: table, - referencedTable: $$BeneficiariesTableReferences - ._transactionsRefsTable(db), - managerFromTypedResult: - (p0) => - $$BeneficiariesTableReferences( - db, - table, - p0, - ).transactionsRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => referencedItems.where( - (e) => e.beneficiaryId == item.id, - ), - typedResults: items, - ), + await $_getPrefetchedData( + currentTable: table, + referencedTable: $$BeneficiariesTableReferences + ._transactionsRefsTable(db), + managerFromTypedResult: (p0) => + $$BeneficiariesTableReferences(db, table, p0) + .transactionsRefs, + referencedItemsForCurrentItem: + (item, referencedItems) => referencedItems + .where((e) => e.beneficiaryId == item.id), + typedResults: items) ]; }, ); }, - ), - ); + )); } -typedef $$BeneficiariesTableProcessedTableManager = - ProcessedTableManager< - _$OkaneDatabase, - $BeneficiariesTable, - Beneficiary, - $$BeneficiariesTableFilterComposer, - $$BeneficiariesTableOrderingComposer, - $$BeneficiariesTableAnnotationComposer, - $$BeneficiariesTableCreateCompanionBuilder, - $$BeneficiariesTableUpdateCompanionBuilder, - (Beneficiary, $$BeneficiariesTableReferences), - Beneficiary, - PrefetchHooks Function({ - bool accountId, +typedef $$BeneficiariesTableProcessedTableManager = ProcessedTableManager< + _$OkaneDatabase, + $BeneficiariesTable, + Beneficiary, + $$BeneficiariesTableFilterComposer, + $$BeneficiariesTableOrderingComposer, + $$BeneficiariesTableAnnotationComposer, + $$BeneficiariesTableCreateCompanionBuilder, + $$BeneficiariesTableUpdateCompanionBuilder, + (Beneficiary, $$BeneficiariesTableReferences), + Beneficiary, + PrefetchHooks Function( + {bool accountId, bool loansRefs, bool transactionTemplatesRefs, - bool transactionsRefs, - }) - >; -typedef $$BudgetsTableCreateCompanionBuilder = - BudgetsCompanion Function({ - Value id, - required BudgetPeriod period, - required String name, - required double income, - required bool includeOtherSpendings, - required int accountId, - }); -typedef $$BudgetsTableUpdateCompanionBuilder = - BudgetsCompanion Function({ - Value id, - Value period, - Value name, - Value income, - Value includeOtherSpendings, - Value accountId, - }); + bool transactionsRefs})>; +typedef $$BudgetsTableCreateCompanionBuilder = BudgetsCompanion Function({ + Value id, + required BudgetPeriod period, + required String name, + required double income, + required bool includeOtherSpendings, + required int accountId, +}); +typedef $$BudgetsTableUpdateCompanionBuilder = BudgetsCompanion Function({ + Value id, + Value period, + Value name, + Value income, + Value includeOtherSpendings, + Value accountId, +}); final class $$BudgetsTableReferences extends BaseReferences<_$OkaneDatabase, $BudgetsTable, Budget> { @@ -4629,33 +3902,27 @@ final class $$BudgetsTableReferences $$AccountsTableProcessedTableManager get accountId { final $_column = $_itemColumn('account_id')!; - final manager = $$AccountsTableTableManager( - $_db, - $_db.accounts, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = $$AccountsTableTableManager($_db, $_db.accounts) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_accountIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } static MultiTypedResultKey<$BudgetItemsTable, List> - _budgetItemsRefsTable(_$OkaneDatabase db) => MultiTypedResultKey.fromTable( - db.budgetItems, - aliasName: $_aliasNameGenerator(db.budgets.id, db.budgetItems.budgetId), - ); + _budgetItemsRefsTable(_$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.budgetItems, + aliasName: + $_aliasNameGenerator(db.budgets.id, db.budgetItems.budgetId)); $$BudgetItemsTableProcessedTableManager get budgetItemsRefs { - final manager = $$BudgetItemsTableTableManager( - $_db, - $_db.budgetItems, - ).filter((f) => f.budgetId.id.sqlEquals($_itemColumn('id')!)); + final manager = $$BudgetItemsTableTableManager($_db, $_db.budgetItems) + .filter((f) => f.budgetId.id.sqlEquals($_itemColumn('id')!)); final cache = $_typedResult.readTableOrNull(_budgetItemsRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } } @@ -4669,76 +3936,61 @@ class $$BudgetsTableFilterComposer super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnFilters(column), - ); + column: $table.id, builder: (column) => ColumnFilters(column)); ColumnWithTypeConverterFilters - get period => $composableBuilder( - column: $table.period, - builder: (column) => ColumnWithTypeConverterFilters(column), - ); + get period => $composableBuilder( + column: $table.period, + builder: (column) => ColumnWithTypeConverterFilters(column)); ColumnFilters get name => $composableBuilder( - column: $table.name, - builder: (column) => ColumnFilters(column), - ); + column: $table.name, builder: (column) => ColumnFilters(column)); ColumnFilters get income => $composableBuilder( - column: $table.income, - builder: (column) => ColumnFilters(column), - ); + column: $table.income, builder: (column) => ColumnFilters(column)); ColumnFilters get includeOtherSpendings => $composableBuilder( - column: $table.includeOtherSpendings, - builder: (column) => ColumnFilters(column), - ); + column: $table.includeOtherSpendings, + builder: (column) => ColumnFilters(column)); $$AccountsTableFilterComposer get accountId { final $$AccountsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableFilterComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableFilterComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } Expression budgetItemsRefs( - Expression Function($$BudgetItemsTableFilterComposer f) f, - ) { + Expression Function($$BudgetItemsTableFilterComposer f) f) { final $$BudgetItemsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.budgetItems, - getReferencedColumn: (t) => t.budgetId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BudgetItemsTableFilterComposer( - $db: $db, - $table: $db.budgetItems, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.budgetItems, + getReferencedColumn: (t) => t.budgetId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BudgetItemsTableFilterComposer( + $db: $db, + $table: $db.budgetItems, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } } @@ -4753,50 +4005,38 @@ class $$BudgetsTableOrderingComposer super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnOrderings(column), - ); + column: $table.id, builder: (column) => ColumnOrderings(column)); ColumnOrderings get period => $composableBuilder( - column: $table.period, - builder: (column) => ColumnOrderings(column), - ); + column: $table.period, builder: (column) => ColumnOrderings(column)); ColumnOrderings get name => $composableBuilder( - column: $table.name, - builder: (column) => ColumnOrderings(column), - ); + column: $table.name, builder: (column) => ColumnOrderings(column)); ColumnOrderings get income => $composableBuilder( - column: $table.income, - builder: (column) => ColumnOrderings(column), - ); + column: $table.income, builder: (column) => ColumnOrderings(column)); ColumnOrderings get includeOtherSpendings => $composableBuilder( - column: $table.includeOtherSpendings, - builder: (column) => ColumnOrderings(column), - ); + column: $table.includeOtherSpendings, + builder: (column) => ColumnOrderings(column)); $$AccountsTableOrderingComposer get accountId { final $$AccountsTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableOrderingComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableOrderingComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } @@ -4823,160 +4063,135 @@ class $$BudgetsTableAnnotationComposer $composableBuilder(column: $table.income, builder: (column) => column); GeneratedColumn get includeOtherSpendings => $composableBuilder( - column: $table.includeOtherSpendings, - builder: (column) => column, - ); + column: $table.includeOtherSpendings, builder: (column) => column); $$AccountsTableAnnotationComposer get accountId { final $$AccountsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableAnnotationComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableAnnotationComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } Expression budgetItemsRefs( - Expression Function($$BudgetItemsTableAnnotationComposer a) f, - ) { + Expression Function($$BudgetItemsTableAnnotationComposer a) f) { final $$BudgetItemsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.budgetItems, - getReferencedColumn: (t) => t.budgetId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BudgetItemsTableAnnotationComposer( - $db: $db, - $table: $db.budgetItems, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.budgetItems, + getReferencedColumn: (t) => t.budgetId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BudgetItemsTableAnnotationComposer( + $db: $db, + $table: $db.budgetItems, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } } -class $$BudgetsTableTableManager - extends - RootTableManager< - _$OkaneDatabase, - $BudgetsTable, - Budget, - $$BudgetsTableFilterComposer, - $$BudgetsTableOrderingComposer, - $$BudgetsTableAnnotationComposer, - $$BudgetsTableCreateCompanionBuilder, - $$BudgetsTableUpdateCompanionBuilder, - (Budget, $$BudgetsTableReferences), - Budget, - PrefetchHooks Function({bool accountId, bool budgetItemsRefs}) - > { +class $$BudgetsTableTableManager extends RootTableManager< + _$OkaneDatabase, + $BudgetsTable, + Budget, + $$BudgetsTableFilterComposer, + $$BudgetsTableOrderingComposer, + $$BudgetsTableAnnotationComposer, + $$BudgetsTableCreateCompanionBuilder, + $$BudgetsTableUpdateCompanionBuilder, + (Budget, $$BudgetsTableReferences), + Budget, + PrefetchHooks Function({bool accountId, bool budgetItemsRefs})> { $$BudgetsTableTableManager(_$OkaneDatabase db, $BudgetsTable table) - : super( - TableManagerState( + : super(TableManagerState( db: db, table: table, - createFilteringComposer: - () => $$BudgetsTableFilterComposer($db: db, $table: table), - createOrderingComposer: - () => $$BudgetsTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: - () => $$BudgetsTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: - ({ - Value id = const Value.absent(), - Value period = const Value.absent(), - Value name = const Value.absent(), - Value income = const Value.absent(), - Value includeOtherSpendings = const Value.absent(), - Value accountId = const Value.absent(), - }) => BudgetsCompanion( - id: id, - period: period, - name: name, - income: income, - includeOtherSpendings: includeOtherSpendings, - accountId: accountId, - ), - createCompanionCallback: - ({ - Value id = const Value.absent(), - required BudgetPeriod period, - required String name, - required double income, - required bool includeOtherSpendings, - required int accountId, - }) => BudgetsCompanion.insert( - id: id, - period: period, - name: name, - income: income, - includeOtherSpendings: includeOtherSpendings, - accountId: accountId, - ), - withReferenceMapper: - (p0) => - p0 - .map( - (e) => ( - e.readTable(table), - $$BudgetsTableReferences(db, table, e), - ), - ) - .toList(), - prefetchHooksCallback: ({ - accountId = false, - budgetItemsRefs = false, - }) { + createFilteringComposer: () => + $$BudgetsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$BudgetsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$BudgetsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value period = const Value.absent(), + Value name = const Value.absent(), + Value income = const Value.absent(), + Value includeOtherSpendings = const Value.absent(), + Value accountId = const Value.absent(), + }) => + BudgetsCompanion( + id: id, + period: period, + name: name, + income: income, + includeOtherSpendings: includeOtherSpendings, + accountId: accountId, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required BudgetPeriod period, + required String name, + required double income, + required bool includeOtherSpendings, + required int accountId, + }) => + BudgetsCompanion.insert( + id: id, + period: period, + name: name, + income: income, + includeOtherSpendings: includeOtherSpendings, + accountId: accountId, + ), + withReferenceMapper: (p0) => p0 + .map((e) => + (e.readTable(table), $$BudgetsTableReferences(db, table, e))) + .toList(), + prefetchHooksCallback: ( + {accountId = false, budgetItemsRefs = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [if (budgetItemsRefs) db.budgetItems], addJoins: < - T extends TableManagerState< - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic - > - >(state) { + T extends TableManagerState< + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic>>(state) { if (accountId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.accountId, - referencedTable: $$BudgetsTableReferences - ._accountIdTable(db), - referencedColumn: - $$BudgetsTableReferences._accountIdTable(db).id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.accountId, + referencedTable: + $$BudgetsTableReferences._accountIdTable(db), + referencedColumn: + $$BudgetsTableReferences._accountIdTable(db).id, + ) as T; } return state; @@ -4984,135 +4199,103 @@ class $$BudgetsTableTableManager getPrefetchedDataCallback: (items) async { return [ if (budgetItemsRefs) - await $_getPrefetchedData< - Budget, - $BudgetsTable, - BudgetItem - >( - currentTable: table, - referencedTable: $$BudgetsTableReferences - ._budgetItemsRefsTable(db), - managerFromTypedResult: - (p0) => - $$BudgetsTableReferences( - db, - table, - p0, - ).budgetItemsRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => referencedItems.where( - (e) => e.budgetId == item.id, - ), - typedResults: items, - ), + await $_getPrefetchedData( + currentTable: table, + referencedTable: + $$BudgetsTableReferences._budgetItemsRefsTable(db), + managerFromTypedResult: (p0) => + $$BudgetsTableReferences(db, table, p0) + .budgetItemsRefs, + referencedItemsForCurrentItem: (item, + referencedItems) => + referencedItems.where((e) => e.budgetId == item.id), + typedResults: items) ]; }, ); }, - ), - ); + )); } -typedef $$BudgetsTableProcessedTableManager = - ProcessedTableManager< - _$OkaneDatabase, - $BudgetsTable, - Budget, - $$BudgetsTableFilterComposer, - $$BudgetsTableOrderingComposer, - $$BudgetsTableAnnotationComposer, - $$BudgetsTableCreateCompanionBuilder, - $$BudgetsTableUpdateCompanionBuilder, - (Budget, $$BudgetsTableReferences), - Budget, - PrefetchHooks Function({bool accountId, bool budgetItemsRefs}) - >; -typedef $$ExpenseCategoriesTableCreateCompanionBuilder = - ExpenseCategoriesCompanion Function({Value id, required String name}); -typedef $$ExpenseCategoriesTableUpdateCompanionBuilder = - ExpenseCategoriesCompanion Function({Value id, Value name}); +typedef $$BudgetsTableProcessedTableManager = ProcessedTableManager< + _$OkaneDatabase, + $BudgetsTable, + Budget, + $$BudgetsTableFilterComposer, + $$BudgetsTableOrderingComposer, + $$BudgetsTableAnnotationComposer, + $$BudgetsTableCreateCompanionBuilder, + $$BudgetsTableUpdateCompanionBuilder, + (Budget, $$BudgetsTableReferences), + Budget, + PrefetchHooks Function({bool accountId, bool budgetItemsRefs})>; +typedef $$ExpenseCategoriesTableCreateCompanionBuilder + = ExpenseCategoriesCompanion Function({ + Value id, + required String name, +}); +typedef $$ExpenseCategoriesTableUpdateCompanionBuilder + = ExpenseCategoriesCompanion Function({ + Value id, + Value name, +}); -final class $$ExpenseCategoriesTableReferences - extends - BaseReferences< - _$OkaneDatabase, - $ExpenseCategoriesTable, - ExpenseCategory - > { +final class $$ExpenseCategoriesTableReferences extends BaseReferences< + _$OkaneDatabase, $ExpenseCategoriesTable, ExpenseCategory> { $$ExpenseCategoriesTableReferences( - super.$_db, - super.$_table, - super.$_typedResult, - ); + super.$_db, super.$_table, super.$_typedResult); static MultiTypedResultKey<$BudgetItemsTable, List> - _budgetItemsRefsTable(_$OkaneDatabase db) => MultiTypedResultKey.fromTable( - db.budgetItems, - aliasName: $_aliasNameGenerator( - db.expenseCategories.id, - db.budgetItems.expenseCategoryId, - ), - ); + _budgetItemsRefsTable(_$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.budgetItems, + aliasName: $_aliasNameGenerator( + db.expenseCategories.id, db.budgetItems.expenseCategoryId)); $$BudgetItemsTableProcessedTableManager get budgetItemsRefs { - final manager = $$BudgetItemsTableTableManager( - $_db, - $_db.budgetItems, - ).filter((f) => f.expenseCategoryId.id.sqlEquals($_itemColumn('id')!)); + final manager = $$BudgetItemsTableTableManager($_db, $_db.budgetItems) + .filter( + (f) => f.expenseCategoryId.id.sqlEquals($_itemColumn('id')!)); final cache = $_typedResult.readTableOrNull(_budgetItemsRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } - static MultiTypedResultKey< - $TransactionTemplatesTable, - List - > - _transactionTemplatesRefsTable(_$OkaneDatabase db) => - MultiTypedResultKey.fromTable( - db.transactionTemplates, - aliasName: $_aliasNameGenerator( - db.expenseCategories.id, - db.transactionTemplates.expenseCategoryId, - ), - ); + static MultiTypedResultKey<$TransactionTemplatesTable, + List> _transactionTemplatesRefsTable( + _$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.transactionTemplates, + aliasName: $_aliasNameGenerator(db.expenseCategories.id, + db.transactionTemplates.expenseCategoryId)); $$TransactionTemplatesTableProcessedTableManager - get transactionTemplatesRefs { + get transactionTemplatesRefs { final manager = $$TransactionTemplatesTableTableManager( - $_db, - $_db.transactionTemplates, - ).filter((f) => f.expenseCategoryId.id.sqlEquals($_itemColumn('id')!)); + $_db, $_db.transactionTemplates) + .filter( + (f) => f.expenseCategoryId.id.sqlEquals($_itemColumn('id')!)); - final cache = $_typedResult.readTableOrNull( - _transactionTemplatesRefsTable($_db), - ); + final cache = + $_typedResult.readTableOrNull(_transactionTemplatesRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } static MultiTypedResultKey<$TransactionsTable, List> - _transactionsRefsTable(_$OkaneDatabase db) => MultiTypedResultKey.fromTable( - db.transactions, - aliasName: $_aliasNameGenerator( - db.expenseCategories.id, - db.transactions.expenseCategoryId, - ), - ); + _transactionsRefsTable(_$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.transactions, + aliasName: $_aliasNameGenerator( + db.expenseCategories.id, db.transactions.expenseCategoryId)); $$TransactionsTableProcessedTableManager get transactionsRefs { - final manager = $$TransactionsTableTableManager( - $_db, - $_db.transactions, - ).filter((f) => f.expenseCategoryId.id.sqlEquals($_itemColumn('id')!)); + final manager = $$TransactionsTableTableManager($_db, $_db.transactions) + .filter( + (f) => f.expenseCategoryId.id.sqlEquals($_itemColumn('id')!)); final cache = $_typedResult.readTableOrNull(_transactionsRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } } @@ -5126,87 +4309,72 @@ class $$ExpenseCategoriesTableFilterComposer super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnFilters(column), - ); + column: $table.id, builder: (column) => ColumnFilters(column)); ColumnFilters get name => $composableBuilder( - column: $table.name, - builder: (column) => ColumnFilters(column), - ); + column: $table.name, builder: (column) => ColumnFilters(column)); Expression budgetItemsRefs( - Expression Function($$BudgetItemsTableFilterComposer f) f, - ) { + Expression Function($$BudgetItemsTableFilterComposer f) f) { final $$BudgetItemsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.budgetItems, - getReferencedColumn: (t) => t.expenseCategoryId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BudgetItemsTableFilterComposer( - $db: $db, - $table: $db.budgetItems, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.budgetItems, + getReferencedColumn: (t) => t.expenseCategoryId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BudgetItemsTableFilterComposer( + $db: $db, + $table: $db.budgetItems, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression transactionTemplatesRefs( - Expression Function($$TransactionTemplatesTableFilterComposer f) f, - ) { + Expression Function($$TransactionTemplatesTableFilterComposer f) + f) { final $$TransactionTemplatesTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.transactionTemplates, - getReferencedColumn: (t) => t.expenseCategoryId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionTemplatesTableFilterComposer( - $db: $db, - $table: $db.transactionTemplates, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.transactionTemplates, + getReferencedColumn: (t) => t.expenseCategoryId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionTemplatesTableFilterComposer( + $db: $db, + $table: $db.transactionTemplates, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression transactionsRefs( - Expression Function($$TransactionsTableFilterComposer f) f, - ) { + Expression Function($$TransactionsTableFilterComposer f) f) { final $$TransactionsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.transactions, - getReferencedColumn: (t) => t.expenseCategoryId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionsTableFilterComposer( - $db: $db, - $table: $db.transactions, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.transactions, + getReferencedColumn: (t) => t.expenseCategoryId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionsTableFilterComposer( + $db: $db, + $table: $db.transactions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } } @@ -5221,14 +4389,10 @@ class $$ExpenseCategoriesTableOrderingComposer super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnOrderings(column), - ); + column: $table.id, builder: (column) => ColumnOrderings(column)); ColumnOrderings get name => $composableBuilder( - column: $table.name, - builder: (column) => ColumnOrderings(column), - ); + column: $table.name, builder: (column) => ColumnOrderings(column)); } class $$ExpenseCategoriesTableAnnotationComposer @@ -5247,306 +4411,243 @@ class $$ExpenseCategoriesTableAnnotationComposer $composableBuilder(column: $table.name, builder: (column) => column); Expression budgetItemsRefs( - Expression Function($$BudgetItemsTableAnnotationComposer a) f, - ) { + Expression Function($$BudgetItemsTableAnnotationComposer a) f) { final $$BudgetItemsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.budgetItems, - getReferencedColumn: (t) => t.expenseCategoryId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BudgetItemsTableAnnotationComposer( - $db: $db, - $table: $db.budgetItems, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.budgetItems, + getReferencedColumn: (t) => t.expenseCategoryId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BudgetItemsTableAnnotationComposer( + $db: $db, + $table: $db.budgetItems, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression transactionTemplatesRefs( - Expression Function($$TransactionTemplatesTableAnnotationComposer a) f, - ) { + Expression Function($$TransactionTemplatesTableAnnotationComposer a) + f) { final $$TransactionTemplatesTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.transactionTemplates, - getReferencedColumn: (t) => t.expenseCategoryId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionTemplatesTableAnnotationComposer( - $db: $db, - $table: $db.transactionTemplates, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.transactionTemplates, + getReferencedColumn: (t) => t.expenseCategoryId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionTemplatesTableAnnotationComposer( + $db: $db, + $table: $db.transactionTemplates, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } Expression transactionsRefs( - Expression Function($$TransactionsTableAnnotationComposer a) f, - ) { + Expression Function($$TransactionsTableAnnotationComposer a) f) { final $$TransactionsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.transactions, - getReferencedColumn: (t) => t.expenseCategoryId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionsTableAnnotationComposer( - $db: $db, - $table: $db.transactions, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.transactions, + getReferencedColumn: (t) => t.expenseCategoryId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionsTableAnnotationComposer( + $db: $db, + $table: $db.transactions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } } -class $$ExpenseCategoriesTableTableManager - extends - RootTableManager< - _$OkaneDatabase, - $ExpenseCategoriesTable, - ExpenseCategory, - $$ExpenseCategoriesTableFilterComposer, - $$ExpenseCategoriesTableOrderingComposer, - $$ExpenseCategoriesTableAnnotationComposer, - $$ExpenseCategoriesTableCreateCompanionBuilder, - $$ExpenseCategoriesTableUpdateCompanionBuilder, - (ExpenseCategory, $$ExpenseCategoriesTableReferences), - ExpenseCategory, - PrefetchHooks Function({ - bool budgetItemsRefs, - bool transactionTemplatesRefs, - bool transactionsRefs, - }) - > { +class $$ExpenseCategoriesTableTableManager extends RootTableManager< + _$OkaneDatabase, + $ExpenseCategoriesTable, + ExpenseCategory, + $$ExpenseCategoriesTableFilterComposer, + $$ExpenseCategoriesTableOrderingComposer, + $$ExpenseCategoriesTableAnnotationComposer, + $$ExpenseCategoriesTableCreateCompanionBuilder, + $$ExpenseCategoriesTableUpdateCompanionBuilder, + (ExpenseCategory, $$ExpenseCategoriesTableReferences), + ExpenseCategory, + PrefetchHooks Function( + {bool budgetItemsRefs, + bool transactionTemplatesRefs, + bool transactionsRefs})> { $$ExpenseCategoriesTableTableManager( - _$OkaneDatabase db, - $ExpenseCategoriesTable table, - ) : super( - TableManagerState( + _$OkaneDatabase db, $ExpenseCategoriesTable table) + : super(TableManagerState( db: db, table: table, - createFilteringComposer: - () => $$ExpenseCategoriesTableFilterComposer( - $db: db, - $table: table, - ), - createOrderingComposer: - () => $$ExpenseCategoriesTableOrderingComposer( - $db: db, - $table: table, - ), - createComputedFieldComposer: - () => $$ExpenseCategoriesTableAnnotationComposer( - $db: db, - $table: table, - ), - updateCompanionCallback: - ({ - Value id = const Value.absent(), - Value name = const Value.absent(), - }) => ExpenseCategoriesCompanion(id: id, name: name), - createCompanionCallback: - ({Value id = const Value.absent(), required String name}) => - ExpenseCategoriesCompanion.insert(id: id, name: name), - withReferenceMapper: - (p0) => - p0 - .map( - (e) => ( - e.readTable(table), - $$ExpenseCategoriesTableReferences(db, table, e), - ), - ) - .toList(), - prefetchHooksCallback: ({ - budgetItemsRefs = false, - transactionTemplatesRefs = false, - transactionsRefs = false, - }) { + createFilteringComposer: () => + $$ExpenseCategoriesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$ExpenseCategoriesTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$ExpenseCategoriesTableAnnotationComposer( + $db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value name = const Value.absent(), + }) => + ExpenseCategoriesCompanion( + id: id, + name: name, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required String name, + }) => + ExpenseCategoriesCompanion.insert( + id: id, + name: name, + ), + withReferenceMapper: (p0) => p0 + .map((e) => ( + e.readTable(table), + $$ExpenseCategoriesTableReferences(db, table, e) + )) + .toList(), + prefetchHooksCallback: ( + {budgetItemsRefs = false, + transactionTemplatesRefs = false, + transactionsRefs = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [ if (budgetItemsRefs) db.budgetItems, if (transactionTemplatesRefs) db.transactionTemplates, - if (transactionsRefs) db.transactions, + if (transactionsRefs) db.transactions ], addJoins: null, getPrefetchedDataCallback: (items) async { return [ if (budgetItemsRefs) - await $_getPrefetchedData< - ExpenseCategory, - $ExpenseCategoriesTable, - BudgetItem - >( - currentTable: table, - referencedTable: $$ExpenseCategoriesTableReferences - ._budgetItemsRefsTable(db), - managerFromTypedResult: - (p0) => - $$ExpenseCategoriesTableReferences( - db, - table, - p0, - ).budgetItemsRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => referencedItems.where( - (e) => e.expenseCategoryId == item.id, - ), - typedResults: items, - ), + await $_getPrefetchedData( + currentTable: table, + referencedTable: $$ExpenseCategoriesTableReferences + ._budgetItemsRefsTable(db), + managerFromTypedResult: (p0) => + $$ExpenseCategoriesTableReferences(db, table, p0) + .budgetItemsRefs, + referencedItemsForCurrentItem: + (item, referencedItems) => referencedItems + .where((e) => e.expenseCategoryId == item.id), + typedResults: items), if (transactionTemplatesRefs) - await $_getPrefetchedData< - ExpenseCategory, - $ExpenseCategoriesTable, - TransactionTemplate - >( - currentTable: table, - referencedTable: $$ExpenseCategoriesTableReferences - ._transactionTemplatesRefsTable(db), - managerFromTypedResult: - (p0) => - $$ExpenseCategoriesTableReferences( - db, - table, - p0, - ).transactionTemplatesRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => referencedItems.where( - (e) => e.expenseCategoryId == item.id, - ), - typedResults: items, - ), + await $_getPrefetchedData( + currentTable: table, + referencedTable: $$ExpenseCategoriesTableReferences + ._transactionTemplatesRefsTable(db), + managerFromTypedResult: (p0) => + $$ExpenseCategoriesTableReferences(db, table, p0) + .transactionTemplatesRefs, + referencedItemsForCurrentItem: + (item, referencedItems) => referencedItems + .where((e) => e.expenseCategoryId == item.id), + typedResults: items), if (transactionsRefs) - await $_getPrefetchedData< - ExpenseCategory, - $ExpenseCategoriesTable, - Transaction - >( - currentTable: table, - referencedTable: $$ExpenseCategoriesTableReferences - ._transactionsRefsTable(db), - managerFromTypedResult: - (p0) => - $$ExpenseCategoriesTableReferences( - db, - table, - p0, - ).transactionsRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => referencedItems.where( - (e) => e.expenseCategoryId == item.id, - ), - typedResults: items, - ), + await $_getPrefetchedData( + currentTable: table, + referencedTable: $$ExpenseCategoriesTableReferences + ._transactionsRefsTable(db), + managerFromTypedResult: (p0) => + $$ExpenseCategoriesTableReferences(db, table, p0) + .transactionsRefs, + referencedItemsForCurrentItem: + (item, referencedItems) => referencedItems + .where((e) => e.expenseCategoryId == item.id), + typedResults: items) ]; }, ); }, - ), - ); + )); } -typedef $$ExpenseCategoriesTableProcessedTableManager = - ProcessedTableManager< - _$OkaneDatabase, - $ExpenseCategoriesTable, - ExpenseCategory, - $$ExpenseCategoriesTableFilterComposer, - $$ExpenseCategoriesTableOrderingComposer, - $$ExpenseCategoriesTableAnnotationComposer, - $$ExpenseCategoriesTableCreateCompanionBuilder, - $$ExpenseCategoriesTableUpdateCompanionBuilder, - (ExpenseCategory, $$ExpenseCategoriesTableReferences), - ExpenseCategory, - PrefetchHooks Function({ - bool budgetItemsRefs, +typedef $$ExpenseCategoriesTableProcessedTableManager = ProcessedTableManager< + _$OkaneDatabase, + $ExpenseCategoriesTable, + ExpenseCategory, + $$ExpenseCategoriesTableFilterComposer, + $$ExpenseCategoriesTableOrderingComposer, + $$ExpenseCategoriesTableAnnotationComposer, + $$ExpenseCategoriesTableCreateCompanionBuilder, + $$ExpenseCategoriesTableUpdateCompanionBuilder, + (ExpenseCategory, $$ExpenseCategoriesTableReferences), + ExpenseCategory, + PrefetchHooks Function( + {bool budgetItemsRefs, bool transactionTemplatesRefs, - bool transactionsRefs, - }) - >; -typedef $$BudgetItemsTableCreateCompanionBuilder = - BudgetItemsCompanion Function({ - Value id, - required double amount, - required int expenseCategoryId, - required int budgetId, - }); -typedef $$BudgetItemsTableUpdateCompanionBuilder = - BudgetItemsCompanion Function({ - Value id, - Value amount, - Value expenseCategoryId, - Value budgetId, - }); + bool transactionsRefs})>; +typedef $$BudgetItemsTableCreateCompanionBuilder = BudgetItemsCompanion + Function({ + Value id, + required double amount, + required int expenseCategoryId, + required int budgetId, +}); +typedef $$BudgetItemsTableUpdateCompanionBuilder = BudgetItemsCompanion + Function({ + Value id, + Value amount, + Value expenseCategoryId, + Value budgetId, +}); final class $$BudgetItemsTableReferences extends BaseReferences<_$OkaneDatabase, $BudgetItemsTable, BudgetItem> { $$BudgetItemsTableReferences(super.$_db, super.$_table, super.$_typedResult); static $ExpenseCategoriesTable _expenseCategoryIdTable(_$OkaneDatabase db) => - db.expenseCategories.createAlias( - $_aliasNameGenerator( - db.budgetItems.expenseCategoryId, - db.expenseCategories.id, - ), - ); + db.expenseCategories.createAlias($_aliasNameGenerator( + db.budgetItems.expenseCategoryId, db.expenseCategories.id)); $$ExpenseCategoriesTableProcessedTableManager get expenseCategoryId { final $_column = $_itemColumn('expense_category_id')!; - final manager = $$ExpenseCategoriesTableTableManager( - $_db, - $_db.expenseCategories, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = + $$ExpenseCategoriesTableTableManager($_db, $_db.expenseCategories) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_expenseCategoryIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } static $BudgetsTable _budgetIdTable(_$OkaneDatabase db) => db.budgets.createAlias( - $_aliasNameGenerator(db.budgetItems.budgetId, db.budgets.id), - ); + $_aliasNameGenerator(db.budgetItems.budgetId, db.budgets.id)); $$BudgetsTableProcessedTableManager get budgetId { final $_column = $_itemColumn('budget_id')!; - final manager = $$BudgetsTableTableManager( - $_db, - $_db.budgets, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = $$BudgetsTableTableManager($_db, $_db.budgets) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_budgetIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } } @@ -5560,58 +4661,48 @@ class $$BudgetItemsTableFilterComposer super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnFilters(column), - ); + column: $table.id, builder: (column) => ColumnFilters(column)); ColumnFilters get amount => $composableBuilder( - column: $table.amount, - builder: (column) => ColumnFilters(column), - ); + column: $table.amount, builder: (column) => ColumnFilters(column)); $$ExpenseCategoriesTableFilterComposer get expenseCategoryId { final $$ExpenseCategoriesTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.expenseCategoryId, - referencedTable: $db.expenseCategories, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$ExpenseCategoriesTableFilterComposer( - $db: $db, - $table: $db.expenseCategories, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.expenseCategoryId, + referencedTable: $db.expenseCategories, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$ExpenseCategoriesTableFilterComposer( + $db: $db, + $table: $db.expenseCategories, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$BudgetsTableFilterComposer get budgetId { final $$BudgetsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.budgetId, - referencedTable: $db.budgets, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BudgetsTableFilterComposer( - $db: $db, - $table: $db.budgets, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.budgetId, + referencedTable: $db.budgets, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BudgetsTableFilterComposer( + $db: $db, + $table: $db.budgets, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } @@ -5626,58 +4717,48 @@ class $$BudgetItemsTableOrderingComposer super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnOrderings(column), - ); + column: $table.id, builder: (column) => ColumnOrderings(column)); ColumnOrderings get amount => $composableBuilder( - column: $table.amount, - builder: (column) => ColumnOrderings(column), - ); + column: $table.amount, builder: (column) => ColumnOrderings(column)); $$ExpenseCategoriesTableOrderingComposer get expenseCategoryId { final $$ExpenseCategoriesTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.expenseCategoryId, - referencedTable: $db.expenseCategories, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$ExpenseCategoriesTableOrderingComposer( - $db: $db, - $table: $db.expenseCategories, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.expenseCategoryId, + referencedTable: $db.expenseCategories, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$ExpenseCategoriesTableOrderingComposer( + $db: $db, + $table: $db.expenseCategories, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$BudgetsTableOrderingComposer get budgetId { final $$BudgetsTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.budgetId, - referencedTable: $db.budgets, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BudgetsTableOrderingComposer( - $db: $db, - $table: $db.budgets, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.budgetId, + referencedTable: $db.budgets, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BudgetsTableOrderingComposer( + $db: $db, + $table: $db.budgets, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } @@ -5700,161 +4781,135 @@ class $$BudgetItemsTableAnnotationComposer $$ExpenseCategoriesTableAnnotationComposer get expenseCategoryId { final $$ExpenseCategoriesTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.expenseCategoryId, - referencedTable: $db.expenseCategories, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$ExpenseCategoriesTableAnnotationComposer( - $db: $db, - $table: $db.expenseCategories, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.expenseCategoryId, + referencedTable: $db.expenseCategories, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$ExpenseCategoriesTableAnnotationComposer( + $db: $db, + $table: $db.expenseCategories, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$BudgetsTableAnnotationComposer get budgetId { final $$BudgetsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.budgetId, - referencedTable: $db.budgets, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BudgetsTableAnnotationComposer( - $db: $db, - $table: $db.budgets, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.budgetId, + referencedTable: $db.budgets, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BudgetsTableAnnotationComposer( + $db: $db, + $table: $db.budgets, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } -class $$BudgetItemsTableTableManager - extends - RootTableManager< - _$OkaneDatabase, - $BudgetItemsTable, - BudgetItem, - $$BudgetItemsTableFilterComposer, - $$BudgetItemsTableOrderingComposer, - $$BudgetItemsTableAnnotationComposer, - $$BudgetItemsTableCreateCompanionBuilder, - $$BudgetItemsTableUpdateCompanionBuilder, - (BudgetItem, $$BudgetItemsTableReferences), - BudgetItem, - PrefetchHooks Function({bool expenseCategoryId, bool budgetId}) - > { +class $$BudgetItemsTableTableManager extends RootTableManager< + _$OkaneDatabase, + $BudgetItemsTable, + BudgetItem, + $$BudgetItemsTableFilterComposer, + $$BudgetItemsTableOrderingComposer, + $$BudgetItemsTableAnnotationComposer, + $$BudgetItemsTableCreateCompanionBuilder, + $$BudgetItemsTableUpdateCompanionBuilder, + (BudgetItem, $$BudgetItemsTableReferences), + BudgetItem, + PrefetchHooks Function({bool expenseCategoryId, bool budgetId})> { $$BudgetItemsTableTableManager(_$OkaneDatabase db, $BudgetItemsTable table) - : super( - TableManagerState( + : super(TableManagerState( db: db, table: table, - createFilteringComposer: - () => $$BudgetItemsTableFilterComposer($db: db, $table: table), - createOrderingComposer: - () => $$BudgetItemsTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: - () => - $$BudgetItemsTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: - ({ - Value id = const Value.absent(), - Value amount = const Value.absent(), - Value expenseCategoryId = const Value.absent(), - Value budgetId = const Value.absent(), - }) => BudgetItemsCompanion( - id: id, - amount: amount, - expenseCategoryId: expenseCategoryId, - budgetId: budgetId, - ), - createCompanionCallback: - ({ - Value id = const Value.absent(), - required double amount, - required int expenseCategoryId, - required int budgetId, - }) => BudgetItemsCompanion.insert( - id: id, - amount: amount, - expenseCategoryId: expenseCategoryId, - budgetId: budgetId, - ), - withReferenceMapper: - (p0) => - p0 - .map( - (e) => ( - e.readTable(table), - $$BudgetItemsTableReferences(db, table, e), - ), - ) - .toList(), - prefetchHooksCallback: ({ - expenseCategoryId = false, - budgetId = false, - }) { + createFilteringComposer: () => + $$BudgetItemsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$BudgetItemsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$BudgetItemsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value amount = const Value.absent(), + Value expenseCategoryId = const Value.absent(), + Value budgetId = const Value.absent(), + }) => + BudgetItemsCompanion( + id: id, + amount: amount, + expenseCategoryId: expenseCategoryId, + budgetId: budgetId, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required double amount, + required int expenseCategoryId, + required int budgetId, + }) => + BudgetItemsCompanion.insert( + id: id, + amount: amount, + expenseCategoryId: expenseCategoryId, + budgetId: budgetId, + ), + withReferenceMapper: (p0) => p0 + .map((e) => ( + e.readTable(table), + $$BudgetItemsTableReferences(db, table, e) + )) + .toList(), + prefetchHooksCallback: ( + {expenseCategoryId = false, budgetId = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [], addJoins: < - T extends TableManagerState< - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic - > - >(state) { + T extends TableManagerState< + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic>>(state) { if (expenseCategoryId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.expenseCategoryId, - referencedTable: $$BudgetItemsTableReferences - ._expenseCategoryIdTable(db), - referencedColumn: - $$BudgetItemsTableReferences - ._expenseCategoryIdTable(db) - .id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.expenseCategoryId, + referencedTable: $$BudgetItemsTableReferences + ._expenseCategoryIdTable(db), + referencedColumn: $$BudgetItemsTableReferences + ._expenseCategoryIdTable(db) + .id, + ) as T; } if (budgetId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.budgetId, - referencedTable: $$BudgetItemsTableReferences - ._budgetIdTable(db), - referencedColumn: - $$BudgetItemsTableReferences - ._budgetIdTable(db) - .id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.budgetId, + referencedTable: + $$BudgetItemsTableReferences._budgetIdTable(db), + referencedColumn: + $$BudgetItemsTableReferences._budgetIdTable(db).id, + ) as T; } return state; @@ -5864,28 +4919,29 @@ class $$BudgetItemsTableTableManager }, ); }, - ), - ); + )); } -typedef $$BudgetItemsTableProcessedTableManager = - ProcessedTableManager< - _$OkaneDatabase, - $BudgetItemsTable, - BudgetItem, - $$BudgetItemsTableFilterComposer, - $$BudgetItemsTableOrderingComposer, - $$BudgetItemsTableAnnotationComposer, - $$BudgetItemsTableCreateCompanionBuilder, - $$BudgetItemsTableUpdateCompanionBuilder, - (BudgetItem, $$BudgetItemsTableReferences), - BudgetItem, - PrefetchHooks Function({bool expenseCategoryId, bool budgetId}) - >; -typedef $$LoansTableCreateCompanionBuilder = - LoansCompanion Function({Value id, required int beneficiaryId}); -typedef $$LoansTableUpdateCompanionBuilder = - LoansCompanion Function({Value id, Value beneficiaryId}); +typedef $$BudgetItemsTableProcessedTableManager = ProcessedTableManager< + _$OkaneDatabase, + $BudgetItemsTable, + BudgetItem, + $$BudgetItemsTableFilterComposer, + $$BudgetItemsTableOrderingComposer, + $$BudgetItemsTableAnnotationComposer, + $$BudgetItemsTableCreateCompanionBuilder, + $$BudgetItemsTableUpdateCompanionBuilder, + (BudgetItem, $$BudgetItemsTableReferences), + BudgetItem, + PrefetchHooks Function({bool expenseCategoryId, bool budgetId})>; +typedef $$LoansTableCreateCompanionBuilder = LoansCompanion Function({ + Value id, + required int beneficiaryId, +}); +typedef $$LoansTableUpdateCompanionBuilder = LoansCompanion Function({ + Value id, + Value beneficiaryId, +}); final class $$LoansTableReferences extends BaseReferences<_$OkaneDatabase, $LoansTable, Loan> { @@ -5893,39 +4949,32 @@ final class $$LoansTableReferences static $BeneficiariesTable _beneficiaryIdTable(_$OkaneDatabase db) => db.beneficiaries.createAlias( - $_aliasNameGenerator(db.loans.beneficiaryId, db.beneficiaries.id), - ); + $_aliasNameGenerator(db.loans.beneficiaryId, db.beneficiaries.id)); $$BeneficiariesTableProcessedTableManager get beneficiaryId { final $_column = $_itemColumn('beneficiary_id')!; - final manager = $$BeneficiariesTableTableManager( - $_db, - $_db.beneficiaries, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = $$BeneficiariesTableTableManager($_db, $_db.beneficiaries) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_beneficiaryIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } static MultiTypedResultKey<$LoanChangesTable, List> - _loanChangesRefsTable(_$OkaneDatabase db) => MultiTypedResultKey.fromTable( - db.loanChanges, - aliasName: $_aliasNameGenerator(db.loans.id, db.loanChanges.loanId), - ); + _loanChangesRefsTable(_$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.loanChanges, + aliasName: + $_aliasNameGenerator(db.loans.id, db.loanChanges.loanId)); $$LoanChangesTableProcessedTableManager get loanChangesRefs { - final manager = $$LoanChangesTableTableManager( - $_db, - $_db.loanChanges, - ).filter((f) => f.loanId.id.sqlEquals($_itemColumn('id')!)); + final manager = $$LoanChangesTableTableManager($_db, $_db.loanChanges) + .filter((f) => f.loanId.id.sqlEquals($_itemColumn('id')!)); final cache = $_typedResult.readTableOrNull(_loanChangesRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } } @@ -5939,55 +4988,46 @@ class $$LoansTableFilterComposer super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnFilters(column), - ); + column: $table.id, builder: (column) => ColumnFilters(column)); $$BeneficiariesTableFilterComposer get beneficiaryId { final $$BeneficiariesTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.beneficiaryId, - referencedTable: $db.beneficiaries, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BeneficiariesTableFilterComposer( - $db: $db, - $table: $db.beneficiaries, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.beneficiaryId, + referencedTable: $db.beneficiaries, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BeneficiariesTableFilterComposer( + $db: $db, + $table: $db.beneficiaries, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } Expression loanChangesRefs( - Expression Function($$LoanChangesTableFilterComposer f) f, - ) { + Expression Function($$LoanChangesTableFilterComposer f) f) { final $$LoanChangesTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.loanChanges, - getReferencedColumn: (t) => t.loanId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$LoanChangesTableFilterComposer( - $db: $db, - $table: $db.loanChanges, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.loanChanges, + getReferencedColumn: (t) => t.loanId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$LoanChangesTableFilterComposer( + $db: $db, + $table: $db.loanChanges, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } } @@ -6002,30 +5042,25 @@ class $$LoansTableOrderingComposer super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnOrderings(column), - ); + column: $table.id, builder: (column) => ColumnOrderings(column)); $$BeneficiariesTableOrderingComposer get beneficiaryId { final $$BeneficiariesTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.beneficiaryId, - referencedTable: $db.beneficiaries, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BeneficiariesTableOrderingComposer( - $db: $db, - $table: $db.beneficiaries, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.beneficiaryId, + referencedTable: $db.beneficiaries, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BeneficiariesTableOrderingComposer( + $db: $db, + $table: $db.beneficiaries, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } @@ -6044,134 +5079,115 @@ class $$LoansTableAnnotationComposer $$BeneficiariesTableAnnotationComposer get beneficiaryId { final $$BeneficiariesTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.beneficiaryId, - referencedTable: $db.beneficiaries, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BeneficiariesTableAnnotationComposer( - $db: $db, - $table: $db.beneficiaries, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.beneficiaryId, + referencedTable: $db.beneficiaries, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BeneficiariesTableAnnotationComposer( + $db: $db, + $table: $db.beneficiaries, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } Expression loanChangesRefs( - Expression Function($$LoanChangesTableAnnotationComposer a) f, - ) { + Expression Function($$LoanChangesTableAnnotationComposer a) f) { final $$LoanChangesTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.loanChanges, - getReferencedColumn: (t) => t.loanId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$LoanChangesTableAnnotationComposer( - $db: $db, - $table: $db.loanChanges, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.loanChanges, + getReferencedColumn: (t) => t.loanId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$LoanChangesTableAnnotationComposer( + $db: $db, + $table: $db.loanChanges, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } } -class $$LoansTableTableManager - extends - RootTableManager< - _$OkaneDatabase, - $LoansTable, - Loan, - $$LoansTableFilterComposer, - $$LoansTableOrderingComposer, - $$LoansTableAnnotationComposer, - $$LoansTableCreateCompanionBuilder, - $$LoansTableUpdateCompanionBuilder, - (Loan, $$LoansTableReferences), - Loan, - PrefetchHooks Function({bool beneficiaryId, bool loanChangesRefs}) - > { +class $$LoansTableTableManager extends RootTableManager< + _$OkaneDatabase, + $LoansTable, + Loan, + $$LoansTableFilterComposer, + $$LoansTableOrderingComposer, + $$LoansTableAnnotationComposer, + $$LoansTableCreateCompanionBuilder, + $$LoansTableUpdateCompanionBuilder, + (Loan, $$LoansTableReferences), + Loan, + PrefetchHooks Function({bool beneficiaryId, bool loanChangesRefs})> { $$LoansTableTableManager(_$OkaneDatabase db, $LoansTable table) - : super( - TableManagerState( + : super(TableManagerState( db: db, table: table, - createFilteringComposer: - () => $$LoansTableFilterComposer($db: db, $table: table), - createOrderingComposer: - () => $$LoansTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: - () => $$LoansTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: - ({ - Value id = const Value.absent(), - Value beneficiaryId = const Value.absent(), - }) => LoansCompanion(id: id, beneficiaryId: beneficiaryId), - createCompanionCallback: - ({ - Value id = const Value.absent(), - required int beneficiaryId, - }) => LoansCompanion.insert(id: id, beneficiaryId: beneficiaryId), - withReferenceMapper: - (p0) => - p0 - .map( - (e) => ( - e.readTable(table), - $$LoansTableReferences(db, table, e), - ), - ) - .toList(), - prefetchHooksCallback: ({ - beneficiaryId = false, - loanChangesRefs = false, - }) { + createFilteringComposer: () => + $$LoansTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$LoansTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$LoansTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value beneficiaryId = const Value.absent(), + }) => + LoansCompanion( + id: id, + beneficiaryId: beneficiaryId, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required int beneficiaryId, + }) => + LoansCompanion.insert( + id: id, + beneficiaryId: beneficiaryId, + ), + withReferenceMapper: (p0) => p0 + .map((e) => + (e.readTable(table), $$LoansTableReferences(db, table, e))) + .toList(), + prefetchHooksCallback: ( + {beneficiaryId = false, loanChangesRefs = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [if (loanChangesRefs) db.loanChanges], addJoins: < - T extends TableManagerState< - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic - > - >(state) { + T extends TableManagerState< + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic>>(state) { if (beneficiaryId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.beneficiaryId, - referencedTable: $$LoansTableReferences - ._beneficiaryIdTable(db), - referencedColumn: - $$LoansTableReferences - ._beneficiaryIdTable(db) - .id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.beneficiaryId, + referencedTable: + $$LoansTableReferences._beneficiaryIdTable(db), + referencedColumn: + $$LoansTableReferences._beneficiaryIdTable(db).id, + ) as T; } return state; @@ -6180,78 +5196,66 @@ class $$LoansTableTableManager return [ if (loanChangesRefs) await $_getPrefetchedData( - currentTable: table, - referencedTable: $$LoansTableReferences - ._loanChangesRefsTable(db), - managerFromTypedResult: - (p0) => - $$LoansTableReferences( - db, - table, - p0, - ).loanChangesRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => - referencedItems.where((e) => e.loanId == item.id), - typedResults: items, - ), + currentTable: table, + referencedTable: + $$LoansTableReferences._loanChangesRefsTable(db), + managerFromTypedResult: (p0) => + $$LoansTableReferences(db, table, p0) + .loanChangesRefs, + referencedItemsForCurrentItem: (item, + referencedItems) => + referencedItems.where((e) => e.loanId == item.id), + typedResults: items) ]; }, ); }, - ), - ); + )); } -typedef $$LoansTableProcessedTableManager = - ProcessedTableManager< - _$OkaneDatabase, - $LoansTable, - Loan, - $$LoansTableFilterComposer, - $$LoansTableOrderingComposer, - $$LoansTableAnnotationComposer, - $$LoansTableCreateCompanionBuilder, - $$LoansTableUpdateCompanionBuilder, - (Loan, $$LoansTableReferences), - Loan, - PrefetchHooks Function({bool beneficiaryId, bool loanChangesRefs}) - >; -typedef $$LoanChangesTableCreateCompanionBuilder = - LoanChangesCompanion Function({ - Value id, - required int loanId, - required double amount, - required DateTime date, - }); -typedef $$LoanChangesTableUpdateCompanionBuilder = - LoanChangesCompanion Function({ - Value id, - Value loanId, - Value amount, - Value date, - }); +typedef $$LoansTableProcessedTableManager = ProcessedTableManager< + _$OkaneDatabase, + $LoansTable, + Loan, + $$LoansTableFilterComposer, + $$LoansTableOrderingComposer, + $$LoansTableAnnotationComposer, + $$LoansTableCreateCompanionBuilder, + $$LoansTableUpdateCompanionBuilder, + (Loan, $$LoansTableReferences), + Loan, + PrefetchHooks Function({bool beneficiaryId, bool loanChangesRefs})>; +typedef $$LoanChangesTableCreateCompanionBuilder = LoanChangesCompanion + Function({ + Value id, + required int loanId, + required double amount, + required DateTime date, +}); +typedef $$LoanChangesTableUpdateCompanionBuilder = LoanChangesCompanion + Function({ + Value id, + Value loanId, + Value amount, + Value date, +}); final class $$LoanChangesTableReferences extends BaseReferences<_$OkaneDatabase, $LoanChangesTable, LoanChange> { $$LoanChangesTableReferences(super.$_db, super.$_table, super.$_typedResult); - static $LoansTable _loanIdTable(_$OkaneDatabase db) => db.loans.createAlias( - $_aliasNameGenerator(db.loanChanges.loanId, db.loans.id), - ); + static $LoansTable _loanIdTable(_$OkaneDatabase db) => db.loans + .createAlias($_aliasNameGenerator(db.loanChanges.loanId, db.loans.id)); $$LoansTableProcessedTableManager get loanId { final $_column = $_itemColumn('loan_id')!; - final manager = $$LoansTableTableManager( - $_db, - $_db.loans, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = $$LoansTableTableManager($_db, $_db.loans) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_loanIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } } @@ -6265,40 +5269,31 @@ class $$LoanChangesTableFilterComposer super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnFilters(column), - ); + column: $table.id, builder: (column) => ColumnFilters(column)); ColumnFilters get amount => $composableBuilder( - column: $table.amount, - builder: (column) => ColumnFilters(column), - ); + column: $table.amount, builder: (column) => ColumnFilters(column)); ColumnFilters get date => $composableBuilder( - column: $table.date, - builder: (column) => ColumnFilters(column), - ); + column: $table.date, builder: (column) => ColumnFilters(column)); $$LoansTableFilterComposer get loanId { final $$LoansTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.loanId, - referencedTable: $db.loans, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$LoansTableFilterComposer( - $db: $db, - $table: $db.loans, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.loanId, + referencedTable: $db.loans, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$LoansTableFilterComposer( + $db: $db, + $table: $db.loans, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } @@ -6313,40 +5308,31 @@ class $$LoanChangesTableOrderingComposer super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnOrderings(column), - ); + column: $table.id, builder: (column) => ColumnOrderings(column)); ColumnOrderings get amount => $composableBuilder( - column: $table.amount, - builder: (column) => ColumnOrderings(column), - ); + column: $table.amount, builder: (column) => ColumnOrderings(column)); ColumnOrderings get date => $composableBuilder( - column: $table.date, - builder: (column) => ColumnOrderings(column), - ); + column: $table.date, builder: (column) => ColumnOrderings(column)); $$LoansTableOrderingComposer get loanId { final $$LoansTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.loanId, - referencedTable: $db.loans, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$LoansTableOrderingComposer( - $db: $db, - $table: $db.loans, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.loanId, + referencedTable: $db.loans, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$LoansTableOrderingComposer( + $db: $db, + $table: $db.loans, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } @@ -6371,121 +5357,103 @@ class $$LoanChangesTableAnnotationComposer $$LoansTableAnnotationComposer get loanId { final $$LoansTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.loanId, - referencedTable: $db.loans, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$LoansTableAnnotationComposer( - $db: $db, - $table: $db.loans, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.loanId, + referencedTable: $db.loans, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$LoansTableAnnotationComposer( + $db: $db, + $table: $db.loans, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } -class $$LoanChangesTableTableManager - extends - RootTableManager< - _$OkaneDatabase, - $LoanChangesTable, - LoanChange, - $$LoanChangesTableFilterComposer, - $$LoanChangesTableOrderingComposer, - $$LoanChangesTableAnnotationComposer, - $$LoanChangesTableCreateCompanionBuilder, - $$LoanChangesTableUpdateCompanionBuilder, - (LoanChange, $$LoanChangesTableReferences), - LoanChange, - PrefetchHooks Function({bool loanId}) - > { +class $$LoanChangesTableTableManager extends RootTableManager< + _$OkaneDatabase, + $LoanChangesTable, + LoanChange, + $$LoanChangesTableFilterComposer, + $$LoanChangesTableOrderingComposer, + $$LoanChangesTableAnnotationComposer, + $$LoanChangesTableCreateCompanionBuilder, + $$LoanChangesTableUpdateCompanionBuilder, + (LoanChange, $$LoanChangesTableReferences), + LoanChange, + PrefetchHooks Function({bool loanId})> { $$LoanChangesTableTableManager(_$OkaneDatabase db, $LoanChangesTable table) - : super( - TableManagerState( + : super(TableManagerState( db: db, table: table, - createFilteringComposer: - () => $$LoanChangesTableFilterComposer($db: db, $table: table), - createOrderingComposer: - () => $$LoanChangesTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: - () => - $$LoanChangesTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: - ({ - Value id = const Value.absent(), - Value loanId = const Value.absent(), - Value amount = const Value.absent(), - Value date = const Value.absent(), - }) => LoanChangesCompanion( - id: id, - loanId: loanId, - amount: amount, - date: date, - ), - createCompanionCallback: - ({ - Value id = const Value.absent(), - required int loanId, - required double amount, - required DateTime date, - }) => LoanChangesCompanion.insert( - id: id, - loanId: loanId, - amount: amount, - date: date, - ), - withReferenceMapper: - (p0) => - p0 - .map( - (e) => ( - e.readTable(table), - $$LoanChangesTableReferences(db, table, e), - ), - ) - .toList(), + createFilteringComposer: () => + $$LoanChangesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$LoanChangesTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$LoanChangesTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value loanId = const Value.absent(), + Value amount = const Value.absent(), + Value date = const Value.absent(), + }) => + LoanChangesCompanion( + id: id, + loanId: loanId, + amount: amount, + date: date, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required int loanId, + required double amount, + required DateTime date, + }) => + LoanChangesCompanion.insert( + id: id, + loanId: loanId, + amount: amount, + date: date, + ), + withReferenceMapper: (p0) => p0 + .map((e) => ( + e.readTable(table), + $$LoanChangesTableReferences(db, table, e) + )) + .toList(), prefetchHooksCallback: ({loanId = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [], addJoins: < - T extends TableManagerState< - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic - > - >(state) { + T extends TableManagerState< + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic>>(state) { if (loanId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.loanId, - referencedTable: $$LoanChangesTableReferences - ._loanIdTable(db), - referencedColumn: - $$LoanChangesTableReferences - ._loanIdTable(db) - .id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.loanId, + referencedTable: + $$LoanChangesTableReferences._loanIdTable(db), + referencedColumn: + $$LoanChangesTableReferences._loanIdTable(db).id, + ) as T; } return state; @@ -6495,147 +5463,110 @@ class $$LoanChangesTableTableManager }, ); }, - ), - ); + )); } -typedef $$LoanChangesTableProcessedTableManager = - ProcessedTableManager< - _$OkaneDatabase, - $LoanChangesTable, - LoanChange, - $$LoanChangesTableFilterComposer, - $$LoanChangesTableOrderingComposer, - $$LoanChangesTableAnnotationComposer, - $$LoanChangesTableCreateCompanionBuilder, - $$LoanChangesTableUpdateCompanionBuilder, - (LoanChange, $$LoanChangesTableReferences), - LoanChange, - PrefetchHooks Function({bool loanId}) - >; -typedef $$TransactionTemplatesTableCreateCompanionBuilder = - TransactionTemplatesCompanion Function({ - Value id, - required String name, - required double amount, - required bool recurring, - Value expenseCategoryId, - required int beneficiaryId, - required int accountId, - }); -typedef $$TransactionTemplatesTableUpdateCompanionBuilder = - TransactionTemplatesCompanion Function({ - Value id, - Value name, - Value amount, - Value recurring, - Value expenseCategoryId, - Value beneficiaryId, - Value accountId, - }); +typedef $$LoanChangesTableProcessedTableManager = ProcessedTableManager< + _$OkaneDatabase, + $LoanChangesTable, + LoanChange, + $$LoanChangesTableFilterComposer, + $$LoanChangesTableOrderingComposer, + $$LoanChangesTableAnnotationComposer, + $$LoanChangesTableCreateCompanionBuilder, + $$LoanChangesTableUpdateCompanionBuilder, + (LoanChange, $$LoanChangesTableReferences), + LoanChange, + PrefetchHooks Function({bool loanId})>; +typedef $$TransactionTemplatesTableCreateCompanionBuilder + = TransactionTemplatesCompanion Function({ + Value id, + required String name, + required double amount, + required bool recurring, + Value expenseCategoryId, + required int beneficiaryId, + required int accountId, +}); +typedef $$TransactionTemplatesTableUpdateCompanionBuilder + = TransactionTemplatesCompanion Function({ + Value id, + Value name, + Value amount, + Value recurring, + Value expenseCategoryId, + Value beneficiaryId, + Value accountId, +}); -final class $$TransactionTemplatesTableReferences - extends - BaseReferences< - _$OkaneDatabase, - $TransactionTemplatesTable, - TransactionTemplate - > { +final class $$TransactionTemplatesTableReferences extends BaseReferences< + _$OkaneDatabase, $TransactionTemplatesTable, TransactionTemplate> { $$TransactionTemplatesTableReferences( - super.$_db, - super.$_table, - super.$_typedResult, - ); + super.$_db, super.$_table, super.$_typedResult); static $ExpenseCategoriesTable _expenseCategoryIdTable(_$OkaneDatabase db) => - db.expenseCategories.createAlias( - $_aliasNameGenerator( - db.transactionTemplates.expenseCategoryId, - db.expenseCategories.id, - ), - ); + db.expenseCategories.createAlias($_aliasNameGenerator( + db.transactionTemplates.expenseCategoryId, db.expenseCategories.id)); $$ExpenseCategoriesTableProcessedTableManager? get expenseCategoryId { final $_column = $_itemColumn('expense_category_id'); if ($_column == null) return null; - final manager = $$ExpenseCategoriesTableTableManager( - $_db, - $_db.expenseCategories, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = + $$ExpenseCategoriesTableTableManager($_db, $_db.expenseCategories) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_expenseCategoryIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } static $BeneficiariesTable _beneficiaryIdTable(_$OkaneDatabase db) => - db.beneficiaries.createAlias( - $_aliasNameGenerator( - db.transactionTemplates.beneficiaryId, - db.beneficiaries.id, - ), - ); + db.beneficiaries.createAlias($_aliasNameGenerator( + db.transactionTemplates.beneficiaryId, db.beneficiaries.id)); $$BeneficiariesTableProcessedTableManager get beneficiaryId { final $_column = $_itemColumn('beneficiary_id')!; - final manager = $$BeneficiariesTableTableManager( - $_db, - $_db.beneficiaries, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = $$BeneficiariesTableTableManager($_db, $_db.beneficiaries) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_beneficiaryIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } static $AccountsTable _accountIdTable(_$OkaneDatabase db) => - db.accounts.createAlias( - $_aliasNameGenerator(db.transactionTemplates.accountId, db.accounts.id), - ); + db.accounts.createAlias($_aliasNameGenerator( + db.transactionTemplates.accountId, db.accounts.id)); $$AccountsTableProcessedTableManager get accountId { final $_column = $_itemColumn('account_id')!; - final manager = $$AccountsTableTableManager( - $_db, - $_db.accounts, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = $$AccountsTableTableManager($_db, $_db.accounts) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_accountIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } - static MultiTypedResultKey< - $RecurringTransactionsTable, - List - > - _recurringTransactionsRefsTable(_$OkaneDatabase db) => - MultiTypedResultKey.fromTable( - db.recurringTransactions, - aliasName: $_aliasNameGenerator( - db.transactionTemplates.id, - db.recurringTransactions.templateId, - ), - ); + static MultiTypedResultKey<$RecurringTransactionsTable, + List> _recurringTransactionsRefsTable( + _$OkaneDatabase db) => + MultiTypedResultKey.fromTable(db.recurringTransactions, + aliasName: $_aliasNameGenerator( + db.transactionTemplates.id, db.recurringTransactions.templateId)); $$RecurringTransactionsTableProcessedTableManager - get recurringTransactionsRefs { + get recurringTransactionsRefs { final manager = $$RecurringTransactionsTableTableManager( - $_db, - $_db.recurringTransactions, - ).filter((f) => f.templateId.id.sqlEquals($_itemColumn('id')!)); + $_db, $_db.recurringTransactions) + .filter((f) => f.templateId.id.sqlEquals($_itemColumn('id')!)); - final cache = $_typedResult.readTableOrNull( - _recurringTransactionsRefsTable($_db), - ); + final cache = + $_typedResult.readTableOrNull(_recurringTransactionsRefsTable($_db)); return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: cache), - ); + manager.$state.copyWith(prefetchedData: cache)); } } @@ -6649,117 +5580,97 @@ class $$TransactionTemplatesTableFilterComposer super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnFilters(column), - ); + column: $table.id, builder: (column) => ColumnFilters(column)); ColumnFilters get name => $composableBuilder( - column: $table.name, - builder: (column) => ColumnFilters(column), - ); + column: $table.name, builder: (column) => ColumnFilters(column)); ColumnFilters get amount => $composableBuilder( - column: $table.amount, - builder: (column) => ColumnFilters(column), - ); + column: $table.amount, builder: (column) => ColumnFilters(column)); ColumnFilters get recurring => $composableBuilder( - column: $table.recurring, - builder: (column) => ColumnFilters(column), - ); + column: $table.recurring, builder: (column) => ColumnFilters(column)); $$ExpenseCategoriesTableFilterComposer get expenseCategoryId { final $$ExpenseCategoriesTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.expenseCategoryId, - referencedTable: $db.expenseCategories, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$ExpenseCategoriesTableFilterComposer( - $db: $db, - $table: $db.expenseCategories, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.expenseCategoryId, + referencedTable: $db.expenseCategories, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$ExpenseCategoriesTableFilterComposer( + $db: $db, + $table: $db.expenseCategories, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$BeneficiariesTableFilterComposer get beneficiaryId { final $$BeneficiariesTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.beneficiaryId, - referencedTable: $db.beneficiaries, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BeneficiariesTableFilterComposer( - $db: $db, - $table: $db.beneficiaries, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.beneficiaryId, + referencedTable: $db.beneficiaries, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BeneficiariesTableFilterComposer( + $db: $db, + $table: $db.beneficiaries, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$AccountsTableFilterComposer get accountId { final $$AccountsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableFilterComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableFilterComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } Expression recurringTransactionsRefs( - Expression Function($$RecurringTransactionsTableFilterComposer f) f, - ) { + Expression Function($$RecurringTransactionsTableFilterComposer f) + f) { final $$RecurringTransactionsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.recurringTransactions, - getReferencedColumn: (t) => t.templateId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$RecurringTransactionsTableFilterComposer( - $db: $db, - $table: $db.recurringTransactions, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.recurringTransactions, + getReferencedColumn: (t) => t.templateId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$RecurringTransactionsTableFilterComposer( + $db: $db, + $table: $db.recurringTransactions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } } @@ -6774,91 +5685,74 @@ class $$TransactionTemplatesTableOrderingComposer super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnOrderings(column), - ); + column: $table.id, builder: (column) => ColumnOrderings(column)); ColumnOrderings get name => $composableBuilder( - column: $table.name, - builder: (column) => ColumnOrderings(column), - ); + column: $table.name, builder: (column) => ColumnOrderings(column)); ColumnOrderings get amount => $composableBuilder( - column: $table.amount, - builder: (column) => ColumnOrderings(column), - ); + column: $table.amount, builder: (column) => ColumnOrderings(column)); ColumnOrderings get recurring => $composableBuilder( - column: $table.recurring, - builder: (column) => ColumnOrderings(column), - ); + column: $table.recurring, builder: (column) => ColumnOrderings(column)); $$ExpenseCategoriesTableOrderingComposer get expenseCategoryId { final $$ExpenseCategoriesTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.expenseCategoryId, - referencedTable: $db.expenseCategories, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$ExpenseCategoriesTableOrderingComposer( - $db: $db, - $table: $db.expenseCategories, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.expenseCategoryId, + referencedTable: $db.expenseCategories, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$ExpenseCategoriesTableOrderingComposer( + $db: $db, + $table: $db.expenseCategories, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$BeneficiariesTableOrderingComposer get beneficiaryId { final $$BeneficiariesTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.beneficiaryId, - referencedTable: $db.beneficiaries, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BeneficiariesTableOrderingComposer( - $db: $db, - $table: $db.beneficiaries, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.beneficiaryId, + referencedTable: $db.beneficiaries, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BeneficiariesTableOrderingComposer( + $db: $db, + $table: $db.beneficiaries, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$AccountsTableOrderingComposer get accountId { final $$AccountsTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableOrderingComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableOrderingComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } @@ -6887,258 +5781,214 @@ class $$TransactionTemplatesTableAnnotationComposer $$ExpenseCategoriesTableAnnotationComposer get expenseCategoryId { final $$ExpenseCategoriesTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.expenseCategoryId, - referencedTable: $db.expenseCategories, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$ExpenseCategoriesTableAnnotationComposer( - $db: $db, - $table: $db.expenseCategories, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.expenseCategoryId, + referencedTable: $db.expenseCategories, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$ExpenseCategoriesTableAnnotationComposer( + $db: $db, + $table: $db.expenseCategories, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$BeneficiariesTableAnnotationComposer get beneficiaryId { final $$BeneficiariesTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.beneficiaryId, - referencedTable: $db.beneficiaries, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BeneficiariesTableAnnotationComposer( - $db: $db, - $table: $db.beneficiaries, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.beneficiaryId, + referencedTable: $db.beneficiaries, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BeneficiariesTableAnnotationComposer( + $db: $db, + $table: $db.beneficiaries, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$AccountsTableAnnotationComposer get accountId { final $$AccountsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableAnnotationComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableAnnotationComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } Expression recurringTransactionsRefs( - Expression Function($$RecurringTransactionsTableAnnotationComposer a) f, - ) { + Expression Function($$RecurringTransactionsTableAnnotationComposer a) + f) { final $$RecurringTransactionsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.id, - referencedTable: $db.recurringTransactions, - getReferencedColumn: (t) => t.templateId, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$RecurringTransactionsTableAnnotationComposer( - $db: $db, - $table: $db.recurringTransactions, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.id, + referencedTable: $db.recurringTransactions, + getReferencedColumn: (t) => t.templateId, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$RecurringTransactionsTableAnnotationComposer( + $db: $db, + $table: $db.recurringTransactions, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return f(composer); } } -class $$TransactionTemplatesTableTableManager - extends - RootTableManager< - _$OkaneDatabase, - $TransactionTemplatesTable, - TransactionTemplate, - $$TransactionTemplatesTableFilterComposer, - $$TransactionTemplatesTableOrderingComposer, - $$TransactionTemplatesTableAnnotationComposer, - $$TransactionTemplatesTableCreateCompanionBuilder, - $$TransactionTemplatesTableUpdateCompanionBuilder, - (TransactionTemplate, $$TransactionTemplatesTableReferences), - TransactionTemplate, - PrefetchHooks Function({ - bool expenseCategoryId, - bool beneficiaryId, - bool accountId, - bool recurringTransactionsRefs, - }) - > { +class $$TransactionTemplatesTableTableManager extends RootTableManager< + _$OkaneDatabase, + $TransactionTemplatesTable, + TransactionTemplate, + $$TransactionTemplatesTableFilterComposer, + $$TransactionTemplatesTableOrderingComposer, + $$TransactionTemplatesTableAnnotationComposer, + $$TransactionTemplatesTableCreateCompanionBuilder, + $$TransactionTemplatesTableUpdateCompanionBuilder, + (TransactionTemplate, $$TransactionTemplatesTableReferences), + TransactionTemplate, + PrefetchHooks Function( + {bool expenseCategoryId, + bool beneficiaryId, + bool accountId, + bool recurringTransactionsRefs})> { $$TransactionTemplatesTableTableManager( - _$OkaneDatabase db, - $TransactionTemplatesTable table, - ) : super( - TableManagerState( + _$OkaneDatabase db, $TransactionTemplatesTable table) + : super(TableManagerState( db: db, table: table, - createFilteringComposer: - () => $$TransactionTemplatesTableFilterComposer( - $db: db, - $table: table, - ), - createOrderingComposer: - () => $$TransactionTemplatesTableOrderingComposer( - $db: db, - $table: table, - ), - createComputedFieldComposer: - () => $$TransactionTemplatesTableAnnotationComposer( - $db: db, - $table: table, - ), - updateCompanionCallback: - ({ - Value id = const Value.absent(), - Value name = const Value.absent(), - Value amount = const Value.absent(), - Value recurring = const Value.absent(), - Value expenseCategoryId = const Value.absent(), - Value beneficiaryId = const Value.absent(), - Value accountId = const Value.absent(), - }) => TransactionTemplatesCompanion( - id: id, - name: name, - amount: amount, - recurring: recurring, - expenseCategoryId: expenseCategoryId, - beneficiaryId: beneficiaryId, - accountId: accountId, - ), - createCompanionCallback: - ({ - Value id = const Value.absent(), - required String name, - required double amount, - required bool recurring, - Value expenseCategoryId = const Value.absent(), - required int beneficiaryId, - required int accountId, - }) => TransactionTemplatesCompanion.insert( - id: id, - name: name, - amount: amount, - recurring: recurring, - expenseCategoryId: expenseCategoryId, - beneficiaryId: beneficiaryId, - accountId: accountId, - ), - withReferenceMapper: - (p0) => - p0 - .map( - (e) => ( - e.readTable(table), - $$TransactionTemplatesTableReferences(db, table, e), - ), - ) - .toList(), - prefetchHooksCallback: ({ - expenseCategoryId = false, - beneficiaryId = false, - accountId = false, - recurringTransactionsRefs = false, - }) { + createFilteringComposer: () => + $$TransactionTemplatesTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$TransactionTemplatesTableOrderingComposer( + $db: db, $table: table), + createComputedFieldComposer: () => + $$TransactionTemplatesTableAnnotationComposer( + $db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value name = const Value.absent(), + Value amount = const Value.absent(), + Value recurring = const Value.absent(), + Value expenseCategoryId = const Value.absent(), + Value beneficiaryId = const Value.absent(), + Value accountId = const Value.absent(), + }) => + TransactionTemplatesCompanion( + id: id, + name: name, + amount: amount, + recurring: recurring, + expenseCategoryId: expenseCategoryId, + beneficiaryId: beneficiaryId, + accountId: accountId, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required String name, + required double amount, + required bool recurring, + Value expenseCategoryId = const Value.absent(), + required int beneficiaryId, + required int accountId, + }) => + TransactionTemplatesCompanion.insert( + id: id, + name: name, + amount: amount, + recurring: recurring, + expenseCategoryId: expenseCategoryId, + beneficiaryId: beneficiaryId, + accountId: accountId, + ), + withReferenceMapper: (p0) => p0 + .map((e) => ( + e.readTable(table), + $$TransactionTemplatesTableReferences(db, table, e) + )) + .toList(), + prefetchHooksCallback: ( + {expenseCategoryId = false, + beneficiaryId = false, + accountId = false, + recurringTransactionsRefs = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [ - if (recurringTransactionsRefs) db.recurringTransactions, + if (recurringTransactionsRefs) db.recurringTransactions ], addJoins: < - T extends TableManagerState< - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic - > - >(state) { + T extends TableManagerState< + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic>>(state) { if (expenseCategoryId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.expenseCategoryId, - referencedTable: - $$TransactionTemplatesTableReferences - ._expenseCategoryIdTable(db), - referencedColumn: - $$TransactionTemplatesTableReferences - ._expenseCategoryIdTable(db) - .id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.expenseCategoryId, + referencedTable: $$TransactionTemplatesTableReferences + ._expenseCategoryIdTable(db), + referencedColumn: $$TransactionTemplatesTableReferences + ._expenseCategoryIdTable(db) + .id, + ) as T; } if (beneficiaryId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.beneficiaryId, - referencedTable: - $$TransactionTemplatesTableReferences - ._beneficiaryIdTable(db), - referencedColumn: - $$TransactionTemplatesTableReferences - ._beneficiaryIdTable(db) - .id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.beneficiaryId, + referencedTable: $$TransactionTemplatesTableReferences + ._beneficiaryIdTable(db), + referencedColumn: $$TransactionTemplatesTableReferences + ._beneficiaryIdTable(db) + .id, + ) as T; } if (accountId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.accountId, - referencedTable: - $$TransactionTemplatesTableReferences - ._accountIdTable(db), - referencedColumn: - $$TransactionTemplatesTableReferences - ._accountIdTable(db) - .id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.accountId, + referencedTable: $$TransactionTemplatesTableReferences + ._accountIdTable(db), + referencedColumn: $$TransactionTemplatesTableReferences + ._accountIdTable(db) + .id, + ) as T; } return state; @@ -7146,126 +5996,93 @@ class $$TransactionTemplatesTableTableManager getPrefetchedDataCallback: (items) async { return [ if (recurringTransactionsRefs) - await $_getPrefetchedData< - TransactionTemplate, - $TransactionTemplatesTable, - RecurringTransaction - >( - currentTable: table, - referencedTable: $$TransactionTemplatesTableReferences - ._recurringTransactionsRefsTable(db), - managerFromTypedResult: - (p0) => - $$TransactionTemplatesTableReferences( - db, - table, - p0, - ).recurringTransactionsRefs, - referencedItemsForCurrentItem: - (item, referencedItems) => referencedItems.where( - (e) => e.templateId == item.id, - ), - typedResults: items, - ), + await $_getPrefetchedData( + currentTable: table, + referencedTable: $$TransactionTemplatesTableReferences + ._recurringTransactionsRefsTable(db), + managerFromTypedResult: (p0) => + $$TransactionTemplatesTableReferences(db, table, p0) + .recurringTransactionsRefs, + referencedItemsForCurrentItem: + (item, referencedItems) => referencedItems + .where((e) => e.templateId == item.id), + typedResults: items) ]; }, ); }, - ), - ); + )); } -typedef $$TransactionTemplatesTableProcessedTableManager = - ProcessedTableManager< - _$OkaneDatabase, - $TransactionTemplatesTable, - TransactionTemplate, - $$TransactionTemplatesTableFilterComposer, - $$TransactionTemplatesTableOrderingComposer, - $$TransactionTemplatesTableAnnotationComposer, - $$TransactionTemplatesTableCreateCompanionBuilder, - $$TransactionTemplatesTableUpdateCompanionBuilder, - (TransactionTemplate, $$TransactionTemplatesTableReferences), - TransactionTemplate, - PrefetchHooks Function({ - bool expenseCategoryId, - bool beneficiaryId, - bool accountId, - bool recurringTransactionsRefs, - }) - >; -typedef $$RecurringTransactionsTableCreateCompanionBuilder = - RecurringTransactionsCompanion Function({ - Value id, - required int days, - Value lastExecution, - required int templateId, - required int accountId, - }); -typedef $$RecurringTransactionsTableUpdateCompanionBuilder = - RecurringTransactionsCompanion Function({ - Value id, - Value days, - Value lastExecution, - Value templateId, - Value accountId, - }); +typedef $$TransactionTemplatesTableProcessedTableManager + = ProcessedTableManager< + _$OkaneDatabase, + $TransactionTemplatesTable, + TransactionTemplate, + $$TransactionTemplatesTableFilterComposer, + $$TransactionTemplatesTableOrderingComposer, + $$TransactionTemplatesTableAnnotationComposer, + $$TransactionTemplatesTableCreateCompanionBuilder, + $$TransactionTemplatesTableUpdateCompanionBuilder, + (TransactionTemplate, $$TransactionTemplatesTableReferences), + TransactionTemplate, + PrefetchHooks Function( + {bool expenseCategoryId, + bool beneficiaryId, + bool accountId, + bool recurringTransactionsRefs})>; +typedef $$RecurringTransactionsTableCreateCompanionBuilder + = RecurringTransactionsCompanion Function({ + Value id, + required int days, + Value lastExecution, + required int templateId, + required int accountId, +}); +typedef $$RecurringTransactionsTableUpdateCompanionBuilder + = RecurringTransactionsCompanion Function({ + Value id, + Value days, + Value lastExecution, + Value templateId, + Value accountId, +}); -final class $$RecurringTransactionsTableReferences - extends - BaseReferences< - _$OkaneDatabase, - $RecurringTransactionsTable, - RecurringTransaction - > { +final class $$RecurringTransactionsTableReferences extends BaseReferences< + _$OkaneDatabase, $RecurringTransactionsTable, RecurringTransaction> { $$RecurringTransactionsTableReferences( - super.$_db, - super.$_table, - super.$_typedResult, - ); + super.$_db, super.$_table, super.$_typedResult); static $TransactionTemplatesTable _templateIdTable(_$OkaneDatabase db) => - db.transactionTemplates.createAlias( - $_aliasNameGenerator( - db.recurringTransactions.templateId, - db.transactionTemplates.id, - ), - ); + db.transactionTemplates.createAlias($_aliasNameGenerator( + db.recurringTransactions.templateId, db.transactionTemplates.id)); $$TransactionTemplatesTableProcessedTableManager get templateId { final $_column = $_itemColumn('template_id')!; - final manager = $$TransactionTemplatesTableTableManager( - $_db, - $_db.transactionTemplates, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = + $$TransactionTemplatesTableTableManager($_db, $_db.transactionTemplates) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_templateIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } static $AccountsTable _accountIdTable(_$OkaneDatabase db) => - db.accounts.createAlias( - $_aliasNameGenerator( - db.recurringTransactions.accountId, - db.accounts.id, - ), - ); + db.accounts.createAlias($_aliasNameGenerator( + db.recurringTransactions.accountId, db.accounts.id)); $$AccountsTableProcessedTableManager get accountId { final $_column = $_itemColumn('account_id')!; - final manager = $$AccountsTableTableManager( - $_db, - $_db.accounts, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = $$AccountsTableTableManager($_db, $_db.accounts) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_accountIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } } @@ -7279,63 +6096,51 @@ class $$RecurringTransactionsTableFilterComposer super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnFilters(column), - ); + column: $table.id, builder: (column) => ColumnFilters(column)); ColumnFilters get days => $composableBuilder( - column: $table.days, - builder: (column) => ColumnFilters(column), - ); + column: $table.days, builder: (column) => ColumnFilters(column)); ColumnFilters get lastExecution => $composableBuilder( - column: $table.lastExecution, - builder: (column) => ColumnFilters(column), - ); + column: $table.lastExecution, builder: (column) => ColumnFilters(column)); $$TransactionTemplatesTableFilterComposer get templateId { final $$TransactionTemplatesTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.templateId, - referencedTable: $db.transactionTemplates, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionTemplatesTableFilterComposer( - $db: $db, - $table: $db.transactionTemplates, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.templateId, + referencedTable: $db.transactionTemplates, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionTemplatesTableFilterComposer( + $db: $db, + $table: $db.transactionTemplates, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$AccountsTableFilterComposer get accountId { final $$AccountsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableFilterComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableFilterComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } @@ -7350,64 +6155,53 @@ class $$RecurringTransactionsTableOrderingComposer super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnOrderings(column), - ); + column: $table.id, builder: (column) => ColumnOrderings(column)); ColumnOrderings get days => $composableBuilder( - column: $table.days, - builder: (column) => ColumnOrderings(column), - ); + column: $table.days, builder: (column) => ColumnOrderings(column)); ColumnOrderings get lastExecution => $composableBuilder( - column: $table.lastExecution, - builder: (column) => ColumnOrderings(column), - ); + column: $table.lastExecution, + builder: (column) => ColumnOrderings(column)); $$TransactionTemplatesTableOrderingComposer get templateId { final $$TransactionTemplatesTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.templateId, - referencedTable: $db.transactionTemplates, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionTemplatesTableOrderingComposer( - $db: $db, - $table: $db.transactionTemplates, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.templateId, + referencedTable: $db.transactionTemplates, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionTemplatesTableOrderingComposer( + $db: $db, + $table: $db.transactionTemplates, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$AccountsTableOrderingComposer get accountId { final $$AccountsTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableOrderingComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableOrderingComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } @@ -7428,181 +6222,148 @@ class $$RecurringTransactionsTableAnnotationComposer $composableBuilder(column: $table.days, builder: (column) => column); GeneratedColumn get lastExecution => $composableBuilder( - column: $table.lastExecution, - builder: (column) => column, - ); + column: $table.lastExecution, builder: (column) => column); $$TransactionTemplatesTableAnnotationComposer get templateId { final $$TransactionTemplatesTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.templateId, - referencedTable: $db.transactionTemplates, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$TransactionTemplatesTableAnnotationComposer( - $db: $db, - $table: $db.transactionTemplates, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.templateId, + referencedTable: $db.transactionTemplates, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$TransactionTemplatesTableAnnotationComposer( + $db: $db, + $table: $db.transactionTemplates, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$AccountsTableAnnotationComposer get accountId { final $$AccountsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableAnnotationComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableAnnotationComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } -class $$RecurringTransactionsTableTableManager - extends - RootTableManager< - _$OkaneDatabase, - $RecurringTransactionsTable, - RecurringTransaction, - $$RecurringTransactionsTableFilterComposer, - $$RecurringTransactionsTableOrderingComposer, - $$RecurringTransactionsTableAnnotationComposer, - $$RecurringTransactionsTableCreateCompanionBuilder, - $$RecurringTransactionsTableUpdateCompanionBuilder, - (RecurringTransaction, $$RecurringTransactionsTableReferences), - RecurringTransaction, - PrefetchHooks Function({bool templateId, bool accountId}) - > { +class $$RecurringTransactionsTableTableManager extends RootTableManager< + _$OkaneDatabase, + $RecurringTransactionsTable, + RecurringTransaction, + $$RecurringTransactionsTableFilterComposer, + $$RecurringTransactionsTableOrderingComposer, + $$RecurringTransactionsTableAnnotationComposer, + $$RecurringTransactionsTableCreateCompanionBuilder, + $$RecurringTransactionsTableUpdateCompanionBuilder, + (RecurringTransaction, $$RecurringTransactionsTableReferences), + RecurringTransaction, + PrefetchHooks Function({bool templateId, bool accountId})> { $$RecurringTransactionsTableTableManager( - _$OkaneDatabase db, - $RecurringTransactionsTable table, - ) : super( - TableManagerState( + _$OkaneDatabase db, $RecurringTransactionsTable table) + : super(TableManagerState( db: db, table: table, - createFilteringComposer: - () => $$RecurringTransactionsTableFilterComposer( - $db: db, - $table: table, - ), - createOrderingComposer: - () => $$RecurringTransactionsTableOrderingComposer( - $db: db, - $table: table, - ), - createComputedFieldComposer: - () => $$RecurringTransactionsTableAnnotationComposer( - $db: db, - $table: table, - ), - updateCompanionCallback: - ({ - Value id = const Value.absent(), - Value days = const Value.absent(), - Value lastExecution = const Value.absent(), - Value templateId = const Value.absent(), - Value accountId = const Value.absent(), - }) => RecurringTransactionsCompanion( - id: id, - days: days, - lastExecution: lastExecution, - templateId: templateId, - accountId: accountId, - ), - createCompanionCallback: - ({ - Value id = const Value.absent(), - required int days, - Value lastExecution = const Value.absent(), - required int templateId, - required int accountId, - }) => RecurringTransactionsCompanion.insert( - id: id, - days: days, - lastExecution: lastExecution, - templateId: templateId, - accountId: accountId, - ), - withReferenceMapper: - (p0) => - p0 - .map( - (e) => ( - e.readTable(table), - $$RecurringTransactionsTableReferences(db, table, e), - ), - ) - .toList(), + createFilteringComposer: () => + $$RecurringTransactionsTableFilterComposer( + $db: db, $table: table), + createOrderingComposer: () => + $$RecurringTransactionsTableOrderingComposer( + $db: db, $table: table), + createComputedFieldComposer: () => + $$RecurringTransactionsTableAnnotationComposer( + $db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value days = const Value.absent(), + Value lastExecution = const Value.absent(), + Value templateId = const Value.absent(), + Value accountId = const Value.absent(), + }) => + RecurringTransactionsCompanion( + id: id, + days: days, + lastExecution: lastExecution, + templateId: templateId, + accountId: accountId, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required int days, + Value lastExecution = const Value.absent(), + required int templateId, + required int accountId, + }) => + RecurringTransactionsCompanion.insert( + id: id, + days: days, + lastExecution: lastExecution, + templateId: templateId, + accountId: accountId, + ), + withReferenceMapper: (p0) => p0 + .map((e) => ( + e.readTable(table), + $$RecurringTransactionsTableReferences(db, table, e) + )) + .toList(), prefetchHooksCallback: ({templateId = false, accountId = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [], addJoins: < - T extends TableManagerState< - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic - > - >(state) { + T extends TableManagerState< + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic>>(state) { if (templateId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.templateId, - referencedTable: - $$RecurringTransactionsTableReferences - ._templateIdTable(db), - referencedColumn: - $$RecurringTransactionsTableReferences - ._templateIdTable(db) - .id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.templateId, + referencedTable: $$RecurringTransactionsTableReferences + ._templateIdTable(db), + referencedColumn: $$RecurringTransactionsTableReferences + ._templateIdTable(db) + .id, + ) as T; } if (accountId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.accountId, - referencedTable: - $$RecurringTransactionsTableReferences - ._accountIdTable(db), - referencedColumn: - $$RecurringTransactionsTableReferences - ._accountIdTable(db) - .id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.accountId, + referencedTable: $$RecurringTransactionsTableReferences + ._accountIdTable(db), + referencedColumn: $$RecurringTransactionsTableReferences + ._accountIdTable(db) + .id, + ) as T; } return state; @@ -7612,108 +6373,89 @@ class $$RecurringTransactionsTableTableManager }, ); }, - ), - ); + )); } -typedef $$RecurringTransactionsTableProcessedTableManager = - ProcessedTableManager< - _$OkaneDatabase, - $RecurringTransactionsTable, - RecurringTransaction, - $$RecurringTransactionsTableFilterComposer, - $$RecurringTransactionsTableOrderingComposer, - $$RecurringTransactionsTableAnnotationComposer, - $$RecurringTransactionsTableCreateCompanionBuilder, - $$RecurringTransactionsTableUpdateCompanionBuilder, - (RecurringTransaction, $$RecurringTransactionsTableReferences), - RecurringTransaction, - PrefetchHooks Function({bool templateId, bool accountId}) - >; -typedef $$TransactionsTableCreateCompanionBuilder = - TransactionsCompanion Function({ - Value id, - required double amount, - required DateTime date, - Value expenseCategoryId, - required int accountId, - required int beneficiaryId, - }); -typedef $$TransactionsTableUpdateCompanionBuilder = - TransactionsCompanion Function({ - Value id, - Value amount, - Value date, - Value expenseCategoryId, - Value accountId, - Value beneficiaryId, - }); +typedef $$RecurringTransactionsTableProcessedTableManager + = ProcessedTableManager< + _$OkaneDatabase, + $RecurringTransactionsTable, + RecurringTransaction, + $$RecurringTransactionsTableFilterComposer, + $$RecurringTransactionsTableOrderingComposer, + $$RecurringTransactionsTableAnnotationComposer, + $$RecurringTransactionsTableCreateCompanionBuilder, + $$RecurringTransactionsTableUpdateCompanionBuilder, + (RecurringTransaction, $$RecurringTransactionsTableReferences), + RecurringTransaction, + PrefetchHooks Function({bool templateId, bool accountId})>; +typedef $$TransactionsTableCreateCompanionBuilder = TransactionsCompanion + Function({ + Value id, + required double amount, + required DateTime date, + Value expenseCategoryId, + required int accountId, + required int beneficiaryId, +}); +typedef $$TransactionsTableUpdateCompanionBuilder = TransactionsCompanion + Function({ + Value id, + Value amount, + Value date, + Value expenseCategoryId, + Value accountId, + Value beneficiaryId, +}); final class $$TransactionsTableReferences extends BaseReferences<_$OkaneDatabase, $TransactionsTable, Transaction> { $$TransactionsTableReferences(super.$_db, super.$_table, super.$_typedResult); static $ExpenseCategoriesTable _expenseCategoryIdTable(_$OkaneDatabase db) => - db.expenseCategories.createAlias( - $_aliasNameGenerator( - db.transactions.expenseCategoryId, - db.expenseCategories.id, - ), - ); + db.expenseCategories.createAlias($_aliasNameGenerator( + db.transactions.expenseCategoryId, db.expenseCategories.id)); $$ExpenseCategoriesTableProcessedTableManager? get expenseCategoryId { final $_column = $_itemColumn('expense_category_id'); if ($_column == null) return null; - final manager = $$ExpenseCategoriesTableTableManager( - $_db, - $_db.expenseCategories, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = + $$ExpenseCategoriesTableTableManager($_db, $_db.expenseCategories) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_expenseCategoryIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } static $AccountsTable _accountIdTable(_$OkaneDatabase db) => db.accounts.createAlias( - $_aliasNameGenerator(db.transactions.accountId, db.accounts.id), - ); + $_aliasNameGenerator(db.transactions.accountId, db.accounts.id)); $$AccountsTableProcessedTableManager get accountId { final $_column = $_itemColumn('account_id')!; - final manager = $$AccountsTableTableManager( - $_db, - $_db.accounts, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = $$AccountsTableTableManager($_db, $_db.accounts) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_accountIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } static $BeneficiariesTable _beneficiaryIdTable(_$OkaneDatabase db) => - db.beneficiaries.createAlias( - $_aliasNameGenerator( - db.transactions.beneficiaryId, - db.beneficiaries.id, - ), - ); + db.beneficiaries.createAlias($_aliasNameGenerator( + db.transactions.beneficiaryId, db.beneficiaries.id)); $$BeneficiariesTableProcessedTableManager get beneficiaryId { final $_column = $_itemColumn('beneficiary_id')!; - final manager = $$BeneficiariesTableTableManager( - $_db, - $_db.beneficiaries, - ).filter((f) => f.id.sqlEquals($_column)); + final manager = $$BeneficiariesTableTableManager($_db, $_db.beneficiaries) + .filter((f) => f.id.sqlEquals($_column)); final item = $_typedResult.readTableOrNull(_beneficiaryIdTable($_db)); if (item == null) return manager; return ProcessedTableManager( - manager.$state.copyWith(prefetchedData: [item]), - ); + manager.$state.copyWith(prefetchedData: [item])); } } @@ -7727,86 +6469,71 @@ class $$TransactionsTableFilterComposer super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnFilters(column), - ); + column: $table.id, builder: (column) => ColumnFilters(column)); ColumnFilters get amount => $composableBuilder( - column: $table.amount, - builder: (column) => ColumnFilters(column), - ); + column: $table.amount, builder: (column) => ColumnFilters(column)); ColumnFilters get date => $composableBuilder( - column: $table.date, - builder: (column) => ColumnFilters(column), - ); + column: $table.date, builder: (column) => ColumnFilters(column)); $$ExpenseCategoriesTableFilterComposer get expenseCategoryId { final $$ExpenseCategoriesTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.expenseCategoryId, - referencedTable: $db.expenseCategories, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$ExpenseCategoriesTableFilterComposer( - $db: $db, - $table: $db.expenseCategories, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.expenseCategoryId, + referencedTable: $db.expenseCategories, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$ExpenseCategoriesTableFilterComposer( + $db: $db, + $table: $db.expenseCategories, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$AccountsTableFilterComposer get accountId { final $$AccountsTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableFilterComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableFilterComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$BeneficiariesTableFilterComposer get beneficiaryId { final $$BeneficiariesTableFilterComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.beneficiaryId, - referencedTable: $db.beneficiaries, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BeneficiariesTableFilterComposer( - $db: $db, - $table: $db.beneficiaries, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.beneficiaryId, + referencedTable: $db.beneficiaries, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BeneficiariesTableFilterComposer( + $db: $db, + $table: $db.beneficiaries, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } @@ -7821,86 +6548,71 @@ class $$TransactionsTableOrderingComposer super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get id => $composableBuilder( - column: $table.id, - builder: (column) => ColumnOrderings(column), - ); + column: $table.id, builder: (column) => ColumnOrderings(column)); ColumnOrderings get amount => $composableBuilder( - column: $table.amount, - builder: (column) => ColumnOrderings(column), - ); + column: $table.amount, builder: (column) => ColumnOrderings(column)); ColumnOrderings get date => $composableBuilder( - column: $table.date, - builder: (column) => ColumnOrderings(column), - ); + column: $table.date, builder: (column) => ColumnOrderings(column)); $$ExpenseCategoriesTableOrderingComposer get expenseCategoryId { final $$ExpenseCategoriesTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.expenseCategoryId, - referencedTable: $db.expenseCategories, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$ExpenseCategoriesTableOrderingComposer( - $db: $db, - $table: $db.expenseCategories, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.expenseCategoryId, + referencedTable: $db.expenseCategories, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$ExpenseCategoriesTableOrderingComposer( + $db: $db, + $table: $db.expenseCategories, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$AccountsTableOrderingComposer get accountId { final $$AccountsTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableOrderingComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableOrderingComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$BeneficiariesTableOrderingComposer get beneficiaryId { final $$BeneficiariesTableOrderingComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.beneficiaryId, - referencedTable: $db.beneficiaries, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BeneficiariesTableOrderingComposer( - $db: $db, - $table: $db.beneficiaries, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.beneficiaryId, + referencedTable: $db.beneficiaries, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BeneficiariesTableOrderingComposer( + $db: $db, + $table: $db.beneficiaries, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } @@ -7926,211 +6638,177 @@ class $$TransactionsTableAnnotationComposer $$ExpenseCategoriesTableAnnotationComposer get expenseCategoryId { final $$ExpenseCategoriesTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.expenseCategoryId, - referencedTable: $db.expenseCategories, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$ExpenseCategoriesTableAnnotationComposer( - $db: $db, - $table: $db.expenseCategories, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.expenseCategoryId, + referencedTable: $db.expenseCategories, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$ExpenseCategoriesTableAnnotationComposer( + $db: $db, + $table: $db.expenseCategories, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$AccountsTableAnnotationComposer get accountId { final $$AccountsTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.accountId, - referencedTable: $db.accounts, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$AccountsTableAnnotationComposer( - $db: $db, - $table: $db.accounts, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.accountId, + referencedTable: $db.accounts, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$AccountsTableAnnotationComposer( + $db: $db, + $table: $db.accounts, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } $$BeneficiariesTableAnnotationComposer get beneficiaryId { final $$BeneficiariesTableAnnotationComposer composer = $composerBuilder( - composer: this, - getCurrentColumn: (t) => t.beneficiaryId, - referencedTable: $db.beneficiaries, - getReferencedColumn: (t) => t.id, - builder: - ( - joinBuilder, { - $addJoinBuilderToRootComposer, - $removeJoinBuilderFromRootComposer, - }) => $$BeneficiariesTableAnnotationComposer( - $db: $db, - $table: $db.beneficiaries, - $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, - joinBuilder: joinBuilder, - $removeJoinBuilderFromRootComposer: - $removeJoinBuilderFromRootComposer, - ), - ); + composer: this, + getCurrentColumn: (t) => t.beneficiaryId, + referencedTable: $db.beneficiaries, + getReferencedColumn: (t) => t.id, + builder: (joinBuilder, + {$addJoinBuilderToRootComposer, + $removeJoinBuilderFromRootComposer}) => + $$BeneficiariesTableAnnotationComposer( + $db: $db, + $table: $db.beneficiaries, + $addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer, + joinBuilder: joinBuilder, + $removeJoinBuilderFromRootComposer: + $removeJoinBuilderFromRootComposer, + )); return composer; } } -class $$TransactionsTableTableManager - extends - RootTableManager< - _$OkaneDatabase, - $TransactionsTable, - Transaction, - $$TransactionsTableFilterComposer, - $$TransactionsTableOrderingComposer, - $$TransactionsTableAnnotationComposer, - $$TransactionsTableCreateCompanionBuilder, - $$TransactionsTableUpdateCompanionBuilder, - (Transaction, $$TransactionsTableReferences), - Transaction, - PrefetchHooks Function({ - bool expenseCategoryId, - bool accountId, - bool beneficiaryId, - }) - > { +class $$TransactionsTableTableManager extends RootTableManager< + _$OkaneDatabase, + $TransactionsTable, + Transaction, + $$TransactionsTableFilterComposer, + $$TransactionsTableOrderingComposer, + $$TransactionsTableAnnotationComposer, + $$TransactionsTableCreateCompanionBuilder, + $$TransactionsTableUpdateCompanionBuilder, + (Transaction, $$TransactionsTableReferences), + Transaction, + PrefetchHooks Function( + {bool expenseCategoryId, bool accountId, bool beneficiaryId})> { $$TransactionsTableTableManager(_$OkaneDatabase db, $TransactionsTable table) - : super( - TableManagerState( + : super(TableManagerState( db: db, table: table, - createFilteringComposer: - () => $$TransactionsTableFilterComposer($db: db, $table: table), - createOrderingComposer: - () => $$TransactionsTableOrderingComposer($db: db, $table: table), - createComputedFieldComposer: - () => - $$TransactionsTableAnnotationComposer($db: db, $table: table), - updateCompanionCallback: - ({ - Value id = const Value.absent(), - Value amount = const Value.absent(), - Value date = const Value.absent(), - Value expenseCategoryId = const Value.absent(), - Value accountId = const Value.absent(), - Value beneficiaryId = const Value.absent(), - }) => TransactionsCompanion( - id: id, - amount: amount, - date: date, - expenseCategoryId: expenseCategoryId, - accountId: accountId, - beneficiaryId: beneficiaryId, - ), - createCompanionCallback: - ({ - Value id = const Value.absent(), - required double amount, - required DateTime date, - Value expenseCategoryId = const Value.absent(), - required int accountId, - required int beneficiaryId, - }) => TransactionsCompanion.insert( - id: id, - amount: amount, - date: date, - expenseCategoryId: expenseCategoryId, - accountId: accountId, - beneficiaryId: beneficiaryId, - ), - withReferenceMapper: - (p0) => - p0 - .map( - (e) => ( - e.readTable(table), - $$TransactionsTableReferences(db, table, e), - ), - ) - .toList(), - prefetchHooksCallback: ({ - expenseCategoryId = false, - accountId = false, - beneficiaryId = false, - }) { + createFilteringComposer: () => + $$TransactionsTableFilterComposer($db: db, $table: table), + createOrderingComposer: () => + $$TransactionsTableOrderingComposer($db: db, $table: table), + createComputedFieldComposer: () => + $$TransactionsTableAnnotationComposer($db: db, $table: table), + updateCompanionCallback: ({ + Value id = const Value.absent(), + Value amount = const Value.absent(), + Value date = const Value.absent(), + Value expenseCategoryId = const Value.absent(), + Value accountId = const Value.absent(), + Value beneficiaryId = const Value.absent(), + }) => + TransactionsCompanion( + id: id, + amount: amount, + date: date, + expenseCategoryId: expenseCategoryId, + accountId: accountId, + beneficiaryId: beneficiaryId, + ), + createCompanionCallback: ({ + Value id = const Value.absent(), + required double amount, + required DateTime date, + Value expenseCategoryId = const Value.absent(), + required int accountId, + required int beneficiaryId, + }) => + TransactionsCompanion.insert( + id: id, + amount: amount, + date: date, + expenseCategoryId: expenseCategoryId, + accountId: accountId, + beneficiaryId: beneficiaryId, + ), + withReferenceMapper: (p0) => p0 + .map((e) => ( + e.readTable(table), + $$TransactionsTableReferences(db, table, e) + )) + .toList(), + prefetchHooksCallback: ( + {expenseCategoryId = false, + accountId = false, + beneficiaryId = false}) { return PrefetchHooks( db: db, explicitlyWatchedTables: [], addJoins: < - T extends TableManagerState< - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic, - dynamic - > - >(state) { + T extends TableManagerState< + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic, + dynamic>>(state) { if (expenseCategoryId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.expenseCategoryId, - referencedTable: $$TransactionsTableReferences - ._expenseCategoryIdTable(db), - referencedColumn: - $$TransactionsTableReferences - ._expenseCategoryIdTable(db) - .id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.expenseCategoryId, + referencedTable: $$TransactionsTableReferences + ._expenseCategoryIdTable(db), + referencedColumn: $$TransactionsTableReferences + ._expenseCategoryIdTable(db) + .id, + ) as T; } if (accountId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.accountId, - referencedTable: $$TransactionsTableReferences - ._accountIdTable(db), - referencedColumn: - $$TransactionsTableReferences - ._accountIdTable(db) - .id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.accountId, + referencedTable: + $$TransactionsTableReferences._accountIdTable(db), + referencedColumn: + $$TransactionsTableReferences._accountIdTable(db).id, + ) as T; } if (beneficiaryId) { - state = - state.withJoin( - currentTable: table, - currentColumn: table.beneficiaryId, - referencedTable: $$TransactionsTableReferences - ._beneficiaryIdTable(db), - referencedColumn: - $$TransactionsTableReferences - ._beneficiaryIdTable(db) - .id, - ) - as T; + state = state.withJoin( + currentTable: table, + currentColumn: table.beneficiaryId, + referencedTable: + $$TransactionsTableReferences._beneficiaryIdTable(db), + referencedColumn: $$TransactionsTableReferences + ._beneficiaryIdTable(db) + .id, + ) as T; } return state; @@ -8140,28 +6818,22 @@ class $$TransactionsTableTableManager }, ); }, - ), - ); + )); } -typedef $$TransactionsTableProcessedTableManager = - ProcessedTableManager< - _$OkaneDatabase, - $TransactionsTable, - Transaction, - $$TransactionsTableFilterComposer, - $$TransactionsTableOrderingComposer, - $$TransactionsTableAnnotationComposer, - $$TransactionsTableCreateCompanionBuilder, - $$TransactionsTableUpdateCompanionBuilder, - (Transaction, $$TransactionsTableReferences), - Transaction, - PrefetchHooks Function({ - bool expenseCategoryId, - bool accountId, - bool beneficiaryId, - }) - >; +typedef $$TransactionsTableProcessedTableManager = ProcessedTableManager< + _$OkaneDatabase, + $TransactionsTable, + Transaction, + $$TransactionsTableFilterComposer, + $$TransactionsTableOrderingComposer, + $$TransactionsTableAnnotationComposer, + $$TransactionsTableCreateCompanionBuilder, + $$TransactionsTableUpdateCompanionBuilder, + (Transaction, $$TransactionsTableReferences), + Transaction, + PrefetchHooks Function( + {bool expenseCategoryId, bool accountId, bool beneficiaryId})>; class $OkaneDatabaseManager { final _$OkaneDatabase _db; diff --git a/lib/ui/pages/account/balance_graph_card.dart b/lib/ui/pages/account/balance_graph_card.dart index 73fb7c5..b0ac091 100644 --- a/lib/ui/pages/account/balance_graph_card.dart +++ b/lib/ui/pages/account/balance_graph_card.dart @@ -80,7 +80,6 @@ class AccountBalanceGraphCard extends StatelessWidget { child: FutureBuilder( future: getAccountBalance(), builder: (context, snapshot) { - print("SNAPSHOT: ${snapshot.data}"); if (!snapshot.hasData) { return CircularProgressIndicator(); } diff --git a/lib/ui/pages/budgets/add_budget_item.dart b/lib/ui/pages/budgets/add_budget_item.dart index 2fab2be..0c07b71 100644 --- a/lib/ui/pages/budgets/add_budget_item.dart +++ b/lib/ui/pages/budgets/add_budget_item.dart @@ -9,11 +9,13 @@ import 'package:okane/ui/widgets/add_expense_category.dart'; class AddBudgetItemPopup extends StatefulWidget { final VoidCallback onDone; final BudgetsDto budget; + final List items; const AddBudgetItemPopup({ super.key, required this.onDone, required this.budget, + required this.items, }); @override @@ -72,7 +74,7 @@ class AddBudgetItemState extends State { _expenseCategory == null) { return; } - if (widget.budget.budgetItems + if (widget.items .where( (i) => i.expenseCategory.name == _expenseCategory!.name, @@ -84,10 +86,11 @@ class AddBudgetItemState extends State { await GetIt.I.get().budgetsDao.upsertBudgetItem( BudgetItemsCompanion( - expenseCategoryId: Value(_expenseCategory!.id), amount: Value( double.parse(_budgetItemAmountEditController.text), ), + expenseCategoryId: Value(_expenseCategory!.id), + budgetId: Value(widget.budget.budget.id), ), ); widget.onDone(); diff --git a/lib/ui/pages/budgets/budget_details.dart b/lib/ui/pages/budgets/budget_details.dart index cb58a6d..e99393a 100644 --- a/lib/ui/pages/budgets/budget_details.dart +++ b/lib/ui/pages/budgets/budget_details.dart @@ -22,6 +22,7 @@ class BudgetDetailsPage extends StatelessWidget { builder: (_) => AddBudgetItemPopup( budget: state.activeBudget!, + items: state.budgetItems, onDone: () { Navigator.of(context).pop(); }, @@ -55,7 +56,7 @@ class BudgetDetailsPage extends StatelessWidget { return Text(t.pages.budgets.details.noBudgetSelected); } - if (state.activeBudget!.budgetItems.isEmpty) { + if (state.budgetItems.isEmpty) { return Row( children: [ Text(t.pages.budgets.details.noBudgetItems), @@ -95,10 +96,9 @@ class BudgetDetailsPage extends StatelessWidget { ), ListView.builder( shrinkWrap: true, - itemCount: state.activeBudget!.budgetItems.length, + itemCount: state.budgetItems.length, itemBuilder: (context, index) { - final item = state.activeBudget!.budgetItems - .elementAt(index); + final item = state.budgetItems.elementAt(index); final amount = formatCurrency(item.item.amount); return ListTile( title: Text( @@ -120,7 +120,7 @@ class BudgetDetailsPage extends StatelessWidget { } final categories = - state.activeBudget!.budgetItems + state.budgetItems // TODO //.map((i) => i.expenseCategory.value!.name) .map((i) => "lol") @@ -149,7 +149,7 @@ class BudgetDetailsPage extends StatelessWidget { spending.isEmpty ? 0 : spending.values.reduce((acc, val) => acc + val); - final budgetTotal = state.activeBudget!.budgetItems + final budgetTotal = state.budgetItems .map((i) => i.item.amount) .reduce((acc, val) => acc + val); return Column( @@ -271,7 +271,7 @@ class BudgetDetailsPage extends StatelessWidget { fallbackText: "", valueConverter: formatCurrency, items: - state.activeBudget!.budgetItems + state.budgetItems .map( (i) => ( title: i.expenseCategory.name, @@ -342,10 +342,9 @@ class BudgetDetailsPage extends StatelessWidget { padding: EdgeInsets.all(8), child: ListView.builder( shrinkWrap: true, - itemCount: state.activeBudget!.budgetItems.length, + itemCount: state.budgetItems.length, itemBuilder: (context, index) { - final item = state.activeBudget!.budgetItems - .elementAt(index); + final item = state.budgetItems.elementAt(index); final amount = formatCurrency(item.item.amount); final spent = spending[item.expenseCategory.name]; final left = diff --git a/lib/ui/state/core.dart b/lib/ui/state/core.dart index a0cf612..e33673c 100644 --- a/lib/ui/state/core.dart +++ b/lib/ui/state/core.dart @@ -20,6 +20,7 @@ abstract class CoreState with _$CoreState { @Default([]) List beneficiaries, @Default([]) List expenseCategories, @Default([]) List budgets, + @Default([]) List budgetItems, @Default(null) BudgetsDto? activeBudget, @Default([]) List loans, @Default(null) LoanDto? activeLoan, @@ -37,6 +38,7 @@ class CoreCubit extends Cubit { StreamSubscription? _beneficiariesStreamSubscription; StreamSubscription? _expenseCategoryStreamSubscription; StreamSubscription? _budgetsStreamSubscription; + StreamSubscription? _budgetItemsStreamSubscription; StreamSubscription? _loanStreamSubscription; void setupAccountStream() { @@ -179,7 +181,17 @@ class CoreCubit extends Cubit { } void setActiveBudget(BudgetsDto? budget) { - emit(state.copyWith(activeBudget: budget)); + emit(state.copyWith(activeBudget: budget, budgetItems: [])); + _budgetItemsStreamSubscription?.cancel(); + if (budget != null) { + _budgetItemsStreamSubscription = GetIt.I + .get() + .budgetsDao + .watchBudgetItems(budget.budget) + .listen((items) { + emit(state.copyWith(budgetItems: items)); + }); + } } Future deleteAccount(Account account) async { diff --git a/lib/ui/state/core.freezed.dart b/lib/ui/state/core.freezed.dart index 0a3deaf..4176ec4 100644 --- a/lib/ui/state/core.freezed.dart +++ b/lib/ui/state/core.freezed.dart @@ -12,8 +12,7 @@ part of 'core.dart'; T _$identity(T value) => value; final _privateConstructorUsedError = UnsupportedError( - 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models', -); + 'It seems like you constructed your class using `MyClass._()`. This constructor is only meant to be used by freezed and you are not supposed to need it nor use it.\nPlease check the documentation here for more information: https://github.com/rrousselGit/freezed#adding-getters-and-methods-to-our-models'); /// @nodoc mixin _$CoreState { @@ -30,6 +29,7 @@ mixin _$CoreState { List get expenseCategories => throw _privateConstructorUsedError; List get budgets => throw _privateConstructorUsedError; + List get budgetItems => throw _privateConstructorUsedError; BudgetsDto? get activeBudget => throw _privateConstructorUsedError; List get loans => throw _privateConstructorUsedError; LoanDto? get activeLoan => throw _privateConstructorUsedError; @@ -45,22 +45,22 @@ abstract class $CoreStateCopyWith<$Res> { factory $CoreStateCopyWith(CoreState value, $Res Function(CoreState) then) = _$CoreStateCopyWithImpl<$Res, CoreState>; @useResult - $Res call({ - OkanePage activePage, - int? activeAccountIndex, - TransactionDto? activeTransaction, - List accounts, - List recurringTransactions, - List transactions, - List transactionTemplates, - List beneficiaries, - List expenseCategories, - List budgets, - BudgetsDto? activeBudget, - List loans, - LoanDto? activeLoan, - bool isDeletingAccount, - }); + $Res call( + {OkanePage activePage, + int? activeAccountIndex, + TransactionDto? activeTransaction, + List accounts, + List recurringTransactions, + List transactions, + List transactionTemplates, + List beneficiaries, + List expenseCategories, + List budgets, + List budgetItems, + BudgetsDto? activeBudget, + List loans, + LoanDto? activeLoan, + bool isDeletingAccount}); } /// @nodoc @@ -86,86 +86,74 @@ class _$CoreStateCopyWithImpl<$Res, $Val extends CoreState> Object? beneficiaries = null, Object? expenseCategories = null, Object? budgets = null, + Object? budgetItems = null, Object? activeBudget = freezed, Object? loans = null, Object? activeLoan = freezed, Object? isDeletingAccount = null, }) { - return _then( - _value.copyWith( - activePage: - null == activePage - ? _value.activePage - : activePage // ignore: cast_nullable_to_non_nullable - as OkanePage, - activeAccountIndex: - freezed == activeAccountIndex - ? _value.activeAccountIndex - : activeAccountIndex // ignore: cast_nullable_to_non_nullable - as int?, - activeTransaction: - freezed == activeTransaction - ? _value.activeTransaction - : activeTransaction // ignore: cast_nullable_to_non_nullable - as TransactionDto?, - accounts: - null == accounts - ? _value.accounts - : accounts // ignore: cast_nullable_to_non_nullable - as List, - recurringTransactions: - null == recurringTransactions - ? _value.recurringTransactions - : recurringTransactions // ignore: cast_nullable_to_non_nullable - as List, - transactions: - null == transactions - ? _value.transactions - : transactions // ignore: cast_nullable_to_non_nullable - as List, - transactionTemplates: - null == transactionTemplates - ? _value.transactionTemplates - : transactionTemplates // ignore: cast_nullable_to_non_nullable - as List, - beneficiaries: - null == beneficiaries - ? _value.beneficiaries - : beneficiaries // ignore: cast_nullable_to_non_nullable - as List, - expenseCategories: - null == expenseCategories - ? _value.expenseCategories - : expenseCategories // ignore: cast_nullable_to_non_nullable - as List, - budgets: - null == budgets - ? _value.budgets - : budgets // ignore: cast_nullable_to_non_nullable - as List, - activeBudget: - freezed == activeBudget - ? _value.activeBudget - : activeBudget // ignore: cast_nullable_to_non_nullable - as BudgetsDto?, - loans: - null == loans - ? _value.loans - : loans // ignore: cast_nullable_to_non_nullable - as List, - activeLoan: - freezed == activeLoan - ? _value.activeLoan - : activeLoan // ignore: cast_nullable_to_non_nullable - as LoanDto?, - isDeletingAccount: - null == isDeletingAccount - ? _value.isDeletingAccount - : isDeletingAccount // ignore: cast_nullable_to_non_nullable - as bool, - ) - as $Val, - ); + return _then(_value.copyWith( + activePage: null == activePage + ? _value.activePage + : activePage // ignore: cast_nullable_to_non_nullable + as OkanePage, + activeAccountIndex: freezed == activeAccountIndex + ? _value.activeAccountIndex + : activeAccountIndex // ignore: cast_nullable_to_non_nullable + as int?, + activeTransaction: freezed == activeTransaction + ? _value.activeTransaction + : activeTransaction // ignore: cast_nullable_to_non_nullable + as TransactionDto?, + accounts: null == accounts + ? _value.accounts + : accounts // ignore: cast_nullable_to_non_nullable + as List, + recurringTransactions: null == recurringTransactions + ? _value.recurringTransactions + : recurringTransactions // ignore: cast_nullable_to_non_nullable + as List, + transactions: null == transactions + ? _value.transactions + : transactions // ignore: cast_nullable_to_non_nullable + as List, + transactionTemplates: null == transactionTemplates + ? _value.transactionTemplates + : transactionTemplates // ignore: cast_nullable_to_non_nullable + as List, + beneficiaries: null == beneficiaries + ? _value.beneficiaries + : beneficiaries // ignore: cast_nullable_to_non_nullable + as List, + expenseCategories: null == expenseCategories + ? _value.expenseCategories + : expenseCategories // ignore: cast_nullable_to_non_nullable + as List, + budgets: null == budgets + ? _value.budgets + : budgets // ignore: cast_nullable_to_non_nullable + as List, + budgetItems: null == budgetItems + ? _value.budgetItems + : budgetItems // ignore: cast_nullable_to_non_nullable + as List, + activeBudget: freezed == activeBudget + ? _value.activeBudget + : activeBudget // ignore: cast_nullable_to_non_nullable + as BudgetsDto?, + loans: null == loans + ? _value.loans + : loans // ignore: cast_nullable_to_non_nullable + as List, + activeLoan: freezed == activeLoan + ? _value.activeLoan + : activeLoan // ignore: cast_nullable_to_non_nullable + as LoanDto?, + isDeletingAccount: null == isDeletingAccount + ? _value.isDeletingAccount + : isDeletingAccount // ignore: cast_nullable_to_non_nullable + as bool, + ) as $Val); } } @@ -173,27 +161,26 @@ class _$CoreStateCopyWithImpl<$Res, $Val extends CoreState> abstract class _$$CoreStateImplCopyWith<$Res> implements $CoreStateCopyWith<$Res> { factory _$$CoreStateImplCopyWith( - _$CoreStateImpl value, - $Res Function(_$CoreStateImpl) then, - ) = __$$CoreStateImplCopyWithImpl<$Res>; + _$CoreStateImpl value, $Res Function(_$CoreStateImpl) then) = + __$$CoreStateImplCopyWithImpl<$Res>; @override @useResult - $Res call({ - OkanePage activePage, - int? activeAccountIndex, - TransactionDto? activeTransaction, - List accounts, - List recurringTransactions, - List transactions, - List transactionTemplates, - List beneficiaries, - List expenseCategories, - List budgets, - BudgetsDto? activeBudget, - List loans, - LoanDto? activeLoan, - bool isDeletingAccount, - }); + $Res call( + {OkanePage activePage, + int? activeAccountIndex, + TransactionDto? activeTransaction, + List accounts, + List recurringTransactions, + List transactions, + List transactionTemplates, + List beneficiaries, + List expenseCategories, + List budgets, + List budgetItems, + BudgetsDto? activeBudget, + List loans, + LoanDto? activeLoan, + bool isDeletingAccount}); } /// @nodoc @@ -201,9 +188,8 @@ class __$$CoreStateImplCopyWithImpl<$Res> extends _$CoreStateCopyWithImpl<$Res, _$CoreStateImpl> implements _$$CoreStateImplCopyWith<$Res> { __$$CoreStateImplCopyWithImpl( - _$CoreStateImpl _value, - $Res Function(_$CoreStateImpl) _then, - ) : super(_value, _then); + _$CoreStateImpl _value, $Res Function(_$CoreStateImpl) _then) + : super(_value, _then); @pragma('vm:prefer-inline') @override @@ -218,114 +204,105 @@ class __$$CoreStateImplCopyWithImpl<$Res> Object? beneficiaries = null, Object? expenseCategories = null, Object? budgets = null, + Object? budgetItems = null, Object? activeBudget = freezed, Object? loans = null, Object? activeLoan = freezed, Object? isDeletingAccount = null, }) { - return _then( - _$CoreStateImpl( - activePage: - null == activePage - ? _value.activePage - : activePage // ignore: cast_nullable_to_non_nullable - as OkanePage, - activeAccountIndex: - freezed == activeAccountIndex - ? _value.activeAccountIndex - : activeAccountIndex // ignore: cast_nullable_to_non_nullable - as int?, - activeTransaction: - freezed == activeTransaction - ? _value.activeTransaction - : activeTransaction // ignore: cast_nullable_to_non_nullable - as TransactionDto?, - accounts: - null == accounts - ? _value._accounts - : accounts // ignore: cast_nullable_to_non_nullable - as List, - recurringTransactions: - null == recurringTransactions - ? _value._recurringTransactions - : recurringTransactions // ignore: cast_nullable_to_non_nullable - as List, - transactions: - null == transactions - ? _value._transactions - : transactions // ignore: cast_nullable_to_non_nullable - as List, - transactionTemplates: - null == transactionTemplates - ? _value._transactionTemplates - : transactionTemplates // ignore: cast_nullable_to_non_nullable - as List, - beneficiaries: - null == beneficiaries - ? _value._beneficiaries - : beneficiaries // ignore: cast_nullable_to_non_nullable - as List, - expenseCategories: - null == expenseCategories - ? _value._expenseCategories - : expenseCategories // ignore: cast_nullable_to_non_nullable - as List, - budgets: - null == budgets - ? _value._budgets - : budgets // ignore: cast_nullable_to_non_nullable - as List, - activeBudget: - freezed == activeBudget - ? _value.activeBudget - : activeBudget // ignore: cast_nullable_to_non_nullable - as BudgetsDto?, - loans: - null == loans - ? _value._loans - : loans // ignore: cast_nullable_to_non_nullable - as List, - activeLoan: - freezed == activeLoan - ? _value.activeLoan - : activeLoan // ignore: cast_nullable_to_non_nullable - as LoanDto?, - isDeletingAccount: - null == isDeletingAccount - ? _value.isDeletingAccount - : isDeletingAccount // ignore: cast_nullable_to_non_nullable - as bool, - ), - ); + return _then(_$CoreStateImpl( + activePage: null == activePage + ? _value.activePage + : activePage // ignore: cast_nullable_to_non_nullable + as OkanePage, + activeAccountIndex: freezed == activeAccountIndex + ? _value.activeAccountIndex + : activeAccountIndex // ignore: cast_nullable_to_non_nullable + as int?, + activeTransaction: freezed == activeTransaction + ? _value.activeTransaction + : activeTransaction // ignore: cast_nullable_to_non_nullable + as TransactionDto?, + accounts: null == accounts + ? _value._accounts + : accounts // ignore: cast_nullable_to_non_nullable + as List, + recurringTransactions: null == recurringTransactions + ? _value._recurringTransactions + : recurringTransactions // ignore: cast_nullable_to_non_nullable + as List, + transactions: null == transactions + ? _value._transactions + : transactions // ignore: cast_nullable_to_non_nullable + as List, + transactionTemplates: null == transactionTemplates + ? _value._transactionTemplates + : transactionTemplates // ignore: cast_nullable_to_non_nullable + as List, + beneficiaries: null == beneficiaries + ? _value._beneficiaries + : beneficiaries // ignore: cast_nullable_to_non_nullable + as List, + expenseCategories: null == expenseCategories + ? _value._expenseCategories + : expenseCategories // ignore: cast_nullable_to_non_nullable + as List, + budgets: null == budgets + ? _value._budgets + : budgets // ignore: cast_nullable_to_non_nullable + as List, + budgetItems: null == budgetItems + ? _value._budgetItems + : budgetItems // ignore: cast_nullable_to_non_nullable + as List, + activeBudget: freezed == activeBudget + ? _value.activeBudget + : activeBudget // ignore: cast_nullable_to_non_nullable + as BudgetsDto?, + loans: null == loans + ? _value._loans + : loans // ignore: cast_nullable_to_non_nullable + as List, + activeLoan: freezed == activeLoan + ? _value.activeLoan + : activeLoan // ignore: cast_nullable_to_non_nullable + as LoanDto?, + isDeletingAccount: null == isDeletingAccount + ? _value.isDeletingAccount + : isDeletingAccount // ignore: cast_nullable_to_non_nullable + as bool, + )); } } /// @nodoc class _$CoreStateImpl implements _CoreState { - const _$CoreStateImpl({ - this.activePage = OkanePage.accounts, - this.activeAccountIndex, - this.activeTransaction = null, - final List accounts = const [], - final List recurringTransactions = const [], - final List transactions = const [], - final List transactionTemplates = const [], - final List beneficiaries = const [], - final List expenseCategories = const [], - final List budgets = const [], - this.activeBudget = null, - final List loans = const [], - this.activeLoan = null, - this.isDeletingAccount = false, - }) : _accounts = accounts, - _recurringTransactions = recurringTransactions, - _transactions = transactions, - _transactionTemplates = transactionTemplates, - _beneficiaries = beneficiaries, - _expenseCategories = expenseCategories, - _budgets = budgets, - _loans = loans; + const _$CoreStateImpl( + {this.activePage = OkanePage.accounts, + this.activeAccountIndex, + this.activeTransaction = null, + final List accounts = const [], + final List recurringTransactions = const [], + final List transactions = const [], + final List transactionTemplates = const [], + final List beneficiaries = const [], + final List expenseCategories = const [], + final List budgets = const [], + final List budgetItems = const [], + this.activeBudget = null, + final List loans = const [], + this.activeLoan = null, + this.isDeletingAccount = false}) + : _accounts = accounts, + _recurringTransactions = recurringTransactions, + _transactions = transactions, + _transactionTemplates = transactionTemplates, + _beneficiaries = beneficiaries, + _expenseCategories = expenseCategories, + _budgets = budgets, + _budgetItems = budgetItems, + _loans = loans; @override @JsonKey() @@ -401,6 +378,15 @@ class _$CoreStateImpl implements _CoreState { return EqualUnmodifiableListView(_budgets); } + final List _budgetItems; + @override + @JsonKey() + List get budgetItems { + if (_budgetItems is EqualUnmodifiableListView) return _budgetItems; + // ignore: implicit_dynamic_type + return EqualUnmodifiableListView(_budgetItems); + } + @override @JsonKey() final BudgetsDto? activeBudget; @@ -422,7 +408,7 @@ class _$CoreStateImpl implements _CoreState { @override String toString() { - return 'CoreState(activePage: $activePage, activeAccountIndex: $activeAccountIndex, activeTransaction: $activeTransaction, accounts: $accounts, recurringTransactions: $recurringTransactions, transactions: $transactions, transactionTemplates: $transactionTemplates, beneficiaries: $beneficiaries, expenseCategories: $expenseCategories, budgets: $budgets, activeBudget: $activeBudget, loans: $loans, activeLoan: $activeLoan, isDeletingAccount: $isDeletingAccount)'; + return 'CoreState(activePage: $activePage, activeAccountIndex: $activeAccountIndex, activeTransaction: $activeTransaction, accounts: $accounts, recurringTransactions: $recurringTransactions, transactions: $transactions, transactionTemplates: $transactionTemplates, beneficiaries: $beneficiaries, expenseCategories: $expenseCategories, budgets: $budgets, budgetItems: $budgetItems, activeBudget: $activeBudget, loans: $loans, activeLoan: $activeLoan, isDeletingAccount: $isDeletingAccount)'; } @override @@ -437,27 +423,19 @@ class _$CoreStateImpl implements _CoreState { (identical(other.activeTransaction, activeTransaction) || other.activeTransaction == activeTransaction) && const DeepCollectionEquality().equals(other._accounts, _accounts) && - const DeepCollectionEquality().equals( - other._recurringTransactions, - _recurringTransactions, - ) && - const DeepCollectionEquality().equals( - other._transactions, - _transactions, - ) && - const DeepCollectionEquality().equals( - other._transactionTemplates, - _transactionTemplates, - ) && - const DeepCollectionEquality().equals( - other._beneficiaries, - _beneficiaries, - ) && - const DeepCollectionEquality().equals( - other._expenseCategories, - _expenseCategories, - ) && + const DeepCollectionEquality() + .equals(other._recurringTransactions, _recurringTransactions) && + const DeepCollectionEquality() + .equals(other._transactions, _transactions) && + const DeepCollectionEquality() + .equals(other._transactionTemplates, _transactionTemplates) && + const DeepCollectionEquality() + .equals(other._beneficiaries, _beneficiaries) && + const DeepCollectionEquality() + .equals(other._expenseCategories, _expenseCategories) && const DeepCollectionEquality().equals(other._budgets, _budgets) && + const DeepCollectionEquality() + .equals(other._budgetItems, _budgetItems) && (identical(other.activeBudget, activeBudget) || other.activeBudget == activeBudget) && const DeepCollectionEquality().equals(other._loans, _loans) && @@ -469,22 +447,22 @@ class _$CoreStateImpl implements _CoreState { @override int get hashCode => Object.hash( - runtimeType, - activePage, - activeAccountIndex, - activeTransaction, - const DeepCollectionEquality().hash(_accounts), - const DeepCollectionEquality().hash(_recurringTransactions), - const DeepCollectionEquality().hash(_transactions), - const DeepCollectionEquality().hash(_transactionTemplates), - const DeepCollectionEquality().hash(_beneficiaries), - const DeepCollectionEquality().hash(_expenseCategories), - const DeepCollectionEquality().hash(_budgets), - activeBudget, - const DeepCollectionEquality().hash(_loans), - activeLoan, - isDeletingAccount, - ); + runtimeType, + activePage, + activeAccountIndex, + activeTransaction, + const DeepCollectionEquality().hash(_accounts), + const DeepCollectionEquality().hash(_recurringTransactions), + const DeepCollectionEquality().hash(_transactions), + const DeepCollectionEquality().hash(_transactionTemplates), + const DeepCollectionEquality().hash(_beneficiaries), + const DeepCollectionEquality().hash(_expenseCategories), + const DeepCollectionEquality().hash(_budgets), + const DeepCollectionEquality().hash(_budgetItems), + activeBudget, + const DeepCollectionEquality().hash(_loans), + activeLoan, + isDeletingAccount); @JsonKey(ignore: true) @override @@ -494,22 +472,22 @@ class _$CoreStateImpl implements _CoreState { } abstract class _CoreState implements CoreState { - const factory _CoreState({ - final OkanePage activePage, - final int? activeAccountIndex, - final TransactionDto? activeTransaction, - final List accounts, - final List recurringTransactions, - final List transactions, - final List transactionTemplates, - final List beneficiaries, - final List expenseCategories, - final List budgets, - final BudgetsDto? activeBudget, - final List loans, - final LoanDto? activeLoan, - final bool isDeletingAccount, - }) = _$CoreStateImpl; + const factory _CoreState( + {final OkanePage activePage, + final int? activeAccountIndex, + final TransactionDto? activeTransaction, + final List accounts, + final List recurringTransactions, + final List transactions, + final List transactionTemplates, + final List beneficiaries, + final List expenseCategories, + final List budgets, + final List budgetItems, + final BudgetsDto? activeBudget, + final List loans, + final LoanDto? activeLoan, + final bool isDeletingAccount}) = _$CoreStateImpl; @override OkanePage get activePage; @@ -532,6 +510,8 @@ abstract class _CoreState implements CoreState { @override List get budgets; @override + List get budgetItems; + @override BudgetsDto? get activeBudget; @override List get loans; diff --git a/lib/ui/widgets/add_expense_category.dart b/lib/ui/widgets/add_expense_category.dart index 70fa798..697b6ef 100644 --- a/lib/ui/widgets/add_expense_category.dart +++ b/lib/ui/widgets/add_expense_category.dart @@ -1,5 +1,8 @@ +import 'package:drift/drift.dart' show Value; import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; +import 'package:get_it/get_it.dart'; +import 'package:okane/database/sqlite.dart'; import 'package:okane/i18n/strings.g.dart'; import 'package:okane/ui/state/core.dart'; @@ -48,14 +51,16 @@ class AddExpenseCategoryState extends State { Spacer(), OutlinedButton( onPressed: () async { - // TODO - /* - final category = - ExpenseCategory() - ..name = _categoryNameController.text; - await upsertExpenseCategory(category); + final category = await GetIt.I + .get() + .expenseCategoriesDao + .upsertCategory( + ExpenseCategoriesCompanion( + name: Value(_categoryNameController.text), + ), + ); _categoryNameController.text = ""; - Navigator.of(context).pop(category);*/ + Navigator.of(context).pop(category); }, child: Text(t.modals.add), ),