8240 lines
266 KiB
Dart
8240 lines
266 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'sqlite.dart';
|
|
|
|
// ignore_for_file: type=lint
|
|
class $AccountsTable extends Accounts with TableInfo<$AccountsTable, Account> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$AccountsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'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<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [id, name];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'accounts';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Account> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
Account map(Map<String, dynamic> 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'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$AccountsTable createAlias(String alias) {
|
|
return $AccountsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Account extends DataClass implements Insertable<Account> {
|
|
final int id;
|
|
final String name;
|
|
const Account({required this.id, required this.name});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['name'] = Variable<String>(name);
|
|
return map;
|
|
}
|
|
|
|
AccountsCompanion toCompanion(bool nullToAbsent) {
|
|
return AccountsCompanion(id: Value(id), name: Value(name));
|
|
}
|
|
|
|
factory Account.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Account(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'name': serializer.toJson<String>(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,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Account(')
|
|
..write('id: $id, ')
|
|
..write('name: $name')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, name);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Account && other.id == this.id && other.name == this.name);
|
|
}
|
|
|
|
class AccountsCompanion extends UpdateCompanion<Account> {
|
|
final Value<int> id;
|
|
final Value<String> name;
|
|
const AccountsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
});
|
|
AccountsCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required String name,
|
|
}) : name = Value(name);
|
|
static Insertable<Account> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? name,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (name != null) 'name': name,
|
|
});
|
|
}
|
|
|
|
AccountsCompanion copyWith({Value<int>? id, Value<String>? name}) {
|
|
return AccountsCompanion(id: id ?? this.id, name: name ?? this.name);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('AccountsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('name: $name')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $BeneficiariesTable extends Beneficiaries
|
|
with TableInfo<$BeneficiariesTable, Beneficiary> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$BeneficiariesTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'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<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
|
|
);
|
|
@override
|
|
late final GeneratedColumnWithTypeConverter<BeneficiaryType, String> type =
|
|
GeneratedColumn<String>(
|
|
'type',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
).withConverter<BeneficiaryType>($BeneficiariesTable.$convertertype);
|
|
static const VerificationMeta _accountIdMeta = const VerificationMeta(
|
|
'accountId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> accountId = GeneratedColumn<int>(
|
|
'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<String> imagePath = GeneratedColumn<String>(
|
|
'image_path',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [id, name, type, accountId, imagePath];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'beneficiaries';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Beneficiary> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('account_id')) {
|
|
context.handle(
|
|
_accountIdMeta,
|
|
accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('image_path')) {
|
|
context.handle(
|
|
_imagePathMeta,
|
|
imagePath.isAcceptableOrUnknown(data['image_path']!, _imagePathMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
Beneficiary map(Map<String, dynamic> 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'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$BeneficiariesTable createAlias(String alias) {
|
|
return $BeneficiariesTable(attachedDatabase, alias);
|
|
}
|
|
|
|
static JsonTypeConverter2<BeneficiaryType, String, String> $convertertype =
|
|
const EnumNameConverter<BeneficiaryType>(BeneficiaryType.values);
|
|
}
|
|
|
|
class Beneficiary extends DataClass implements Insertable<Beneficiary> {
|
|
final int id;
|
|
final String name;
|
|
final BeneficiaryType type;
|
|
final int? accountId;
|
|
final String? imagePath;
|
|
const Beneficiary({
|
|
required this.id,
|
|
required this.name,
|
|
required this.type,
|
|
this.accountId,
|
|
this.imagePath,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['name'] = Variable<String>(name);
|
|
{
|
|
map['type'] = Variable<String>(
|
|
$BeneficiariesTable.$convertertype.toSql(type),
|
|
);
|
|
}
|
|
if (!nullToAbsent || accountId != null) {
|
|
map['account_id'] = Variable<int>(accountId);
|
|
}
|
|
if (!nullToAbsent || imagePath != null) {
|
|
map['image_path'] = Variable<String>(imagePath);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
BeneficiariesCompanion toCompanion(bool nullToAbsent) {
|
|
return BeneficiariesCompanion(
|
|
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),
|
|
);
|
|
}
|
|
|
|
factory Beneficiary.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Beneficiary(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
type: $BeneficiariesTable.$convertertype.fromJson(
|
|
serializer.fromJson<String>(json['type']),
|
|
),
|
|
accountId: serializer.fromJson<int?>(json['accountId']),
|
|
imagePath: serializer.fromJson<String?>(json['imagePath']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'name': serializer.toJson<String>(name),
|
|
'type': serializer.toJson<String>(
|
|
$BeneficiariesTable.$convertertype.toJson(type),
|
|
),
|
|
'accountId': serializer.toJson<int?>(accountId),
|
|
'imagePath': serializer.toJson<String?>(imagePath),
|
|
};
|
|
}
|
|
|
|
Beneficiary copyWith({
|
|
int? id,
|
|
String? name,
|
|
BeneficiaryType? type,
|
|
Value<int?> accountId = const Value.absent(),
|
|
Value<String?> 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,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
type: data.type.present ? data.type.value : this.type,
|
|
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
|
imagePath: data.imagePath.present ? data.imagePath.value : this.imagePath,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Beneficiary(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('type: $type, ')
|
|
..write('accountId: $accountId, ')
|
|
..write('imagePath: $imagePath')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, name, type, accountId, imagePath);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Beneficiary &&
|
|
other.id == this.id &&
|
|
other.name == this.name &&
|
|
other.type == this.type &&
|
|
other.accountId == this.accountId &&
|
|
other.imagePath == this.imagePath);
|
|
}
|
|
|
|
class BeneficiariesCompanion extends UpdateCompanion<Beneficiary> {
|
|
final Value<int> id;
|
|
final Value<String> name;
|
|
final Value<BeneficiaryType> type;
|
|
final Value<int?> accountId;
|
|
final Value<String?> imagePath;
|
|
const BeneficiariesCompanion({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.type = const Value.absent(),
|
|
this.accountId = const Value.absent(),
|
|
this.imagePath = const Value.absent(),
|
|
});
|
|
BeneficiariesCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required String name,
|
|
required BeneficiaryType type,
|
|
this.accountId = const Value.absent(),
|
|
this.imagePath = const Value.absent(),
|
|
}) : name = Value(name),
|
|
type = Value(type);
|
|
static Insertable<Beneficiary> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? name,
|
|
Expression<String>? type,
|
|
Expression<int>? accountId,
|
|
Expression<String>? imagePath,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (name != null) 'name': name,
|
|
if (type != null) 'type': type,
|
|
if (accountId != null) 'account_id': accountId,
|
|
if (imagePath != null) 'image_path': imagePath,
|
|
});
|
|
}
|
|
|
|
BeneficiariesCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<String>? name,
|
|
Value<BeneficiaryType>? type,
|
|
Value<int?>? accountId,
|
|
Value<String?>? imagePath,
|
|
}) {
|
|
return BeneficiariesCompanion(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
type: type ?? this.type,
|
|
accountId: accountId ?? this.accountId,
|
|
imagePath: imagePath ?? this.imagePath,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (type.present) {
|
|
map['type'] = Variable<String>(
|
|
$BeneficiariesTable.$convertertype.toSql(type.value),
|
|
);
|
|
}
|
|
if (accountId.present) {
|
|
map['account_id'] = Variable<int>(accountId.value);
|
|
}
|
|
if (imagePath.present) {
|
|
map['image_path'] = Variable<String>(imagePath.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('BeneficiariesCompanion(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('type: $type, ')
|
|
..write('accountId: $accountId, ')
|
|
..write('imagePath: $imagePath')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $BudgetsTable extends Budgets with TableInfo<$BudgetsTable, Budget> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$BudgetsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'id',
|
|
aliasedName,
|
|
false,
|
|
hasAutoIncrement: true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'PRIMARY KEY AUTOINCREMENT',
|
|
),
|
|
);
|
|
@override
|
|
late final GeneratedColumnWithTypeConverter<BudgetPeriod, String> period =
|
|
GeneratedColumn<String>(
|
|
'period',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
).withConverter<BudgetPeriod>($BudgetsTable.$converterperiod);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _incomeMeta = const VerificationMeta('income');
|
|
@override
|
|
late final GeneratedColumn<double> income = GeneratedColumn<double>(
|
|
'income',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _includeOtherSpendingsMeta =
|
|
const VerificationMeta('includeOtherSpendings');
|
|
@override
|
|
late final GeneratedColumn<bool> includeOtherSpendings =
|
|
GeneratedColumn<bool>(
|
|
'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<int> accountId = GeneratedColumn<int>(
|
|
'account_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES accounts (id)',
|
|
),
|
|
);
|
|
@override
|
|
List<GeneratedColumn> 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<Budget> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('income')) {
|
|
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,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_includeOtherSpendingsMeta);
|
|
}
|
|
if (data.containsKey('account_id')) {
|
|
context.handle(
|
|
_accountIdMeta,
|
|
accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_accountIdMeta);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
Budget map(Map<String, dynamic> 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'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$BudgetsTable createAlias(String alias) {
|
|
return $BudgetsTable(attachedDatabase, alias);
|
|
}
|
|
|
|
static JsonTypeConverter2<BudgetPeriod, String, String> $converterperiod =
|
|
const EnumNameConverter<BudgetPeriod>(BudgetPeriod.values);
|
|
}
|
|
|
|
class Budget extends DataClass implements Insertable<Budget> {
|
|
final int id;
|
|
final BudgetPeriod period;
|
|
final String name;
|
|
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,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
{
|
|
map['period'] = Variable<String>(
|
|
$BudgetsTable.$converterperiod.toSql(period),
|
|
);
|
|
}
|
|
map['name'] = Variable<String>(name);
|
|
map['income'] = Variable<double>(income);
|
|
map['include_other_spendings'] = Variable<bool>(includeOtherSpendings);
|
|
map['account_id'] = Variable<int>(accountId);
|
|
return map;
|
|
}
|
|
|
|
BudgetsCompanion toCompanion(bool nullToAbsent) {
|
|
return BudgetsCompanion(
|
|
id: Value(id),
|
|
period: Value(period),
|
|
name: Value(name),
|
|
income: Value(income),
|
|
includeOtherSpendings: Value(includeOtherSpendings),
|
|
accountId: Value(accountId),
|
|
);
|
|
}
|
|
|
|
factory Budget.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Budget(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
period: $BudgetsTable.$converterperiod.fromJson(
|
|
serializer.fromJson<String>(json['period']),
|
|
),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
income: serializer.fromJson<double>(json['income']),
|
|
includeOtherSpendings: serializer.fromJson<bool>(
|
|
json['includeOtherSpendings'],
|
|
),
|
|
accountId: serializer.fromJson<int>(json['accountId']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'period': serializer.toJson<String>(
|
|
$BudgetsTable.$converterperiod.toJson(period),
|
|
),
|
|
'name': serializer.toJson<String>(name),
|
|
'income': serializer.toJson<double>(income),
|
|
'includeOtherSpendings': serializer.toJson<bool>(includeOtherSpendings),
|
|
'accountId': serializer.toJson<int>(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,
|
|
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Budget(')
|
|
..write('id: $id, ')
|
|
..write('period: $period, ')
|
|
..write('name: $name, ')
|
|
..write('income: $income, ')
|
|
..write('includeOtherSpendings: $includeOtherSpendings, ')
|
|
..write('accountId: $accountId')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode =>
|
|
Object.hash(id, period, name, income, includeOtherSpendings, accountId);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Budget &&
|
|
other.id == this.id &&
|
|
other.period == this.period &&
|
|
other.name == this.name &&
|
|
other.income == this.income &&
|
|
other.includeOtherSpendings == this.includeOtherSpendings &&
|
|
other.accountId == this.accountId);
|
|
}
|
|
|
|
class BudgetsCompanion extends UpdateCompanion<Budget> {
|
|
final Value<int> id;
|
|
final Value<BudgetPeriod> period;
|
|
final Value<String> name;
|
|
final Value<double> income;
|
|
final Value<bool> includeOtherSpendings;
|
|
final Value<int> accountId;
|
|
const BudgetsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.period = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.income = const Value.absent(),
|
|
this.includeOtherSpendings = const Value.absent(),
|
|
this.accountId = const Value.absent(),
|
|
});
|
|
BudgetsCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required BudgetPeriod period,
|
|
required String name,
|
|
required double income,
|
|
required bool includeOtherSpendings,
|
|
required int accountId,
|
|
}) : period = Value(period),
|
|
name = Value(name),
|
|
income = Value(income),
|
|
includeOtherSpendings = Value(includeOtherSpendings),
|
|
accountId = Value(accountId);
|
|
static Insertable<Budget> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? period,
|
|
Expression<String>? name,
|
|
Expression<double>? income,
|
|
Expression<bool>? includeOtherSpendings,
|
|
Expression<int>? accountId,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (period != null) 'period': period,
|
|
if (name != null) 'name': name,
|
|
if (income != null) 'income': income,
|
|
if (includeOtherSpendings != null)
|
|
'include_other_spendings': includeOtherSpendings,
|
|
if (accountId != null) 'account_id': accountId,
|
|
});
|
|
}
|
|
|
|
BudgetsCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<BudgetPeriod>? period,
|
|
Value<String>? name,
|
|
Value<double>? income,
|
|
Value<bool>? includeOtherSpendings,
|
|
Value<int>? accountId,
|
|
}) {
|
|
return BudgetsCompanion(
|
|
id: id ?? this.id,
|
|
period: period ?? this.period,
|
|
name: name ?? this.name,
|
|
income: income ?? this.income,
|
|
includeOtherSpendings:
|
|
includeOtherSpendings ?? this.includeOtherSpendings,
|
|
accountId: accountId ?? this.accountId,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (period.present) {
|
|
map['period'] = Variable<String>(
|
|
$BudgetsTable.$converterperiod.toSql(period.value),
|
|
);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (income.present) {
|
|
map['income'] = Variable<double>(income.value);
|
|
}
|
|
if (includeOtherSpendings.present) {
|
|
map['include_other_spendings'] = Variable<bool>(
|
|
includeOtherSpendings.value,
|
|
);
|
|
}
|
|
if (accountId.present) {
|
|
map['account_id'] = Variable<int>(accountId.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('BudgetsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('period: $period, ')
|
|
..write('name: $name, ')
|
|
..write('income: $income, ')
|
|
..write('includeOtherSpendings: $includeOtherSpendings, ')
|
|
..write('accountId: $accountId')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $ExpenseCategoriesTable extends ExpenseCategories
|
|
with TableInfo<$ExpenseCategoriesTable, ExpenseCategory> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$ExpenseCategoriesTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'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<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [id, name];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'expense_categories';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<ExpenseCategory> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
ExpenseCategory map(Map<String, dynamic> 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'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$ExpenseCategoriesTable createAlias(String alias) {
|
|
return $ExpenseCategoriesTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class ExpenseCategory extends DataClass implements Insertable<ExpenseCategory> {
|
|
final int id;
|
|
final String name;
|
|
const ExpenseCategory({required this.id, required this.name});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['name'] = Variable<String>(name);
|
|
return map;
|
|
}
|
|
|
|
ExpenseCategoriesCompanion toCompanion(bool nullToAbsent) {
|
|
return ExpenseCategoriesCompanion(id: Value(id), name: Value(name));
|
|
}
|
|
|
|
factory ExpenseCategory.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return ExpenseCategory(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'name': serializer.toJson<String>(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,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('ExpenseCategory(')
|
|
..write('id: $id, ')
|
|
..write('name: $name')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, name);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is ExpenseCategory &&
|
|
other.id == this.id &&
|
|
other.name == this.name);
|
|
}
|
|
|
|
class ExpenseCategoriesCompanion extends UpdateCompanion<ExpenseCategory> {
|
|
final Value<int> id;
|
|
final Value<String> name;
|
|
const ExpenseCategoriesCompanion({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
});
|
|
ExpenseCategoriesCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required String name,
|
|
}) : name = Value(name);
|
|
static Insertable<ExpenseCategory> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? name,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (name != null) 'name': name,
|
|
});
|
|
}
|
|
|
|
ExpenseCategoriesCompanion copyWith({Value<int>? id, Value<String>? name}) {
|
|
return ExpenseCategoriesCompanion(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('ExpenseCategoriesCompanion(')
|
|
..write('id: $id, ')
|
|
..write('name: $name')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $BudgetItemsTable extends BudgetItems
|
|
with TableInfo<$BudgetItemsTable, BudgetItem> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$BudgetItemsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'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<double> amount = GeneratedColumn<double>(
|
|
'amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _expenseCategoryIdMeta = const VerificationMeta(
|
|
'expenseCategoryId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> expenseCategoryId = GeneratedColumn<int>(
|
|
'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<int> budgetId = GeneratedColumn<int>(
|
|
'budget_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES budgets (id)',
|
|
),
|
|
);
|
|
@override
|
|
List<GeneratedColumn> 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<BudgetItem> 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),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_amountMeta);
|
|
}
|
|
if (data.containsKey('expense_category_id')) {
|
|
context.handle(
|
|
_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),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_budgetIdMeta);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
BudgetItem map(Map<String, dynamic> 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'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$BudgetItemsTable createAlias(String alias) {
|
|
return $BudgetItemsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class BudgetItem extends DataClass implements Insertable<BudgetItem> {
|
|
final int id;
|
|
final double amount;
|
|
final int expenseCategoryId;
|
|
final int budgetId;
|
|
const BudgetItem({
|
|
required this.id,
|
|
required this.amount,
|
|
required this.expenseCategoryId,
|
|
required this.budgetId,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['amount'] = Variable<double>(amount);
|
|
map['expense_category_id'] = Variable<int>(expenseCategoryId);
|
|
map['budget_id'] = Variable<int>(budgetId);
|
|
return map;
|
|
}
|
|
|
|
BudgetItemsCompanion toCompanion(bool nullToAbsent) {
|
|
return BudgetItemsCompanion(
|
|
id: Value(id),
|
|
amount: Value(amount),
|
|
expenseCategoryId: Value(expenseCategoryId),
|
|
budgetId: Value(budgetId),
|
|
);
|
|
}
|
|
|
|
factory BudgetItem.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return BudgetItem(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
amount: serializer.fromJson<double>(json['amount']),
|
|
expenseCategoryId: serializer.fromJson<int>(json['expenseCategoryId']),
|
|
budgetId: serializer.fromJson<int>(json['budgetId']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'amount': serializer.toJson<double>(amount),
|
|
'expenseCategoryId': serializer.toJson<int>(expenseCategoryId),
|
|
'budgetId': serializer.toJson<int>(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,
|
|
budgetId: data.budgetId.present ? data.budgetId.value : this.budgetId,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('BudgetItem(')
|
|
..write('id: $id, ')
|
|
..write('amount: $amount, ')
|
|
..write('expenseCategoryId: $expenseCategoryId, ')
|
|
..write('budgetId: $budgetId')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, amount, expenseCategoryId, budgetId);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is BudgetItem &&
|
|
other.id == this.id &&
|
|
other.amount == this.amount &&
|
|
other.expenseCategoryId == this.expenseCategoryId &&
|
|
other.budgetId == this.budgetId);
|
|
}
|
|
|
|
class BudgetItemsCompanion extends UpdateCompanion<BudgetItem> {
|
|
final Value<int> id;
|
|
final Value<double> amount;
|
|
final Value<int> expenseCategoryId;
|
|
final Value<int> budgetId;
|
|
const BudgetItemsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.amount = const Value.absent(),
|
|
this.expenseCategoryId = const Value.absent(),
|
|
this.budgetId = const Value.absent(),
|
|
});
|
|
BudgetItemsCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required double amount,
|
|
required int expenseCategoryId,
|
|
required int budgetId,
|
|
}) : amount = Value(amount),
|
|
expenseCategoryId = Value(expenseCategoryId),
|
|
budgetId = Value(budgetId);
|
|
static Insertable<BudgetItem> custom({
|
|
Expression<int>? id,
|
|
Expression<double>? amount,
|
|
Expression<int>? expenseCategoryId,
|
|
Expression<int>? budgetId,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (amount != null) 'amount': amount,
|
|
if (expenseCategoryId != null) 'expense_category_id': expenseCategoryId,
|
|
if (budgetId != null) 'budget_id': budgetId,
|
|
});
|
|
}
|
|
|
|
BudgetItemsCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<double>? amount,
|
|
Value<int>? expenseCategoryId,
|
|
Value<int>? budgetId,
|
|
}) {
|
|
return BudgetItemsCompanion(
|
|
id: id ?? this.id,
|
|
amount: amount ?? this.amount,
|
|
expenseCategoryId: expenseCategoryId ?? this.expenseCategoryId,
|
|
budgetId: budgetId ?? this.budgetId,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (amount.present) {
|
|
map['amount'] = Variable<double>(amount.value);
|
|
}
|
|
if (expenseCategoryId.present) {
|
|
map['expense_category_id'] = Variable<int>(expenseCategoryId.value);
|
|
}
|
|
if (budgetId.present) {
|
|
map['budget_id'] = Variable<int>(budgetId.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('BudgetItemsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('amount: $amount, ')
|
|
..write('expenseCategoryId: $expenseCategoryId, ')
|
|
..write('budgetId: $budgetId')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $LoansTable extends Loans with TableInfo<$LoansTable, Loan> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$LoansTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'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<int> beneficiaryId = GeneratedColumn<int>(
|
|
'beneficiary_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES beneficiaries (id)',
|
|
),
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [id, beneficiaryId];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'loans';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Loan> 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('beneficiary_id')) {
|
|
context.handle(
|
|
_beneficiaryIdMeta,
|
|
beneficiaryId.isAcceptableOrUnknown(
|
|
data['beneficiary_id']!,
|
|
_beneficiaryIdMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_beneficiaryIdMeta);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
Loan map(Map<String, dynamic> 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'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$LoansTable createAlias(String alias) {
|
|
return $LoansTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Loan extends DataClass implements Insertable<Loan> {
|
|
final int id;
|
|
final int beneficiaryId;
|
|
const Loan({required this.id, required this.beneficiaryId});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['beneficiary_id'] = Variable<int>(beneficiaryId);
|
|
return map;
|
|
}
|
|
|
|
LoansCompanion toCompanion(bool nullToAbsent) {
|
|
return LoansCompanion(id: Value(id), beneficiaryId: Value(beneficiaryId));
|
|
}
|
|
|
|
factory Loan.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Loan(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
beneficiaryId: serializer.fromJson<int>(json['beneficiaryId']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'beneficiaryId': serializer.toJson<int>(beneficiaryId),
|
|
};
|
|
}
|
|
|
|
Loan copyWith({int? id, int? beneficiaryId}) => Loan(
|
|
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,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Loan(')
|
|
..write('id: $id, ')
|
|
..write('beneficiaryId: $beneficiaryId')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, beneficiaryId);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Loan &&
|
|
other.id == this.id &&
|
|
other.beneficiaryId == this.beneficiaryId);
|
|
}
|
|
|
|
class LoansCompanion extends UpdateCompanion<Loan> {
|
|
final Value<int> id;
|
|
final Value<int> beneficiaryId;
|
|
const LoansCompanion({
|
|
this.id = const Value.absent(),
|
|
this.beneficiaryId = const Value.absent(),
|
|
});
|
|
LoansCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required int beneficiaryId,
|
|
}) : beneficiaryId = Value(beneficiaryId);
|
|
static Insertable<Loan> custom({
|
|
Expression<int>? id,
|
|
Expression<int>? beneficiaryId,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (beneficiaryId != null) 'beneficiary_id': beneficiaryId,
|
|
});
|
|
}
|
|
|
|
LoansCompanion copyWith({Value<int>? id, Value<int>? beneficiaryId}) {
|
|
return LoansCompanion(
|
|
id: id ?? this.id,
|
|
beneficiaryId: beneficiaryId ?? this.beneficiaryId,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (beneficiaryId.present) {
|
|
map['beneficiary_id'] = Variable<int>(beneficiaryId.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('LoansCompanion(')
|
|
..write('id: $id, ')
|
|
..write('beneficiaryId: $beneficiaryId')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $LoanChangesTable extends LoanChanges
|
|
with TableInfo<$LoanChangesTable, LoanChange> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$LoanChangesTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'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<int> loanId = GeneratedColumn<int>(
|
|
'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<double> amount = GeneratedColumn<double>(
|
|
'amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _dateMeta = const VerificationMeta('date');
|
|
@override
|
|
late final GeneratedColumn<DateTime> date = GeneratedColumn<DateTime>(
|
|
'date',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: true,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [id, loanId, amount, date];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'loan_changes';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<LoanChange> 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),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_loanIdMeta);
|
|
}
|
|
if (data.containsKey('amount')) {
|
|
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),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_dateMeta);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
LoanChange map(Map<String, dynamic> 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'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$LoanChangesTable createAlias(String alias) {
|
|
return $LoanChangesTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class LoanChange extends DataClass implements Insertable<LoanChange> {
|
|
final int id;
|
|
final int loanId;
|
|
final double amount;
|
|
final DateTime date;
|
|
const LoanChange({
|
|
required this.id,
|
|
required this.loanId,
|
|
required this.amount,
|
|
required this.date,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['loan_id'] = Variable<int>(loanId);
|
|
map['amount'] = Variable<double>(amount);
|
|
map['date'] = Variable<DateTime>(date);
|
|
return map;
|
|
}
|
|
|
|
LoanChangesCompanion toCompanion(bool nullToAbsent) {
|
|
return LoanChangesCompanion(
|
|
id: Value(id),
|
|
loanId: Value(loanId),
|
|
amount: Value(amount),
|
|
date: Value(date),
|
|
);
|
|
}
|
|
|
|
factory LoanChange.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return LoanChange(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
loanId: serializer.fromJson<int>(json['loanId']),
|
|
amount: serializer.fromJson<double>(json['amount']),
|
|
date: serializer.fromJson<DateTime>(json['date']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'loanId': serializer.toJson<int>(loanId),
|
|
'amount': serializer.toJson<double>(amount),
|
|
'date': serializer.toJson<DateTime>(date),
|
|
};
|
|
}
|
|
|
|
LoanChange copyWith({int? id, int? loanId, double? amount, DateTime? date}) =>
|
|
LoanChange(
|
|
id: id ?? this.id,
|
|
loanId: loanId ?? this.loanId,
|
|
amount: amount ?? this.amount,
|
|
date: date ?? this.date,
|
|
);
|
|
LoanChange copyWithCompanion(LoanChangesCompanion data) {
|
|
return LoanChange(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
loanId: data.loanId.present ? data.loanId.value : this.loanId,
|
|
amount: data.amount.present ? data.amount.value : this.amount,
|
|
date: data.date.present ? data.date.value : this.date,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('LoanChange(')
|
|
..write('id: $id, ')
|
|
..write('loanId: $loanId, ')
|
|
..write('amount: $amount, ')
|
|
..write('date: $date')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, loanId, amount, date);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is LoanChange &&
|
|
other.id == this.id &&
|
|
other.loanId == this.loanId &&
|
|
other.amount == this.amount &&
|
|
other.date == this.date);
|
|
}
|
|
|
|
class LoanChangesCompanion extends UpdateCompanion<LoanChange> {
|
|
final Value<int> id;
|
|
final Value<int> loanId;
|
|
final Value<double> amount;
|
|
final Value<DateTime> date;
|
|
const LoanChangesCompanion({
|
|
this.id = const Value.absent(),
|
|
this.loanId = const Value.absent(),
|
|
this.amount = const Value.absent(),
|
|
this.date = const Value.absent(),
|
|
});
|
|
LoanChangesCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required int loanId,
|
|
required double amount,
|
|
required DateTime date,
|
|
}) : loanId = Value(loanId),
|
|
amount = Value(amount),
|
|
date = Value(date);
|
|
static Insertable<LoanChange> custom({
|
|
Expression<int>? id,
|
|
Expression<int>? loanId,
|
|
Expression<double>? amount,
|
|
Expression<DateTime>? date,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (loanId != null) 'loan_id': loanId,
|
|
if (amount != null) 'amount': amount,
|
|
if (date != null) 'date': date,
|
|
});
|
|
}
|
|
|
|
LoanChangesCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<int>? loanId,
|
|
Value<double>? amount,
|
|
Value<DateTime>? date,
|
|
}) {
|
|
return LoanChangesCompanion(
|
|
id: id ?? this.id,
|
|
loanId: loanId ?? this.loanId,
|
|
amount: amount ?? this.amount,
|
|
date: date ?? this.date,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (loanId.present) {
|
|
map['loan_id'] = Variable<int>(loanId.value);
|
|
}
|
|
if (amount.present) {
|
|
map['amount'] = Variable<double>(amount.value);
|
|
}
|
|
if (date.present) {
|
|
map['date'] = Variable<DateTime>(date.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('LoanChangesCompanion(')
|
|
..write('id: $id, ')
|
|
..write('loanId: $loanId, ')
|
|
..write('amount: $amount, ')
|
|
..write('date: $date')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $TransactionTemplatesTable extends TransactionTemplates
|
|
with TableInfo<$TransactionTemplatesTable, TransactionTemplate> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$TransactionTemplatesTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'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<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _amountMeta = const VerificationMeta('amount');
|
|
@override
|
|
late final GeneratedColumn<double> amount = GeneratedColumn<double>(
|
|
'amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _recurringMeta = const VerificationMeta(
|
|
'recurring',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> recurring = GeneratedColumn<bool>(
|
|
'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<int> expenseCategoryId = GeneratedColumn<int>(
|
|
'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<int> beneficiaryId = GeneratedColumn<int>(
|
|
'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<int> accountId = GeneratedColumn<int>(
|
|
'account_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES accounts (id)',
|
|
),
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
id,
|
|
name,
|
|
amount,
|
|
recurring,
|
|
expenseCategoryId,
|
|
beneficiaryId,
|
|
accountId,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'transaction_templates';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<TransactionTemplate> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('amount')) {
|
|
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),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_recurringMeta);
|
|
}
|
|
if (data.containsKey('expense_category_id')) {
|
|
context.handle(
|
|
_expenseCategoryIdMeta,
|
|
expenseCategoryId.isAcceptableOrUnknown(
|
|
data['expense_category_id']!,
|
|
_expenseCategoryIdMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('beneficiary_id')) {
|
|
context.handle(
|
|
_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),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_accountIdMeta);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
TransactionTemplate map(Map<String, dynamic> 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'],
|
|
)!,
|
|
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'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$TransactionTemplatesTable createAlias(String alias) {
|
|
return $TransactionTemplatesTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class TransactionTemplate extends DataClass
|
|
implements Insertable<TransactionTemplate> {
|
|
final int id;
|
|
final String name;
|
|
final double amount;
|
|
final bool recurring;
|
|
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,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['name'] = Variable<String>(name);
|
|
map['amount'] = Variable<double>(amount);
|
|
map['recurring'] = Variable<bool>(recurring);
|
|
if (!nullToAbsent || expenseCategoryId != null) {
|
|
map['expense_category_id'] = Variable<int>(expenseCategoryId);
|
|
}
|
|
map['beneficiary_id'] = Variable<int>(beneficiaryId);
|
|
map['account_id'] = Variable<int>(accountId);
|
|
return map;
|
|
}
|
|
|
|
TransactionTemplatesCompanion toCompanion(bool nullToAbsent) {
|
|
return TransactionTemplatesCompanion(
|
|
id: Value(id),
|
|
name: Value(name),
|
|
amount: Value(amount),
|
|
recurring: Value(recurring),
|
|
expenseCategoryId:
|
|
expenseCategoryId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(expenseCategoryId),
|
|
beneficiaryId: Value(beneficiaryId),
|
|
accountId: Value(accountId),
|
|
);
|
|
}
|
|
|
|
factory TransactionTemplate.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return TransactionTemplate(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
amount: serializer.fromJson<double>(json['amount']),
|
|
recurring: serializer.fromJson<bool>(json['recurring']),
|
|
expenseCategoryId: serializer.fromJson<int?>(json['expenseCategoryId']),
|
|
beneficiaryId: serializer.fromJson<int>(json['beneficiaryId']),
|
|
accountId: serializer.fromJson<int>(json['accountId']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'name': serializer.toJson<String>(name),
|
|
'amount': serializer.toJson<double>(amount),
|
|
'recurring': serializer.toJson<bool>(recurring),
|
|
'expenseCategoryId': serializer.toJson<int?>(expenseCategoryId),
|
|
'beneficiaryId': serializer.toJson<int>(beneficiaryId),
|
|
'accountId': serializer.toJson<int>(accountId),
|
|
};
|
|
}
|
|
|
|
TransactionTemplate copyWith({
|
|
int? id,
|
|
String? name,
|
|
double? amount,
|
|
bool? recurring,
|
|
Value<int?> 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,
|
|
);
|
|
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,
|
|
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('TransactionTemplate(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('amount: $amount, ')
|
|
..write('recurring: $recurring, ')
|
|
..write('expenseCategoryId: $expenseCategoryId, ')
|
|
..write('beneficiaryId: $beneficiaryId, ')
|
|
..write('accountId: $accountId')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
id,
|
|
name,
|
|
amount,
|
|
recurring,
|
|
expenseCategoryId,
|
|
beneficiaryId,
|
|
accountId,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is TransactionTemplate &&
|
|
other.id == this.id &&
|
|
other.name == this.name &&
|
|
other.amount == this.amount &&
|
|
other.recurring == this.recurring &&
|
|
other.expenseCategoryId == this.expenseCategoryId &&
|
|
other.beneficiaryId == this.beneficiaryId &&
|
|
other.accountId == this.accountId);
|
|
}
|
|
|
|
class TransactionTemplatesCompanion
|
|
extends UpdateCompanion<TransactionTemplate> {
|
|
final Value<int> id;
|
|
final Value<String> name;
|
|
final Value<double> amount;
|
|
final Value<bool> recurring;
|
|
final Value<int?> expenseCategoryId;
|
|
final Value<int> beneficiaryId;
|
|
final Value<int> accountId;
|
|
const TransactionTemplatesCompanion({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.amount = const Value.absent(),
|
|
this.recurring = const Value.absent(),
|
|
this.expenseCategoryId = const Value.absent(),
|
|
this.beneficiaryId = const Value.absent(),
|
|
this.accountId = const Value.absent(),
|
|
});
|
|
TransactionTemplatesCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required String name,
|
|
required double amount,
|
|
required bool recurring,
|
|
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);
|
|
static Insertable<TransactionTemplate> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? name,
|
|
Expression<double>? amount,
|
|
Expression<bool>? recurring,
|
|
Expression<int>? expenseCategoryId,
|
|
Expression<int>? beneficiaryId,
|
|
Expression<int>? accountId,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (name != null) 'name': name,
|
|
if (amount != null) 'amount': amount,
|
|
if (recurring != null) 'recurring': recurring,
|
|
if (expenseCategoryId != null) 'expense_category_id': expenseCategoryId,
|
|
if (beneficiaryId != null) 'beneficiary_id': beneficiaryId,
|
|
if (accountId != null) 'account_id': accountId,
|
|
});
|
|
}
|
|
|
|
TransactionTemplatesCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<String>? name,
|
|
Value<double>? amount,
|
|
Value<bool>? recurring,
|
|
Value<int?>? expenseCategoryId,
|
|
Value<int>? beneficiaryId,
|
|
Value<int>? accountId,
|
|
}) {
|
|
return TransactionTemplatesCompanion(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
amount: amount ?? this.amount,
|
|
recurring: recurring ?? this.recurring,
|
|
expenseCategoryId: expenseCategoryId ?? this.expenseCategoryId,
|
|
beneficiaryId: beneficiaryId ?? this.beneficiaryId,
|
|
accountId: accountId ?? this.accountId,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (amount.present) {
|
|
map['amount'] = Variable<double>(amount.value);
|
|
}
|
|
if (recurring.present) {
|
|
map['recurring'] = Variable<bool>(recurring.value);
|
|
}
|
|
if (expenseCategoryId.present) {
|
|
map['expense_category_id'] = Variable<int>(expenseCategoryId.value);
|
|
}
|
|
if (beneficiaryId.present) {
|
|
map['beneficiary_id'] = Variable<int>(beneficiaryId.value);
|
|
}
|
|
if (accountId.present) {
|
|
map['account_id'] = Variable<int>(accountId.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('TransactionTemplatesCompanion(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('amount: $amount, ')
|
|
..write('recurring: $recurring, ')
|
|
..write('expenseCategoryId: $expenseCategoryId, ')
|
|
..write('beneficiaryId: $beneficiaryId, ')
|
|
..write('accountId: $accountId')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $RecurringTransactionsTable extends RecurringTransactions
|
|
with TableInfo<$RecurringTransactionsTable, RecurringTransaction> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$RecurringTransactionsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'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<int> days = GeneratedColumn<int>(
|
|
'days',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _lastExecutionMeta = const VerificationMeta(
|
|
'lastExecution',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> lastExecution =
|
|
GeneratedColumn<DateTime>(
|
|
'last_execution',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _templateIdMeta = const VerificationMeta(
|
|
'templateId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> templateId = GeneratedColumn<int>(
|
|
'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<int> accountId = GeneratedColumn<int>(
|
|
'account_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES accounts (id)',
|
|
),
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
id,
|
|
days,
|
|
lastExecution,
|
|
templateId,
|
|
accountId,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'recurring_transactions';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<RecurringTransaction> 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('days')) {
|
|
context.handle(
|
|
_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,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('template_id')) {
|
|
context.handle(
|
|
_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),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_accountIdMeta);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
RecurringTransaction map(Map<String, dynamic> 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'],
|
|
)!,
|
|
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'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$RecurringTransactionsTable createAlias(String alias) {
|
|
return $RecurringTransactionsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class RecurringTransaction extends DataClass
|
|
implements Insertable<RecurringTransaction> {
|
|
final int id;
|
|
final int days;
|
|
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,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['days'] = Variable<int>(days);
|
|
if (!nullToAbsent || lastExecution != null) {
|
|
map['last_execution'] = Variable<DateTime>(lastExecution);
|
|
}
|
|
map['template_id'] = Variable<int>(templateId);
|
|
map['account_id'] = Variable<int>(accountId);
|
|
return map;
|
|
}
|
|
|
|
RecurringTransactionsCompanion toCompanion(bool nullToAbsent) {
|
|
return RecurringTransactionsCompanion(
|
|
id: Value(id),
|
|
days: Value(days),
|
|
lastExecution:
|
|
lastExecution == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(lastExecution),
|
|
templateId: Value(templateId),
|
|
accountId: Value(accountId),
|
|
);
|
|
}
|
|
|
|
factory RecurringTransaction.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return RecurringTransaction(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
days: serializer.fromJson<int>(json['days']),
|
|
lastExecution: serializer.fromJson<DateTime?>(json['lastExecution']),
|
|
templateId: serializer.fromJson<int>(json['templateId']),
|
|
accountId: serializer.fromJson<int>(json['accountId']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'days': serializer.toJson<int>(days),
|
|
'lastExecution': serializer.toJson<DateTime?>(lastExecution),
|
|
'templateId': serializer.toJson<int>(templateId),
|
|
'accountId': serializer.toJson<int>(accountId),
|
|
};
|
|
}
|
|
|
|
RecurringTransaction copyWith({
|
|
int? id,
|
|
int? days,
|
|
Value<DateTime?> 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,
|
|
templateId:
|
|
data.templateId.present ? data.templateId.value : this.templateId,
|
|
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('RecurringTransaction(')
|
|
..write('id: $id, ')
|
|
..write('days: $days, ')
|
|
..write('lastExecution: $lastExecution, ')
|
|
..write('templateId: $templateId, ')
|
|
..write('accountId: $accountId')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode =>
|
|
Object.hash(id, days, lastExecution, templateId, accountId);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is RecurringTransaction &&
|
|
other.id == this.id &&
|
|
other.days == this.days &&
|
|
other.lastExecution == this.lastExecution &&
|
|
other.templateId == this.templateId &&
|
|
other.accountId == this.accountId);
|
|
}
|
|
|
|
class RecurringTransactionsCompanion
|
|
extends UpdateCompanion<RecurringTransaction> {
|
|
final Value<int> id;
|
|
final Value<int> days;
|
|
final Value<DateTime?> lastExecution;
|
|
final Value<int> templateId;
|
|
final Value<int> accountId;
|
|
const RecurringTransactionsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.days = const Value.absent(),
|
|
this.lastExecution = const Value.absent(),
|
|
this.templateId = const Value.absent(),
|
|
this.accountId = const Value.absent(),
|
|
});
|
|
RecurringTransactionsCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required int days,
|
|
this.lastExecution = const Value.absent(),
|
|
required int templateId,
|
|
required int accountId,
|
|
}) : days = Value(days),
|
|
templateId = Value(templateId),
|
|
accountId = Value(accountId);
|
|
static Insertable<RecurringTransaction> custom({
|
|
Expression<int>? id,
|
|
Expression<int>? days,
|
|
Expression<DateTime>? lastExecution,
|
|
Expression<int>? templateId,
|
|
Expression<int>? accountId,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (days != null) 'days': days,
|
|
if (lastExecution != null) 'last_execution': lastExecution,
|
|
if (templateId != null) 'template_id': templateId,
|
|
if (accountId != null) 'account_id': accountId,
|
|
});
|
|
}
|
|
|
|
RecurringTransactionsCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<int>? days,
|
|
Value<DateTime?>? lastExecution,
|
|
Value<int>? templateId,
|
|
Value<int>? accountId,
|
|
}) {
|
|
return RecurringTransactionsCompanion(
|
|
id: id ?? this.id,
|
|
days: days ?? this.days,
|
|
lastExecution: lastExecution ?? this.lastExecution,
|
|
templateId: templateId ?? this.templateId,
|
|
accountId: accountId ?? this.accountId,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (days.present) {
|
|
map['days'] = Variable<int>(days.value);
|
|
}
|
|
if (lastExecution.present) {
|
|
map['last_execution'] = Variable<DateTime>(lastExecution.value);
|
|
}
|
|
if (templateId.present) {
|
|
map['template_id'] = Variable<int>(templateId.value);
|
|
}
|
|
if (accountId.present) {
|
|
map['account_id'] = Variable<int>(accountId.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('RecurringTransactionsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('days: $days, ')
|
|
..write('lastExecution: $lastExecution, ')
|
|
..write('templateId: $templateId, ')
|
|
..write('accountId: $accountId')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $TransactionsTable extends Transactions
|
|
with TableInfo<$TransactionsTable, Transaction> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$TransactionsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'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<double> amount = GeneratedColumn<double>(
|
|
'amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _dateMeta = const VerificationMeta('date');
|
|
@override
|
|
late final GeneratedColumn<DateTime> date = GeneratedColumn<DateTime>(
|
|
'date',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _expenseCategoryIdMeta = const VerificationMeta(
|
|
'expenseCategoryId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> expenseCategoryId = GeneratedColumn<int>(
|
|
'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<int> accountId = GeneratedColumn<int>(
|
|
'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<int> beneficiaryId = GeneratedColumn<int>(
|
|
'beneficiary_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES beneficiaries (id)',
|
|
),
|
|
);
|
|
@override
|
|
List<GeneratedColumn> 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<Transaction> 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),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_amountMeta);
|
|
}
|
|
if (data.containsKey('date')) {
|
|
context.handle(
|
|
_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,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('account_id')) {
|
|
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,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_beneficiaryIdMeta);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
Transaction map(Map<String, dynamic> 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'],
|
|
)!,
|
|
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'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$TransactionsTable createAlias(String alias) {
|
|
return $TransactionsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Transaction extends DataClass implements Insertable<Transaction> {
|
|
final int id;
|
|
final double amount;
|
|
final DateTime date;
|
|
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,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['amount'] = Variable<double>(amount);
|
|
map['date'] = Variable<DateTime>(date);
|
|
if (!nullToAbsent || expenseCategoryId != null) {
|
|
map['expense_category_id'] = Variable<int>(expenseCategoryId);
|
|
}
|
|
map['account_id'] = Variable<int>(accountId);
|
|
map['beneficiary_id'] = Variable<int>(beneficiaryId);
|
|
return map;
|
|
}
|
|
|
|
TransactionsCompanion toCompanion(bool nullToAbsent) {
|
|
return TransactionsCompanion(
|
|
id: Value(id),
|
|
amount: Value(amount),
|
|
date: Value(date),
|
|
expenseCategoryId:
|
|
expenseCategoryId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(expenseCategoryId),
|
|
accountId: Value(accountId),
|
|
beneficiaryId: Value(beneficiaryId),
|
|
);
|
|
}
|
|
|
|
factory Transaction.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Transaction(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
amount: serializer.fromJson<double>(json['amount']),
|
|
date: serializer.fromJson<DateTime>(json['date']),
|
|
expenseCategoryId: serializer.fromJson<int?>(json['expenseCategoryId']),
|
|
accountId: serializer.fromJson<int>(json['accountId']),
|
|
beneficiaryId: serializer.fromJson<int>(json['beneficiaryId']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'amount': serializer.toJson<double>(amount),
|
|
'date': serializer.toJson<DateTime>(date),
|
|
'expenseCategoryId': serializer.toJson<int?>(expenseCategoryId),
|
|
'accountId': serializer.toJson<int>(accountId),
|
|
'beneficiaryId': serializer.toJson<int>(beneficiaryId),
|
|
};
|
|
}
|
|
|
|
Transaction copyWith({
|
|
int? id,
|
|
double? amount,
|
|
DateTime? date,
|
|
Value<int?> 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,
|
|
);
|
|
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,
|
|
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
|
beneficiaryId:
|
|
data.beneficiaryId.present
|
|
? data.beneficiaryId.value
|
|
: this.beneficiaryId,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Transaction(')
|
|
..write('id: $id, ')
|
|
..write('amount: $amount, ')
|
|
..write('date: $date, ')
|
|
..write('expenseCategoryId: $expenseCategoryId, ')
|
|
..write('accountId: $accountId, ')
|
|
..write('beneficiaryId: $beneficiaryId')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
id,
|
|
amount,
|
|
date,
|
|
expenseCategoryId,
|
|
accountId,
|
|
beneficiaryId,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Transaction &&
|
|
other.id == this.id &&
|
|
other.amount == this.amount &&
|
|
other.date == this.date &&
|
|
other.expenseCategoryId == this.expenseCategoryId &&
|
|
other.accountId == this.accountId &&
|
|
other.beneficiaryId == this.beneficiaryId);
|
|
}
|
|
|
|
class TransactionsCompanion extends UpdateCompanion<Transaction> {
|
|
final Value<int> id;
|
|
final Value<double> amount;
|
|
final Value<DateTime> date;
|
|
final Value<int?> expenseCategoryId;
|
|
final Value<int> accountId;
|
|
final Value<int> beneficiaryId;
|
|
const TransactionsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.amount = const Value.absent(),
|
|
this.date = const Value.absent(),
|
|
this.expenseCategoryId = const Value.absent(),
|
|
this.accountId = const Value.absent(),
|
|
this.beneficiaryId = const Value.absent(),
|
|
});
|
|
TransactionsCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required double amount,
|
|
required DateTime date,
|
|
this.expenseCategoryId = const Value.absent(),
|
|
required int accountId,
|
|
required int beneficiaryId,
|
|
}) : amount = Value(amount),
|
|
date = Value(date),
|
|
accountId = Value(accountId),
|
|
beneficiaryId = Value(beneficiaryId);
|
|
static Insertable<Transaction> custom({
|
|
Expression<int>? id,
|
|
Expression<double>? amount,
|
|
Expression<DateTime>? date,
|
|
Expression<int>? expenseCategoryId,
|
|
Expression<int>? accountId,
|
|
Expression<int>? beneficiaryId,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (amount != null) 'amount': amount,
|
|
if (date != null) 'date': date,
|
|
if (expenseCategoryId != null) 'expense_category_id': expenseCategoryId,
|
|
if (accountId != null) 'account_id': accountId,
|
|
if (beneficiaryId != null) 'beneficiary_id': beneficiaryId,
|
|
});
|
|
}
|
|
|
|
TransactionsCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<double>? amount,
|
|
Value<DateTime>? date,
|
|
Value<int?>? expenseCategoryId,
|
|
Value<int>? accountId,
|
|
Value<int>? beneficiaryId,
|
|
}) {
|
|
return TransactionsCompanion(
|
|
id: id ?? this.id,
|
|
amount: amount ?? this.amount,
|
|
date: date ?? this.date,
|
|
expenseCategoryId: expenseCategoryId ?? this.expenseCategoryId,
|
|
accountId: accountId ?? this.accountId,
|
|
beneficiaryId: beneficiaryId ?? this.beneficiaryId,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (amount.present) {
|
|
map['amount'] = Variable<double>(amount.value);
|
|
}
|
|
if (date.present) {
|
|
map['date'] = Variable<DateTime>(date.value);
|
|
}
|
|
if (expenseCategoryId.present) {
|
|
map['expense_category_id'] = Variable<int>(expenseCategoryId.value);
|
|
}
|
|
if (accountId.present) {
|
|
map['account_id'] = Variable<int>(accountId.value);
|
|
}
|
|
if (beneficiaryId.present) {
|
|
map['beneficiary_id'] = Variable<int>(beneficiaryId.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('TransactionsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('amount: $amount, ')
|
|
..write('date: $date, ')
|
|
..write('expenseCategoryId: $expenseCategoryId, ')
|
|
..write('accountId: $accountId, ')
|
|
..write('beneficiaryId: $beneficiaryId')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
abstract class _$OkaneDatabase extends GeneratedDatabase {
|
|
_$OkaneDatabase(QueryExecutor e) : super(e);
|
|
$OkaneDatabaseManager get managers => $OkaneDatabaseManager(this);
|
|
late final $AccountsTable accounts = $AccountsTable(this);
|
|
late final $BeneficiariesTable beneficiaries = $BeneficiariesTable(this);
|
|
late final $BudgetsTable budgets = $BudgetsTable(this);
|
|
late final $ExpenseCategoriesTable expenseCategories =
|
|
$ExpenseCategoriesTable(this);
|
|
late final $BudgetItemsTable budgetItems = $BudgetItemsTable(this);
|
|
late final $LoansTable loans = $LoansTable(this);
|
|
late final $LoanChangesTable loanChanges = $LoanChangesTable(this);
|
|
late final $TransactionTemplatesTable transactionTemplates =
|
|
$TransactionTemplatesTable(this);
|
|
late final $RecurringTransactionsTable recurringTransactions =
|
|
$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 BudgetsDao budgetsDao = BudgetsDao(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,
|
|
);
|
|
@override
|
|
Iterable<TableInfo<Table, Object?>> get allTables =>
|
|
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
|
@override
|
|
List<DatabaseSchemaEntity> get allSchemaEntities => [
|
|
accounts,
|
|
beneficiaries,
|
|
budgets,
|
|
expenseCategories,
|
|
budgetItems,
|
|
loans,
|
|
loanChanges,
|
|
transactionTemplates,
|
|
recurringTransactions,
|
|
transactions,
|
|
];
|
|
}
|
|
|
|
typedef $$AccountsTableCreateCompanionBuilder =
|
|
AccountsCompanion Function({Value<int> id, required String name});
|
|
typedef $$AccountsTableUpdateCompanionBuilder =
|
|
AccountsCompanion Function({Value<int> id, Value<String> name});
|
|
|
|
final class $$AccountsTableReferences
|
|
extends BaseReferences<_$OkaneDatabase, $AccountsTable, Account> {
|
|
$$AccountsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static MultiTypedResultKey<$BeneficiariesTable, List<Beneficiary>>
|
|
_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<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_beneficiariesRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$BudgetsTable, List<Budget>> _budgetsRefsTable(
|
|
_$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<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_budgetsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<
|
|
$TransactionTemplatesTable,
|
|
List<TransactionTemplate>
|
|
>
|
|
_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<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(
|
|
_transactionTemplatesRefsTable($_db),
|
|
);
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<
|
|
$RecurringTransactionsTable,
|
|
List<RecurringTransaction>
|
|
>
|
|
_recurringTransactionsRefsTable(_$OkaneDatabase db) =>
|
|
MultiTypedResultKey.fromTable(
|
|
db.recurringTransactions,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.accounts.id,
|
|
db.recurringTransactions.accountId,
|
|
),
|
|
);
|
|
|
|
$$RecurringTransactionsTableProcessedTableManager
|
|
get recurringTransactionsRefs {
|
|
final manager = $$RecurringTransactionsTableTableManager(
|
|
$_db,
|
|
$_db.recurringTransactions,
|
|
).filter((f) => f.accountId.id.sqlEquals($_itemColumn<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(
|
|
_recurringTransactionsRefsTable($_db),
|
|
);
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$TransactionsTable, List<Transaction>>
|
|
_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<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_transactionsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$AccountsTableFilterComposer
|
|
extends Composer<_$OkaneDatabase, $AccountsTable> {
|
|
$$AccountsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
Expression<bool> beneficiariesRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> budgetsRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> transactionTemplatesRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> recurringTransactionsRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> transactionsRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$AccountsTableOrderingComposer
|
|
extends Composer<_$OkaneDatabase, $AccountsTable> {
|
|
$$AccountsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$AccountsTableAnnotationComposer
|
|
extends Composer<_$OkaneDatabase, $AccountsTable> {
|
|
$$AccountsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
Expression<T> beneficiariesRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> budgetsRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> transactionTemplatesRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> recurringTransactionsRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> transactionsRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
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,
|
|
})
|
|
> {
|
|
$$AccountsTableTableManager(_$OkaneDatabase db, $AccountsTable table)
|
|
: 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<int> id = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
}) => AccountsCompanion(id: id, name: name),
|
|
createCompanionCallback:
|
|
({Value<int> 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: [
|
|
if (beneficiariesRefs) db.beneficiaries,
|
|
if (budgetsRefs) db.budgets,
|
|
if (transactionTemplatesRefs) db.transactionTemplates,
|
|
if (recurringTransactionsRefs) db.recurringTransactions,
|
|
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,
|
|
),
|
|
if (budgetsRefs)
|
|
await $_getPrefetchedData<Account, $AccountsTable, Budget>(
|
|
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,
|
|
),
|
|
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,
|
|
),
|
|
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,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
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<int> id,
|
|
required String name,
|
|
required BeneficiaryType type,
|
|
Value<int?> accountId,
|
|
Value<String?> imagePath,
|
|
});
|
|
typedef $$BeneficiariesTableUpdateCompanionBuilder =
|
|
BeneficiariesCompanion Function({
|
|
Value<int> id,
|
|
Value<String> name,
|
|
Value<BeneficiaryType> type,
|
|
Value<int?> accountId,
|
|
Value<String?> imagePath,
|
|
});
|
|
|
|
final class $$BeneficiariesTableReferences
|
|
extends BaseReferences<_$OkaneDatabase, $BeneficiariesTable, Beneficiary> {
|
|
$$BeneficiariesTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static $AccountsTable _accountIdTable(_$OkaneDatabase db) =>
|
|
db.accounts.createAlias(
|
|
$_aliasNameGenerator(db.beneficiaries.accountId, db.accounts.id),
|
|
);
|
|
|
|
$$AccountsTableProcessedTableManager? get accountId {
|
|
final $_column = $_itemColumn<int>('account_id');
|
|
if ($_column == null) return null;
|
|
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]),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$LoansTable, List<Loan>> _loansRefsTable(
|
|
_$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<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_loansRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<
|
|
$TransactionTemplatesTable,
|
|
List<TransactionTemplate>
|
|
>
|
|
_transactionTemplatesRefsTable(_$OkaneDatabase db) =>
|
|
MultiTypedResultKey.fromTable(
|
|
db.transactionTemplates,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.beneficiaries.id,
|
|
db.transactionTemplates.beneficiaryId,
|
|
),
|
|
);
|
|
|
|
$$TransactionTemplatesTableProcessedTableManager
|
|
get transactionTemplatesRefs {
|
|
final manager = $$TransactionTemplatesTableTableManager(
|
|
$_db,
|
|
$_db.transactionTemplates,
|
|
).filter((f) => f.beneficiaryId.id.sqlEquals($_itemColumn<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(
|
|
_transactionTemplatesRefsTable($_db),
|
|
);
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$TransactionsTable, List<Transaction>>
|
|
_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<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_transactionsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$BeneficiariesTableFilterComposer
|
|
extends Composer<_$OkaneDatabase, $BeneficiariesTable> {
|
|
$$BeneficiariesTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnWithTypeConverterFilters<BeneficiaryType, BeneficiaryType, String>
|
|
get type => $composableBuilder(
|
|
column: $table.type,
|
|
builder: (column) => ColumnWithTypeConverterFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get imagePath => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<bool> loansRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> transactionTemplatesRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> transactionsRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$BeneficiariesTableOrderingComposer
|
|
extends Composer<_$OkaneDatabase, $BeneficiariesTable> {
|
|
$$BeneficiariesTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get type => $composableBuilder(
|
|
column: $table.type,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get imagePath => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$BeneficiariesTableAnnotationComposer
|
|
extends Composer<_$OkaneDatabase, $BeneficiariesTable> {
|
|
$$BeneficiariesTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumnWithTypeConverter<BeneficiaryType, String> get type =>
|
|
$composableBuilder(column: $table.type, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get imagePath =>
|
|
$composableBuilder(column: $table.imagePath, 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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<T> loansRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> transactionTemplatesRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> transactionsRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
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,
|
|
})
|
|
> {
|
|
$$BeneficiariesTableTableManager(
|
|
_$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<int> id = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<BeneficiaryType> type = const Value.absent(),
|
|
Value<int?> accountId = const Value.absent(),
|
|
Value<String?> imagePath = const Value.absent(),
|
|
}) => BeneficiariesCompanion(
|
|
id: id,
|
|
name: name,
|
|
type: type,
|
|
accountId: accountId,
|
|
imagePath: imagePath,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
required String name,
|
|
required BeneficiaryType type,
|
|
Value<int?> accountId = const Value.absent(),
|
|
Value<String?> 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,
|
|
],
|
|
addJoins: <
|
|
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;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
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,
|
|
),
|
|
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,
|
|
),
|
|
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,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
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<int> id,
|
|
required BudgetPeriod period,
|
|
required String name,
|
|
required double income,
|
|
required bool includeOtherSpendings,
|
|
required int accountId,
|
|
});
|
|
typedef $$BudgetsTableUpdateCompanionBuilder =
|
|
BudgetsCompanion Function({
|
|
Value<int> id,
|
|
Value<BudgetPeriod> period,
|
|
Value<String> name,
|
|
Value<double> income,
|
|
Value<bool> includeOtherSpendings,
|
|
Value<int> accountId,
|
|
});
|
|
|
|
final class $$BudgetsTableReferences
|
|
extends BaseReferences<_$OkaneDatabase, $BudgetsTable, Budget> {
|
|
$$BudgetsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $AccountsTable _accountIdTable(_$OkaneDatabase db) => db.accounts
|
|
.createAlias($_aliasNameGenerator(db.budgets.accountId, db.accounts.id));
|
|
|
|
$$AccountsTableProcessedTableManager get accountId {
|
|
final $_column = $_itemColumn<int>('account_id')!;
|
|
|
|
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]),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$BudgetItemsTable, List<BudgetItem>>
|
|
_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<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_budgetItemsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$BudgetsTableFilterComposer
|
|
extends Composer<_$OkaneDatabase, $BudgetsTable> {
|
|
$$BudgetsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnWithTypeConverterFilters<BudgetPeriod, BudgetPeriod, String>
|
|
get period => $composableBuilder(
|
|
column: $table.period,
|
|
builder: (column) => ColumnWithTypeConverterFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get income => $composableBuilder(
|
|
column: $table.income,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get includeOtherSpendings => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<bool> budgetItemsRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$BudgetsTableOrderingComposer
|
|
extends Composer<_$OkaneDatabase, $BudgetsTable> {
|
|
$$BudgetsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get period => $composableBuilder(
|
|
column: $table.period,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get income => $composableBuilder(
|
|
column: $table.income,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get includeOtherSpendings => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$BudgetsTableAnnotationComposer
|
|
extends Composer<_$OkaneDatabase, $BudgetsTable> {
|
|
$$BudgetsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumnWithTypeConverter<BudgetPeriod, String> get period =>
|
|
$composableBuilder(column: $table.period, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get income =>
|
|
$composableBuilder(column: $table.income, builder: (column) => column);
|
|
|
|
GeneratedColumn<bool> get includeOtherSpendings => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<T> budgetItemsRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
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(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer:
|
|
() => $$BudgetsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer:
|
|
() => $$BudgetsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer:
|
|
() => $$BudgetsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
Value<BudgetPeriod> period = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<double> income = const Value.absent(),
|
|
Value<bool> includeOtherSpendings = const Value.absent(),
|
|
Value<int> accountId = const Value.absent(),
|
|
}) => BudgetsCompanion(
|
|
id: id,
|
|
period: period,
|
|
name: name,
|
|
income: income,
|
|
includeOtherSpendings: includeOtherSpendings,
|
|
accountId: accountId,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> 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) {
|
|
if (accountId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.accountId,
|
|
referencedTable: $$BudgetsTableReferences
|
|
._accountIdTable(db),
|
|
referencedColumn:
|
|
$$BudgetsTableReferences._accountIdTable(db).id,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
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,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
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<int> id, required String name});
|
|
typedef $$ExpenseCategoriesTableUpdateCompanionBuilder =
|
|
ExpenseCategoriesCompanion Function({Value<int> id, Value<String> name});
|
|
|
|
final class $$ExpenseCategoriesTableReferences
|
|
extends
|
|
BaseReferences<
|
|
_$OkaneDatabase,
|
|
$ExpenseCategoriesTable,
|
|
ExpenseCategory
|
|
> {
|
|
$$ExpenseCategoriesTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static MultiTypedResultKey<$BudgetItemsTable, List<BudgetItem>>
|
|
_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<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_budgetItemsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<
|
|
$TransactionTemplatesTable,
|
|
List<TransactionTemplate>
|
|
>
|
|
_transactionTemplatesRefsTable(_$OkaneDatabase db) =>
|
|
MultiTypedResultKey.fromTable(
|
|
db.transactionTemplates,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.expenseCategories.id,
|
|
db.transactionTemplates.expenseCategoryId,
|
|
),
|
|
);
|
|
|
|
$$TransactionTemplatesTableProcessedTableManager
|
|
get transactionTemplatesRefs {
|
|
final manager = $$TransactionTemplatesTableTableManager(
|
|
$_db,
|
|
$_db.transactionTemplates,
|
|
).filter((f) => f.expenseCategoryId.id.sqlEquals($_itemColumn<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(
|
|
_transactionTemplatesRefsTable($_db),
|
|
);
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$TransactionsTable, List<Transaction>>
|
|
_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<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_transactionsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$ExpenseCategoriesTableFilterComposer
|
|
extends Composer<_$OkaneDatabase, $ExpenseCategoriesTable> {
|
|
$$ExpenseCategoriesTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
Expression<bool> budgetItemsRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> transactionTemplatesRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> transactionsRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$ExpenseCategoriesTableOrderingComposer
|
|
extends Composer<_$OkaneDatabase, $ExpenseCategoriesTable> {
|
|
$$ExpenseCategoriesTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$ExpenseCategoriesTableAnnotationComposer
|
|
extends Composer<_$OkaneDatabase, $ExpenseCategoriesTable> {
|
|
$$ExpenseCategoriesTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
Expression<T> budgetItemsRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> transactionTemplatesRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> transactionsRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
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,
|
|
})
|
|
> {
|
|
$$ExpenseCategoriesTableTableManager(
|
|
_$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<int> id = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
}) => ExpenseCategoriesCompanion(id: id, name: name),
|
|
createCompanionCallback:
|
|
({Value<int> 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,
|
|
],
|
|
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,
|
|
),
|
|
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,
|
|
),
|
|
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,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
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<int> id,
|
|
required double amount,
|
|
required int expenseCategoryId,
|
|
required int budgetId,
|
|
});
|
|
typedef $$BudgetItemsTableUpdateCompanionBuilder =
|
|
BudgetItemsCompanion Function({
|
|
Value<int> id,
|
|
Value<double> amount,
|
|
Value<int> expenseCategoryId,
|
|
Value<int> 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,
|
|
),
|
|
);
|
|
|
|
$$ExpenseCategoriesTableProcessedTableManager get expenseCategoryId {
|
|
final $_column = $_itemColumn<int>('expense_category_id')!;
|
|
|
|
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]),
|
|
);
|
|
}
|
|
|
|
static $BudgetsTable _budgetIdTable(_$OkaneDatabase db) =>
|
|
db.budgets.createAlias(
|
|
$_aliasNameGenerator(db.budgetItems.budgetId, db.budgets.id),
|
|
);
|
|
|
|
$$BudgetsTableProcessedTableManager get budgetId {
|
|
final $_column = $_itemColumn<int>('budget_id')!;
|
|
|
|
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]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$BudgetItemsTableFilterComposer
|
|
extends Composer<_$OkaneDatabase, $BudgetItemsTable> {
|
|
$$BudgetItemsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get amount => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$BudgetItemsTableOrderingComposer
|
|
extends Composer<_$OkaneDatabase, $BudgetItemsTable> {
|
|
$$BudgetItemsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get amount => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$BudgetItemsTableAnnotationComposer
|
|
extends Composer<_$OkaneDatabase, $BudgetItemsTable> {
|
|
$$BudgetItemsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get amount =>
|
|
$composableBuilder(column: $table.amount, builder: (column) => column);
|
|
|
|
$$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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
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(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer:
|
|
() => $$BudgetItemsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer:
|
|
() => $$BudgetItemsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer:
|
|
() =>
|
|
$$BudgetItemsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
Value<double> amount = const Value.absent(),
|
|
Value<int> expenseCategoryId = const Value.absent(),
|
|
Value<int> budgetId = const Value.absent(),
|
|
}) => BudgetItemsCompanion(
|
|
id: id,
|
|
amount: amount,
|
|
expenseCategoryId: expenseCategoryId,
|
|
budgetId: budgetId,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> 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) {
|
|
if (expenseCategoryId) {
|
|
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;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
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<int> id, required int beneficiaryId});
|
|
typedef $$LoansTableUpdateCompanionBuilder =
|
|
LoansCompanion Function({Value<int> id, Value<int> beneficiaryId});
|
|
|
|
final class $$LoansTableReferences
|
|
extends BaseReferences<_$OkaneDatabase, $LoansTable, Loan> {
|
|
$$LoansTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $BeneficiariesTable _beneficiaryIdTable(_$OkaneDatabase db) =>
|
|
db.beneficiaries.createAlias(
|
|
$_aliasNameGenerator(db.loans.beneficiaryId, db.beneficiaries.id),
|
|
);
|
|
|
|
$$BeneficiariesTableProcessedTableManager get beneficiaryId {
|
|
final $_column = $_itemColumn<int>('beneficiary_id')!;
|
|
|
|
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]),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$LoanChangesTable, List<LoanChange>>
|
|
_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<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_loanChangesRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$LoansTableFilterComposer
|
|
extends Composer<_$OkaneDatabase, $LoansTable> {
|
|
$$LoansTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<bool> loanChangesRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$LoansTableOrderingComposer
|
|
extends Composer<_$OkaneDatabase, $LoansTable> {
|
|
$$LoansTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$LoansTableAnnotationComposer
|
|
extends Composer<_$OkaneDatabase, $LoansTable> {
|
|
$$LoansTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
$$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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<T> loanChangesRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
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(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer:
|
|
() => $$LoansTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer:
|
|
() => $$LoansTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer:
|
|
() => $$LoansTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
Value<int> beneficiaryId = const Value.absent(),
|
|
}) => LoansCompanion(id: id, beneficiaryId: beneficiaryId),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> 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) {
|
|
if (beneficiaryId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.beneficiaryId,
|
|
referencedTable: $$LoansTableReferences
|
|
._beneficiaryIdTable(db),
|
|
referencedColumn:
|
|
$$LoansTableReferences
|
|
._beneficiaryIdTable(db)
|
|
.id,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (loanChangesRefs)
|
|
await $_getPrefetchedData<Loan, $LoansTable, LoanChange>(
|
|
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<int> id,
|
|
required int loanId,
|
|
required double amount,
|
|
required DateTime date,
|
|
});
|
|
typedef $$LoanChangesTableUpdateCompanionBuilder =
|
|
LoanChangesCompanion Function({
|
|
Value<int> id,
|
|
Value<int> loanId,
|
|
Value<double> amount,
|
|
Value<DateTime> 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),
|
|
);
|
|
|
|
$$LoansTableProcessedTableManager get loanId {
|
|
final $_column = $_itemColumn<int>('loan_id')!;
|
|
|
|
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]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$LoanChangesTableFilterComposer
|
|
extends Composer<_$OkaneDatabase, $LoanChangesTable> {
|
|
$$LoanChangesTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get date => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$LoanChangesTableOrderingComposer
|
|
extends Composer<_$OkaneDatabase, $LoanChangesTable> {
|
|
$$LoanChangesTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get date => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$LoanChangesTableAnnotationComposer
|
|
extends Composer<_$OkaneDatabase, $LoanChangesTable> {
|
|
$$LoanChangesTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get amount =>
|
|
$composableBuilder(column: $table.amount, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get date =>
|
|
$composableBuilder(column: $table.date, builder: (column) => column);
|
|
|
|
$$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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
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(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer:
|
|
() => $$LoanChangesTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer:
|
|
() => $$LoanChangesTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer:
|
|
() =>
|
|
$$LoanChangesTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
Value<int> loanId = const Value.absent(),
|
|
Value<double> amount = const Value.absent(),
|
|
Value<DateTime> date = const Value.absent(),
|
|
}) => LoanChangesCompanion(
|
|
id: id,
|
|
loanId: loanId,
|
|
amount: amount,
|
|
date: date,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> 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) {
|
|
if (loanId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.loanId,
|
|
referencedTable: $$LoanChangesTableReferences
|
|
._loanIdTable(db),
|
|
referencedColumn:
|
|
$$LoanChangesTableReferences
|
|
._loanIdTable(db)
|
|
.id,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$LoanChangesTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$OkaneDatabase,
|
|
$LoanChangesTable,
|
|
LoanChange,
|
|
$$LoanChangesTableFilterComposer,
|
|
$$LoanChangesTableOrderingComposer,
|
|
$$LoanChangesTableAnnotationComposer,
|
|
$$LoanChangesTableCreateCompanionBuilder,
|
|
$$LoanChangesTableUpdateCompanionBuilder,
|
|
(LoanChange, $$LoanChangesTableReferences),
|
|
LoanChange,
|
|
PrefetchHooks Function({bool loanId})
|
|
>;
|
|
typedef $$TransactionTemplatesTableCreateCompanionBuilder =
|
|
TransactionTemplatesCompanion Function({
|
|
Value<int> id,
|
|
required String name,
|
|
required double amount,
|
|
required bool recurring,
|
|
Value<int?> expenseCategoryId,
|
|
required int beneficiaryId,
|
|
required int accountId,
|
|
});
|
|
typedef $$TransactionTemplatesTableUpdateCompanionBuilder =
|
|
TransactionTemplatesCompanion Function({
|
|
Value<int> id,
|
|
Value<String> name,
|
|
Value<double> amount,
|
|
Value<bool> recurring,
|
|
Value<int?> expenseCategoryId,
|
|
Value<int> beneficiaryId,
|
|
Value<int> accountId,
|
|
});
|
|
|
|
final class $$TransactionTemplatesTableReferences
|
|
extends
|
|
BaseReferences<
|
|
_$OkaneDatabase,
|
|
$TransactionTemplatesTable,
|
|
TransactionTemplate
|
|
> {
|
|
$$TransactionTemplatesTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static $ExpenseCategoriesTable _expenseCategoryIdTable(_$OkaneDatabase db) =>
|
|
db.expenseCategories.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.transactionTemplates.expenseCategoryId,
|
|
db.expenseCategories.id,
|
|
),
|
|
);
|
|
|
|
$$ExpenseCategoriesTableProcessedTableManager? get expenseCategoryId {
|
|
final $_column = $_itemColumn<int>('expense_category_id');
|
|
if ($_column == null) return null;
|
|
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]),
|
|
);
|
|
}
|
|
|
|
static $BeneficiariesTable _beneficiaryIdTable(_$OkaneDatabase db) =>
|
|
db.beneficiaries.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.transactionTemplates.beneficiaryId,
|
|
db.beneficiaries.id,
|
|
),
|
|
);
|
|
|
|
$$BeneficiariesTableProcessedTableManager get beneficiaryId {
|
|
final $_column = $_itemColumn<int>('beneficiary_id')!;
|
|
|
|
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]),
|
|
);
|
|
}
|
|
|
|
static $AccountsTable _accountIdTable(_$OkaneDatabase db) =>
|
|
db.accounts.createAlias(
|
|
$_aliasNameGenerator(db.transactionTemplates.accountId, db.accounts.id),
|
|
);
|
|
|
|
$$AccountsTableProcessedTableManager get accountId {
|
|
final $_column = $_itemColumn<int>('account_id')!;
|
|
|
|
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]),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<
|
|
$RecurringTransactionsTable,
|
|
List<RecurringTransaction>
|
|
>
|
|
_recurringTransactionsRefsTable(_$OkaneDatabase db) =>
|
|
MultiTypedResultKey.fromTable(
|
|
db.recurringTransactions,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.transactionTemplates.id,
|
|
db.recurringTransactions.templateId,
|
|
),
|
|
);
|
|
|
|
$$RecurringTransactionsTableProcessedTableManager
|
|
get recurringTransactionsRefs {
|
|
final manager = $$RecurringTransactionsTableTableManager(
|
|
$_db,
|
|
$_db.recurringTransactions,
|
|
).filter((f) => f.templateId.id.sqlEquals($_itemColumn<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(
|
|
_recurringTransactionsRefsTable($_db),
|
|
);
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$TransactionTemplatesTableFilterComposer
|
|
extends Composer<_$OkaneDatabase, $TransactionTemplatesTable> {
|
|
$$TransactionTemplatesTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get recurring => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<bool> recurringTransactionsRefs(
|
|
Expression<bool> 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,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$TransactionTemplatesTableOrderingComposer
|
|
extends Composer<_$OkaneDatabase, $TransactionTemplatesTable> {
|
|
$$TransactionTemplatesTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get recurring => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$TransactionTemplatesTableAnnotationComposer
|
|
extends Composer<_$OkaneDatabase, $TransactionTemplatesTable> {
|
|
$$TransactionTemplatesTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get amount =>
|
|
$composableBuilder(column: $table.amount, builder: (column) => column);
|
|
|
|
GeneratedColumn<bool> get recurring =>
|
|
$composableBuilder(column: $table.recurring, builder: (column) => column);
|
|
|
|
$$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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
Expression<T> recurringTransactionsRefs<T extends Object>(
|
|
Expression<T> 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,
|
|
),
|
|
);
|
|
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,
|
|
})
|
|
> {
|
|
$$TransactionTemplatesTableTableManager(
|
|
_$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<int> id = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<double> amount = const Value.absent(),
|
|
Value<bool> recurring = const Value.absent(),
|
|
Value<int?> expenseCategoryId = const Value.absent(),
|
|
Value<int> beneficiaryId = const Value.absent(),
|
|
Value<int> accountId = const Value.absent(),
|
|
}) => TransactionTemplatesCompanion(
|
|
id: id,
|
|
name: name,
|
|
amount: amount,
|
|
recurring: recurring,
|
|
expenseCategoryId: expenseCategoryId,
|
|
beneficiaryId: beneficiaryId,
|
|
accountId: accountId,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
required String name,
|
|
required double amount,
|
|
required bool recurring,
|
|
Value<int?> 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,
|
|
],
|
|
addJoins: <
|
|
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;
|
|
}
|
|
if (beneficiaryId) {
|
|
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;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
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,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
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<int> id,
|
|
required int days,
|
|
Value<DateTime?> lastExecution,
|
|
required int templateId,
|
|
required int accountId,
|
|
});
|
|
typedef $$RecurringTransactionsTableUpdateCompanionBuilder =
|
|
RecurringTransactionsCompanion Function({
|
|
Value<int> id,
|
|
Value<int> days,
|
|
Value<DateTime?> lastExecution,
|
|
Value<int> templateId,
|
|
Value<int> accountId,
|
|
});
|
|
|
|
final class $$RecurringTransactionsTableReferences
|
|
extends
|
|
BaseReferences<
|
|
_$OkaneDatabase,
|
|
$RecurringTransactionsTable,
|
|
RecurringTransaction
|
|
> {
|
|
$$RecurringTransactionsTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static $TransactionTemplatesTable _templateIdTable(_$OkaneDatabase db) =>
|
|
db.transactionTemplates.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.recurringTransactions.templateId,
|
|
db.transactionTemplates.id,
|
|
),
|
|
);
|
|
|
|
$$TransactionTemplatesTableProcessedTableManager get templateId {
|
|
final $_column = $_itemColumn<int>('template_id')!;
|
|
|
|
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]),
|
|
);
|
|
}
|
|
|
|
static $AccountsTable _accountIdTable(_$OkaneDatabase db) =>
|
|
db.accounts.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.recurringTransactions.accountId,
|
|
db.accounts.id,
|
|
),
|
|
);
|
|
|
|
$$AccountsTableProcessedTableManager get accountId {
|
|
final $_column = $_itemColumn<int>('account_id')!;
|
|
|
|
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]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$RecurringTransactionsTableFilterComposer
|
|
extends Composer<_$OkaneDatabase, $RecurringTransactionsTable> {
|
|
$$RecurringTransactionsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get days => $composableBuilder(
|
|
column: $table.days,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get lastExecution => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$RecurringTransactionsTableOrderingComposer
|
|
extends Composer<_$OkaneDatabase, $RecurringTransactionsTable> {
|
|
$$RecurringTransactionsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get days => $composableBuilder(
|
|
column: $table.days,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get lastExecution => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$RecurringTransactionsTableAnnotationComposer
|
|
extends Composer<_$OkaneDatabase, $RecurringTransactionsTable> {
|
|
$$RecurringTransactionsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<int> get days =>
|
|
$composableBuilder(column: $table.days, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get lastExecution => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
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(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer:
|
|
() => $$RecurringTransactionsTableFilterComposer(
|
|
$db: db,
|
|
$table: table,
|
|
),
|
|
createOrderingComposer:
|
|
() => $$RecurringTransactionsTableOrderingComposer(
|
|
$db: db,
|
|
$table: table,
|
|
),
|
|
createComputedFieldComposer:
|
|
() => $$RecurringTransactionsTableAnnotationComposer(
|
|
$db: db,
|
|
$table: table,
|
|
),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
Value<int> days = const Value.absent(),
|
|
Value<DateTime?> lastExecution = const Value.absent(),
|
|
Value<int> templateId = const Value.absent(),
|
|
Value<int> accountId = const Value.absent(),
|
|
}) => RecurringTransactionsCompanion(
|
|
id: id,
|
|
days: days,
|
|
lastExecution: lastExecution,
|
|
templateId: templateId,
|
|
accountId: accountId,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
required int days,
|
|
Value<DateTime?> 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) {
|
|
if (templateId) {
|
|
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;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
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<int> id,
|
|
required double amount,
|
|
required DateTime date,
|
|
Value<int?> expenseCategoryId,
|
|
required int accountId,
|
|
required int beneficiaryId,
|
|
});
|
|
typedef $$TransactionsTableUpdateCompanionBuilder =
|
|
TransactionsCompanion Function({
|
|
Value<int> id,
|
|
Value<double> amount,
|
|
Value<DateTime> date,
|
|
Value<int?> expenseCategoryId,
|
|
Value<int> accountId,
|
|
Value<int> 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,
|
|
),
|
|
);
|
|
|
|
$$ExpenseCategoriesTableProcessedTableManager? get expenseCategoryId {
|
|
final $_column = $_itemColumn<int>('expense_category_id');
|
|
if ($_column == null) return null;
|
|
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]),
|
|
);
|
|
}
|
|
|
|
static $AccountsTable _accountIdTable(_$OkaneDatabase db) =>
|
|
db.accounts.createAlias(
|
|
$_aliasNameGenerator(db.transactions.accountId, db.accounts.id),
|
|
);
|
|
|
|
$$AccountsTableProcessedTableManager get accountId {
|
|
final $_column = $_itemColumn<int>('account_id')!;
|
|
|
|
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]),
|
|
);
|
|
}
|
|
|
|
static $BeneficiariesTable _beneficiaryIdTable(_$OkaneDatabase db) =>
|
|
db.beneficiaries.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.transactions.beneficiaryId,
|
|
db.beneficiaries.id,
|
|
),
|
|
);
|
|
|
|
$$BeneficiariesTableProcessedTableManager get beneficiaryId {
|
|
final $_column = $_itemColumn<int>('beneficiary_id')!;
|
|
|
|
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]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$TransactionsTableFilterComposer
|
|
extends Composer<_$OkaneDatabase, $TransactionsTable> {
|
|
$$TransactionsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get date => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$TransactionsTableOrderingComposer
|
|
extends Composer<_$OkaneDatabase, $TransactionsTable> {
|
|
$$TransactionsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get date => $composableBuilder(
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$TransactionsTableAnnotationComposer
|
|
extends Composer<_$OkaneDatabase, $TransactionsTable> {
|
|
$$TransactionsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get amount =>
|
|
$composableBuilder(column: $table.amount, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get date =>
|
|
$composableBuilder(column: $table.date, builder: (column) => column);
|
|
|
|
$$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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
),
|
|
);
|
|
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,
|
|
})
|
|
> {
|
|
$$TransactionsTableTableManager(_$OkaneDatabase db, $TransactionsTable table)
|
|
: 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<int> id = const Value.absent(),
|
|
Value<double> amount = const Value.absent(),
|
|
Value<DateTime> date = const Value.absent(),
|
|
Value<int?> expenseCategoryId = const Value.absent(),
|
|
Value<int> accountId = const Value.absent(),
|
|
Value<int> beneficiaryId = const Value.absent(),
|
|
}) => TransactionsCompanion(
|
|
id: id,
|
|
amount: amount,
|
|
date: date,
|
|
expenseCategoryId: expenseCategoryId,
|
|
accountId: accountId,
|
|
beneficiaryId: beneficiaryId,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
required double amount,
|
|
required DateTime date,
|
|
Value<int?> 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) {
|
|
if (expenseCategoryId) {
|
|
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;
|
|
}
|
|
if (beneficiaryId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.beneficiaryId,
|
|
referencedTable: $$TransactionsTableReferences
|
|
._beneficiaryIdTable(db),
|
|
referencedColumn:
|
|
$$TransactionsTableReferences
|
|
._beneficiaryIdTable(db)
|
|
.id,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
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;
|
|
$OkaneDatabaseManager(this._db);
|
|
$$AccountsTableTableManager get accounts =>
|
|
$$AccountsTableTableManager(_db, _db.accounts);
|
|
$$BeneficiariesTableTableManager get beneficiaries =>
|
|
$$BeneficiariesTableTableManager(_db, _db.beneficiaries);
|
|
$$BudgetsTableTableManager get budgets =>
|
|
$$BudgetsTableTableManager(_db, _db.budgets);
|
|
$$ExpenseCategoriesTableTableManager get expenseCategories =>
|
|
$$ExpenseCategoriesTableTableManager(_db, _db.expenseCategories);
|
|
$$BudgetItemsTableTableManager get budgetItems =>
|
|
$$BudgetItemsTableTableManager(_db, _db.budgetItems);
|
|
$$LoansTableTableManager get loans =>
|
|
$$LoansTableTableManager(_db, _db.loans);
|
|
$$LoanChangesTableTableManager get loanChanges =>
|
|
$$LoanChangesTableTableManager(_db, _db.loanChanges);
|
|
$$TransactionTemplatesTableTableManager get transactionTemplates =>
|
|
$$TransactionTemplatesTableTableManager(_db, _db.transactionTemplates);
|
|
$$RecurringTransactionsTableTableManager get recurringTransactions =>
|
|
$$RecurringTransactionsTableTableManager(_db, _db.recurringTransactions);
|
|
$$TransactionsTableTableManager get transactions =>
|
|
$$TransactionsTableTableManager(_db, _db.transactions);
|
|
}
|
|
|
|
mixin _$AccountsDaoMixin on DatabaseAccessor<OkaneDatabase> {
|
|
$AccountsTable get accounts => attachedDatabase.accounts;
|
|
}
|
|
mixin _$BeneficiariesDaoMixin on DatabaseAccessor<OkaneDatabase> {
|
|
$AccountsTable get accounts => attachedDatabase.accounts;
|
|
$BeneficiariesTable get beneficiaries => attachedDatabase.beneficiaries;
|
|
}
|
|
mixin _$BudgetsDaoMixin on DatabaseAccessor<OkaneDatabase> {
|
|
$AccountsTable get accounts => attachedDatabase.accounts;
|
|
$BudgetsTable get budgets => attachedDatabase.budgets;
|
|
$ExpenseCategoriesTable get expenseCategories =>
|
|
attachedDatabase.expenseCategories;
|
|
$BudgetItemsTable get budgetItems => attachedDatabase.budgetItems;
|
|
}
|
|
mixin _$ExpenseCategoriesDaoMixin on DatabaseAccessor<OkaneDatabase> {
|
|
$ExpenseCategoriesTable get expenseCategories =>
|
|
attachedDatabase.expenseCategories;
|
|
}
|
|
mixin _$LoansDaoMixin on DatabaseAccessor<OkaneDatabase> {
|
|
$AccountsTable get accounts => attachedDatabase.accounts;
|
|
$BeneficiariesTable get beneficiaries => attachedDatabase.beneficiaries;
|
|
$LoansTable get loans => attachedDatabase.loans;
|
|
$LoanChangesTable get loanChanges => attachedDatabase.loanChanges;
|
|
}
|
|
mixin _$RecurringTransactionsDaoMixin on DatabaseAccessor<OkaneDatabase> {
|
|
$ExpenseCategoriesTable get expenseCategories =>
|
|
attachedDatabase.expenseCategories;
|
|
$AccountsTable get accounts => attachedDatabase.accounts;
|
|
$BeneficiariesTable get beneficiaries => attachedDatabase.beneficiaries;
|
|
$TransactionTemplatesTable get transactionTemplates =>
|
|
attachedDatabase.transactionTemplates;
|
|
$RecurringTransactionsTable get recurringTransactions =>
|
|
attachedDatabase.recurringTransactions;
|
|
}
|
|
mixin _$TransactionTemplatesDaoMixin on DatabaseAccessor<OkaneDatabase> {
|
|
$ExpenseCategoriesTable get expenseCategories =>
|
|
attachedDatabase.expenseCategories;
|
|
$AccountsTable get accounts => attachedDatabase.accounts;
|
|
$BeneficiariesTable get beneficiaries => attachedDatabase.beneficiaries;
|
|
$TransactionTemplatesTable get transactionTemplates =>
|
|
attachedDatabase.transactionTemplates;
|
|
}
|
|
mixin _$TransactionsDaoMixin on DatabaseAccessor<OkaneDatabase> {
|
|
$ExpenseCategoriesTable get expenseCategories =>
|
|
attachedDatabase.expenseCategories;
|
|
$AccountsTable get accounts => attachedDatabase.accounts;
|
|
$BeneficiariesTable get beneficiaries => attachedDatabase.beneficiaries;
|
|
$TransactionsTable get transactions => attachedDatabase.transactions;
|
|
}
|