3076 lines
98 KiB
Dart
3076 lines
98 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'drift_database.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: false,
|
|
defaultValue: const Constant(''),
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [id, name, updatedAt];
|
|
@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),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
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'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$AccountsTable createAlias(String alias) {
|
|
return $AccountsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Account extends DataClass implements Insertable<Account> {
|
|
/// Eindeutige ID des Kontos
|
|
final int id;
|
|
|
|
/// Name des Kontos
|
|
final String name;
|
|
|
|
/// Wann das Konto das letzte mal geupdated wurde
|
|
final DateTime updatedAt;
|
|
const Account({
|
|
required this.id,
|
|
required this.name,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['name'] = Variable<String>(name);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
AccountsCompanion toCompanion(bool nullToAbsent) {
|
|
return AccountsCompanion(
|
|
id: Value(id),
|
|
name: Value(name),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
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']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'name': serializer.toJson<String>(name),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
Account copyWith({int? id, String? name, DateTime? updatedAt}) => Account(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
Account copyWithCompanion(AccountsCompanion data) {
|
|
return Account(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Account(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, name, updatedAt);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Account &&
|
|
other.id == this.id &&
|
|
other.name == this.name &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class AccountsCompanion extends UpdateCompanion<Account> {
|
|
final Value<int> id;
|
|
final Value<String> name;
|
|
final Value<DateTime> updatedAt;
|
|
const AccountsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
});
|
|
AccountsCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
});
|
|
static Insertable<Account> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? name,
|
|
Expression<DateTime>? updatedAt,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (name != null) 'name': name,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
});
|
|
}
|
|
|
|
AccountsCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<String>? name,
|
|
Value<DateTime>? updatedAt,
|
|
}) {
|
|
return AccountsCompanion(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@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 (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('AccountsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('updatedAt: $updatedAt')
|
|
..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 _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(''),
|
|
);
|
|
static const VerificationMeta _startDateMeta = const VerificationMeta(
|
|
'startDate',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> startDate = GeneratedColumn<DateTime>(
|
|
'start_date',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
late final GeneratedColumnWithTypeConverter<TimeFrameEnum, int> timeFrame =
|
|
GeneratedColumn<int>(
|
|
'time_frame',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
).withConverter<TimeFrameEnum>(
|
|
$RecurringTransactionsTable.$convertertimeFrame,
|
|
);
|
|
static const VerificationMeta _amountMeta = const VerificationMeta('amount');
|
|
@override
|
|
late final GeneratedColumn<double> amount = GeneratedColumn<double>(
|
|
'amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
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 _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
id,
|
|
name,
|
|
startDate,
|
|
timeFrame,
|
|
amount,
|
|
accountId,
|
|
updatedAt,
|
|
];
|
|
@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('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('start_date')) {
|
|
context.handle(
|
|
_startDateMeta,
|
|
startDate.isAcceptableOrUnknown(data['start_date']!, _startDateMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('amount')) {
|
|
context.handle(
|
|
_amountMeta,
|
|
amount.isAcceptableOrUnknown(data['amount']!, _amountMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('account_id')) {
|
|
context.handle(
|
|
_accountIdMeta,
|
|
accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_accountIdMeta);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
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'],
|
|
)!,
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
startDate: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}start_date'],
|
|
),
|
|
timeFrame: $RecurringTransactionsTable.$convertertimeFrame.fromSql(
|
|
attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}time_frame'],
|
|
)!,
|
|
),
|
|
amount: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}amount'],
|
|
)!,
|
|
accountId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}account_id'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$RecurringTransactionsTable createAlias(String alias) {
|
|
return $RecurringTransactionsTable(attachedDatabase, alias);
|
|
}
|
|
|
|
static JsonTypeConverter2<TimeFrameEnum, int, int> $convertertimeFrame =
|
|
const EnumIndexConverter<TimeFrameEnum>(TimeFrameEnum.values);
|
|
}
|
|
|
|
class RecurringTransaction extends DataClass
|
|
implements Insertable<RecurringTransaction> {
|
|
/// Eindeutige ID der wiederkehrenden Transaktion
|
|
final int id;
|
|
|
|
/// Name/Beschreibung der wiederkehrenden Transaktion
|
|
final String name;
|
|
|
|
/// Startdatum der wiederkehrenden Transaktion
|
|
final DateTime? startDate;
|
|
|
|
/// Zeitlicher Rahmen für die Wiederholung
|
|
final TimeFrameEnum timeFrame;
|
|
|
|
/// Betrag der wiederkehrenden Transaktion
|
|
final double amount;
|
|
|
|
/// Fremdschlüssel zum zugehörigen Konto
|
|
final int accountId;
|
|
|
|
/// Wann die wiederkehrende Transaktion das letzte mal geupdated wurde
|
|
final DateTime updatedAt;
|
|
const RecurringTransaction({
|
|
required this.id,
|
|
required this.name,
|
|
this.startDate,
|
|
required this.timeFrame,
|
|
required this.amount,
|
|
required this.accountId,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['name'] = Variable<String>(name);
|
|
if (!nullToAbsent || startDate != null) {
|
|
map['start_date'] = Variable<DateTime>(startDate);
|
|
}
|
|
{
|
|
map['time_frame'] = Variable<int>(
|
|
$RecurringTransactionsTable.$convertertimeFrame.toSql(timeFrame),
|
|
);
|
|
}
|
|
map['amount'] = Variable<double>(amount);
|
|
map['account_id'] = Variable<int>(accountId);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
RecurringTransactionsCompanion toCompanion(bool nullToAbsent) {
|
|
return RecurringTransactionsCompanion(
|
|
id: Value(id),
|
|
name: Value(name),
|
|
startDate: startDate == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(startDate),
|
|
timeFrame: Value(timeFrame),
|
|
amount: Value(amount),
|
|
accountId: Value(accountId),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory RecurringTransaction.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return RecurringTransaction(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
startDate: serializer.fromJson<DateTime?>(json['startDate']),
|
|
timeFrame: $RecurringTransactionsTable.$convertertimeFrame.fromJson(
|
|
serializer.fromJson<int>(json['timeFrame']),
|
|
),
|
|
amount: serializer.fromJson<double>(json['amount']),
|
|
accountId: serializer.fromJson<int>(json['accountId']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'name': serializer.toJson<String>(name),
|
|
'startDate': serializer.toJson<DateTime?>(startDate),
|
|
'timeFrame': serializer.toJson<int>(
|
|
$RecurringTransactionsTable.$convertertimeFrame.toJson(timeFrame),
|
|
),
|
|
'amount': serializer.toJson<double>(amount),
|
|
'accountId': serializer.toJson<int>(accountId),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
RecurringTransaction copyWith({
|
|
int? id,
|
|
String? name,
|
|
Value<DateTime?> startDate = const Value.absent(),
|
|
TimeFrameEnum? timeFrame,
|
|
double? amount,
|
|
int? accountId,
|
|
DateTime? updatedAt,
|
|
}) => RecurringTransaction(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
startDate: startDate.present ? startDate.value : this.startDate,
|
|
timeFrame: timeFrame ?? this.timeFrame,
|
|
amount: amount ?? this.amount,
|
|
accountId: accountId ?? this.accountId,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
RecurringTransaction copyWithCompanion(RecurringTransactionsCompanion data) {
|
|
return RecurringTransaction(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
startDate: data.startDate.present ? data.startDate.value : this.startDate,
|
|
timeFrame: data.timeFrame.present ? data.timeFrame.value : this.timeFrame,
|
|
amount: data.amount.present ? data.amount.value : this.amount,
|
|
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('RecurringTransaction(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('startDate: $startDate, ')..write(
|
|
'timeFrame: $timeFrame, ')..write('amount: $amount, ')..write(
|
|
'accountId: $accountId, ')..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode =>
|
|
Object.hash(id, name, startDate, timeFrame, amount, accountId, updatedAt);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is RecurringTransaction &&
|
|
other.id == this.id &&
|
|
other.name == this.name &&
|
|
other.startDate == this.startDate &&
|
|
other.timeFrame == this.timeFrame &&
|
|
other.amount == this.amount &&
|
|
other.accountId == this.accountId &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class RecurringTransactionsCompanion
|
|
extends UpdateCompanion<RecurringTransaction> {
|
|
final Value<int> id;
|
|
final Value<String> name;
|
|
final Value<DateTime?> startDate;
|
|
final Value<TimeFrameEnum> timeFrame;
|
|
final Value<double> amount;
|
|
final Value<int> accountId;
|
|
final Value<DateTime> updatedAt;
|
|
const RecurringTransactionsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.startDate = const Value.absent(),
|
|
this.timeFrame = const Value.absent(),
|
|
this.amount = const Value.absent(),
|
|
this.accountId = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
});
|
|
RecurringTransactionsCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.startDate = const Value.absent(),
|
|
required TimeFrameEnum timeFrame,
|
|
this.amount = const Value.absent(),
|
|
required int accountId,
|
|
this.updatedAt = const Value.absent(),
|
|
}) : timeFrame = Value(timeFrame),
|
|
accountId = Value(accountId);
|
|
static Insertable<RecurringTransaction> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? name,
|
|
Expression<DateTime>? startDate,
|
|
Expression<int>? timeFrame,
|
|
Expression<double>? amount,
|
|
Expression<int>? accountId,
|
|
Expression<DateTime>? updatedAt,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (name != null) 'name': name,
|
|
if (startDate != null) 'start_date': startDate,
|
|
if (timeFrame != null) 'time_frame': timeFrame,
|
|
if (amount != null) 'amount': amount,
|
|
if (accountId != null) 'account_id': accountId,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
});
|
|
}
|
|
|
|
RecurringTransactionsCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<String>? name,
|
|
Value<DateTime?>? startDate,
|
|
Value<TimeFrameEnum>? timeFrame,
|
|
Value<double>? amount,
|
|
Value<int>? accountId,
|
|
Value<DateTime>? updatedAt,
|
|
}) {
|
|
return RecurringTransactionsCompanion(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
startDate: startDate ?? this.startDate,
|
|
timeFrame: timeFrame ?? this.timeFrame,
|
|
amount: amount ?? this.amount,
|
|
accountId: accountId ?? this.accountId,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@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 (startDate.present) {
|
|
map['start_date'] = Variable<DateTime>(startDate.value);
|
|
}
|
|
if (timeFrame.present) {
|
|
map['time_frame'] = Variable<int>(
|
|
$RecurringTransactionsTable.$convertertimeFrame.toSql(timeFrame.value),
|
|
);
|
|
}
|
|
if (amount.present) {
|
|
map['amount'] = Variable<double>(amount.value);
|
|
}
|
|
if (accountId.present) {
|
|
map['account_id'] = Variable<int>(accountId.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('RecurringTransactionsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('startDate: $startDate, ')..write(
|
|
'timeFrame: $timeFrame, ')..write('amount: $amount, ')..write(
|
|
'accountId: $accountId, ')..write('updatedAt: $updatedAt')
|
|
..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 _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(''),
|
|
);
|
|
static const VerificationMeta _dateMeta = const VerificationMeta('date');
|
|
@override
|
|
late final GeneratedColumn<DateTime> date = GeneratedColumn<DateTime>(
|
|
'date',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _amountMeta = const VerificationMeta('amount');
|
|
@override
|
|
late final GeneratedColumn<double> amount = GeneratedColumn<double>(
|
|
'amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
static const VerificationMeta _checkedMeta = const VerificationMeta(
|
|
'checked',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> checked = GeneratedColumn<bool>(
|
|
'checked',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("checked" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(true),
|
|
);
|
|
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 _recurringTransactionIdMeta =
|
|
const VerificationMeta('recurringTransactionId');
|
|
@override
|
|
late final GeneratedColumn<int> recurringTransactionId = GeneratedColumn<int>(
|
|
'recurring_transaction_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES recurring_transactions (id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
id,
|
|
name,
|
|
date,
|
|
amount,
|
|
checked,
|
|
accountId,
|
|
recurringTransactionId,
|
|
updatedAt,
|
|
];
|
|
@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('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('date')) {
|
|
context.handle(
|
|
_dateMeta,
|
|
date.isAcceptableOrUnknown(data['date']!, _dateMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('amount')) {
|
|
context.handle(
|
|
_amountMeta,
|
|
amount.isAcceptableOrUnknown(data['amount']!, _amountMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('checked')) {
|
|
context.handle(
|
|
_checkedMeta,
|
|
checked.isAcceptableOrUnknown(data['checked']!, _checkedMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('account_id')) {
|
|
context.handle(
|
|
_accountIdMeta,
|
|
accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_accountIdMeta);
|
|
}
|
|
if (data.containsKey('recurring_transaction_id')) {
|
|
context.handle(
|
|
_recurringTransactionIdMeta,
|
|
recurringTransactionId.isAcceptableOrUnknown(
|
|
data['recurring_transaction_id']!,
|
|
_recurringTransactionIdMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
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'],
|
|
)!,
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
date: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}date'],
|
|
),
|
|
amount: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}amount'],
|
|
)!,
|
|
checked: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}checked'],
|
|
)!,
|
|
accountId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}account_id'],
|
|
)!,
|
|
recurringTransactionId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}recurring_transaction_id'],
|
|
),
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$TransactionsTable createAlias(String alias) {
|
|
return $TransactionsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Transaction extends DataClass implements Insertable<Transaction> {
|
|
/// Eindeutige ID der Transaktion
|
|
final int id;
|
|
|
|
/// Name/Beschreibung der Transaktion
|
|
final String name;
|
|
|
|
/// Datum der Transaktion
|
|
final DateTime? date;
|
|
|
|
/// Betrag der Transaktion
|
|
final double amount;
|
|
|
|
/// Ob diese Transaktion bereits geprüft wurde
|
|
final bool checked;
|
|
|
|
/// Fremdschlüssel zum zugehörigen Konto
|
|
final int accountId;
|
|
|
|
/// Fremdschlüssel zur zugehörigen wiederkehrenden Transaktion,
|
|
/// falls vorhanden
|
|
final int? recurringTransactionId;
|
|
|
|
/// Wann die Transaktion das letzte mal geupdated wurde
|
|
final DateTime updatedAt;
|
|
const Transaction({
|
|
required this.id,
|
|
required this.name,
|
|
this.date,
|
|
required this.amount,
|
|
required this.checked,
|
|
required this.accountId,
|
|
this.recurringTransactionId,
|
|
required this.updatedAt,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['name'] = Variable<String>(name);
|
|
if (!nullToAbsent || date != null) {
|
|
map['date'] = Variable<DateTime>(date);
|
|
}
|
|
map['amount'] = Variable<double>(amount);
|
|
map['checked'] = Variable<bool>(checked);
|
|
map['account_id'] = Variable<int>(accountId);
|
|
if (!nullToAbsent || recurringTransactionId != null) {
|
|
map['recurring_transaction_id'] = Variable<int>(recurringTransactionId);
|
|
}
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
TransactionsCompanion toCompanion(bool nullToAbsent) {
|
|
return TransactionsCompanion(
|
|
id: Value(id),
|
|
name: Value(name),
|
|
date: date == null && nullToAbsent ? const Value.absent() : Value(date),
|
|
amount: Value(amount),
|
|
checked: Value(checked),
|
|
accountId: Value(accountId),
|
|
recurringTransactionId: recurringTransactionId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(recurringTransactionId),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory Transaction.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Transaction(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
date: serializer.fromJson<DateTime?>(json['date']),
|
|
amount: serializer.fromJson<double>(json['amount']),
|
|
checked: serializer.fromJson<bool>(json['checked']),
|
|
accountId: serializer.fromJson<int>(json['accountId']),
|
|
recurringTransactionId: serializer.fromJson<int?>(
|
|
json['recurringTransactionId'],
|
|
),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'name': serializer.toJson<String>(name),
|
|
'date': serializer.toJson<DateTime?>(date),
|
|
'amount': serializer.toJson<double>(amount),
|
|
'checked': serializer.toJson<bool>(checked),
|
|
'accountId': serializer.toJson<int>(accountId),
|
|
'recurringTransactionId': serializer.toJson<int?>(recurringTransactionId),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
Transaction copyWith({
|
|
int? id,
|
|
String? name,
|
|
Value<DateTime?> date = const Value.absent(),
|
|
double? amount,
|
|
bool? checked,
|
|
int? accountId,
|
|
Value<int?> recurringTransactionId = const Value.absent(),
|
|
DateTime? updatedAt,
|
|
}) => Transaction(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
date: date.present ? date.value : this.date,
|
|
amount: amount ?? this.amount,
|
|
checked: checked ?? this.checked,
|
|
accountId: accountId ?? this.accountId,
|
|
recurringTransactionId: recurringTransactionId.present
|
|
? recurringTransactionId.value
|
|
: this.recurringTransactionId,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
Transaction copyWithCompanion(TransactionsCompanion data) {
|
|
return Transaction(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
date: data.date.present ? data.date.value : this.date,
|
|
amount: data.amount.present ? data.amount.value : this.amount,
|
|
checked: data.checked.present ? data.checked.value : this.checked,
|
|
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
|
recurringTransactionId: data.recurringTransactionId.present
|
|
? data.recurringTransactionId.value
|
|
: this.recurringTransactionId,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Transaction(')
|
|
..write('id: $id, ')..write('name: $name, ')..write(
|
|
'date: $date, ')..write('amount: $amount, ')..write(
|
|
'checked: $checked, ')..write('accountId: $accountId, ')..write(
|
|
'recurringTransactionId: $recurringTransactionId, ')..write(
|
|
'updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
id,
|
|
name,
|
|
date,
|
|
amount,
|
|
checked,
|
|
accountId,
|
|
recurringTransactionId,
|
|
updatedAt,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Transaction &&
|
|
other.id == this.id &&
|
|
other.name == this.name &&
|
|
other.date == this.date &&
|
|
other.amount == this.amount &&
|
|
other.checked == this.checked &&
|
|
other.accountId == this.accountId &&
|
|
other.recurringTransactionId == this.recurringTransactionId &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class TransactionsCompanion extends UpdateCompanion<Transaction> {
|
|
final Value<int> id;
|
|
final Value<String> name;
|
|
final Value<DateTime?> date;
|
|
final Value<double> amount;
|
|
final Value<bool> checked;
|
|
final Value<int> accountId;
|
|
final Value<int?> recurringTransactionId;
|
|
final Value<DateTime> updatedAt;
|
|
const TransactionsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.date = const Value.absent(),
|
|
this.amount = const Value.absent(),
|
|
this.checked = const Value.absent(),
|
|
this.accountId = const Value.absent(),
|
|
this.recurringTransactionId = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
});
|
|
TransactionsCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.date = const Value.absent(),
|
|
this.amount = const Value.absent(),
|
|
this.checked = const Value.absent(),
|
|
required int accountId,
|
|
this.recurringTransactionId = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
}) : accountId = Value(accountId);
|
|
static Insertable<Transaction> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? name,
|
|
Expression<DateTime>? date,
|
|
Expression<double>? amount,
|
|
Expression<bool>? checked,
|
|
Expression<int>? accountId,
|
|
Expression<int>? recurringTransactionId,
|
|
Expression<DateTime>? updatedAt,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (name != null) 'name': name,
|
|
if (date != null) 'date': date,
|
|
if (amount != null) 'amount': amount,
|
|
if (checked != null) 'checked': checked,
|
|
if (accountId != null) 'account_id': accountId,
|
|
if (recurringTransactionId != null)
|
|
'recurring_transaction_id': recurringTransactionId,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
});
|
|
}
|
|
|
|
TransactionsCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<String>? name,
|
|
Value<DateTime?>? date,
|
|
Value<double>? amount,
|
|
Value<bool>? checked,
|
|
Value<int>? accountId,
|
|
Value<int?>? recurringTransactionId,
|
|
Value<DateTime>? updatedAt,
|
|
}) {
|
|
return TransactionsCompanion(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
date: date ?? this.date,
|
|
amount: amount ?? this.amount,
|
|
checked: checked ?? this.checked,
|
|
accountId: accountId ?? this.accountId,
|
|
recurringTransactionId:
|
|
recurringTransactionId ?? this.recurringTransactionId,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@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 (date.present) {
|
|
map['date'] = Variable<DateTime>(date.value);
|
|
}
|
|
if (amount.present) {
|
|
map['amount'] = Variable<double>(amount.value);
|
|
}
|
|
if (checked.present) {
|
|
map['checked'] = Variable<bool>(checked.value);
|
|
}
|
|
if (accountId.present) {
|
|
map['account_id'] = Variable<int>(accountId.value);
|
|
}
|
|
if (recurringTransactionId.present) {
|
|
map['recurring_transaction_id'] = Variable<int>(
|
|
recurringTransactionId.value,
|
|
);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('TransactionsCompanion(')
|
|
..write('id: $id, ')..write('name: $name, ')..write(
|
|
'date: $date, ')..write('amount: $amount, ')..write(
|
|
'checked: $checked, ')..write('accountId: $accountId, ')..write(
|
|
'recurringTransactionId: $recurringTransactionId, ')..write(
|
|
'updatedAt: $updatedAt')..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $SyncLogTable extends SyncLog with TableInfo<$SyncLogTable, SyncLogData> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
|
|
$SyncLogTable(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<SyncLogTypeEnum, int> type =
|
|
GeneratedColumn<int>(
|
|
'type',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
).withConverter<SyncLogTypeEnum>($SyncLogTable.$convertertype);
|
|
static const VerificationMeta _descriptionMeta = const VerificationMeta(
|
|
'description',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> description = GeneratedColumn<String>(
|
|
'description',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(''),
|
|
);
|
|
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
|
|
'updatedAt',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<DateTime> updatedAt = GeneratedColumn<DateTime>(
|
|
'updated_at',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: false,
|
|
defaultValue: currentDateAndTime,
|
|
);
|
|
|
|
@override
|
|
List<GeneratedColumn> get $columns => [id, type, description, updatedAt];
|
|
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'sync_log';
|
|
|
|
@override
|
|
VerificationContext validateIntegrity(Insertable<SyncLogData> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
}
|
|
if (data.containsKey('description')) {
|
|
context.handle(
|
|
_descriptionMeta,
|
|
description.isAcceptableOrUnknown(
|
|
data['description']!,
|
|
_descriptionMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('updated_at')) {
|
|
context.handle(
|
|
_updatedAtMeta,
|
|
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
|
|
@override
|
|
SyncLogData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return SyncLogData(
|
|
id: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}id'],
|
|
)!,
|
|
type: $SyncLogTable.$convertertype.fromSql(
|
|
attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}type'],
|
|
)!,
|
|
),
|
|
description: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}description'],
|
|
)!,
|
|
updatedAt: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}updated_at'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$SyncLogTable createAlias(String alias) {
|
|
return $SyncLogTable(attachedDatabase, alias);
|
|
}
|
|
|
|
static JsonTypeConverter2<SyncLogTypeEnum, int, int> $convertertype =
|
|
const EnumIndexConverter<SyncLogTypeEnum>(SyncLogTypeEnum.values);
|
|
}
|
|
|
|
class SyncLogData extends DataClass implements Insertable<SyncLogData> {
|
|
/// Eindeutige ID des SyncLogs
|
|
final int id;
|
|
|
|
/// Der Typ des SyncLogs
|
|
final SyncLogTypeEnum type;
|
|
|
|
/// Die Beschreibung der Eintragung des SyncLogs
|
|
final String description;
|
|
|
|
/// Wann dieser SyncLog das letzte mal geupdated wurde
|
|
final DateTime updatedAt;
|
|
|
|
const SyncLogData({
|
|
required this.id,
|
|
required this.type,
|
|
required this.description,
|
|
required this.updatedAt,
|
|
});
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
{
|
|
map['type'] = Variable<int>($SyncLogTable.$convertertype.toSql(type));
|
|
}
|
|
map['description'] = Variable<String>(description);
|
|
map['updated_at'] = Variable<DateTime>(updatedAt);
|
|
return map;
|
|
}
|
|
|
|
SyncLogCompanion toCompanion(bool nullToAbsent) {
|
|
return SyncLogCompanion(
|
|
id: Value(id),
|
|
type: Value(type),
|
|
description: Value(description),
|
|
updatedAt: Value(updatedAt),
|
|
);
|
|
}
|
|
|
|
factory SyncLogData.fromJson(Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return SyncLogData(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
type: $SyncLogTable.$convertertype.fromJson(
|
|
serializer.fromJson<int>(json['type']),
|
|
),
|
|
description: serializer.fromJson<String>(json['description']),
|
|
updatedAt: serializer.fromJson<DateTime>(json['updatedAt']),
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'type': serializer.toJson<int>($SyncLogTable.$convertertype.toJson(type)),
|
|
'description': serializer.toJson<String>(description),
|
|
'updatedAt': serializer.toJson<DateTime>(updatedAt),
|
|
};
|
|
}
|
|
|
|
SyncLogData copyWith({
|
|
int? id,
|
|
SyncLogTypeEnum? type,
|
|
String? description,
|
|
DateTime? updatedAt,
|
|
}) =>
|
|
SyncLogData(
|
|
id: id ?? this.id,
|
|
type: type ?? this.type,
|
|
description: description ?? this.description,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
|
|
SyncLogData copyWithCompanion(SyncLogCompanion data) {
|
|
return SyncLogData(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
type: data.type.present ? data.type.value : this.type,
|
|
description: data.description.present
|
|
? data.description.value
|
|
: this.description,
|
|
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('SyncLogData(')
|
|
..write('id: $id, ')..write('type: $type, ')..write(
|
|
'description: $description, ')..write('updatedAt: $updatedAt')..write(
|
|
')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, type, description, updatedAt);
|
|
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is SyncLogData &&
|
|
other.id == this.id &&
|
|
other.type == this.type &&
|
|
other.description == this.description &&
|
|
other.updatedAt == this.updatedAt);
|
|
}
|
|
|
|
class SyncLogCompanion extends UpdateCompanion<SyncLogData> {
|
|
final Value<int> id;
|
|
final Value<SyncLogTypeEnum> type;
|
|
final Value<String> description;
|
|
final Value<DateTime> updatedAt;
|
|
|
|
const SyncLogCompanion({
|
|
this.id = const Value.absent(),
|
|
this.type = const Value.absent(),
|
|
this.description = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
});
|
|
|
|
SyncLogCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required SyncLogTypeEnum type,
|
|
this.description = const Value.absent(),
|
|
this.updatedAt = const Value.absent(),
|
|
}) : type = Value(type);
|
|
|
|
static Insertable<SyncLogData> custom({
|
|
Expression<int>? id,
|
|
Expression<int>? type,
|
|
Expression<String>? description,
|
|
Expression<DateTime>? updatedAt,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (type != null) 'type': type,
|
|
if (description != null) 'description': description,
|
|
if (updatedAt != null) 'updated_at': updatedAt,
|
|
});
|
|
}
|
|
|
|
SyncLogCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<SyncLogTypeEnum>? type,
|
|
Value<String>? description,
|
|
Value<DateTime>? updatedAt,
|
|
}) {
|
|
return SyncLogCompanion(
|
|
id: id ?? this.id,
|
|
type: type ?? this.type,
|
|
description: description ?? this.description,
|
|
updatedAt: updatedAt ?? this.updatedAt,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (type.present) {
|
|
map['type'] = Variable<int>(
|
|
$SyncLogTable.$convertertype.toSql(type.value),
|
|
);
|
|
}
|
|
if (description.present) {
|
|
map['description'] = Variable<String>(description.value);
|
|
}
|
|
if (updatedAt.present) {
|
|
map['updated_at'] = Variable<DateTime>(updatedAt.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('SyncLogCompanion(')
|
|
..write('id: $id, ')..write('type: $type, ')..write(
|
|
'description: $description, ')..write('updatedAt: $updatedAt')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
abstract class _$AppDatabase extends GeneratedDatabase {
|
|
_$AppDatabase(QueryExecutor e) : super(e);
|
|
$AppDatabaseManager get managers => $AppDatabaseManager(this);
|
|
late final $AccountsTable accounts = $AccountsTable(this);
|
|
late final $RecurringTransactionsTable recurringTransactions =
|
|
$RecurringTransactionsTable(this);
|
|
late final $TransactionsTable transactions = $TransactionsTable(this);
|
|
late final $SyncLogTable syncLog = $SyncLogTable(this);
|
|
@override
|
|
Iterable<TableInfo<Table, Object?>> get allTables =>
|
|
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
|
@override
|
|
List<DatabaseSchemaEntity> get allSchemaEntities => [
|
|
accounts,
|
|
recurringTransactions,
|
|
transactions,
|
|
syncLog,
|
|
];
|
|
}
|
|
|
|
typedef $$AccountsTableCreateCompanionBuilder =
|
|
AccountsCompanion Function({
|
|
Value<int> id,
|
|
Value<String> name,
|
|
Value<DateTime> updatedAt,
|
|
});
|
|
typedef $$AccountsTableUpdateCompanionBuilder =
|
|
AccountsCompanion Function({
|
|
Value<int> id,
|
|
Value<String> name,
|
|
Value<DateTime> updatedAt,
|
|
});
|
|
|
|
final class $$AccountsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $AccountsTable, Account> {
|
|
$$AccountsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static MultiTypedResultKey<
|
|
$RecurringTransactionsTable,
|
|
List<RecurringTransaction>
|
|
>
|
|
_recurringTransactionsRefsTable(_$AppDatabase 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(_$AppDatabase 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<_$AppDatabase, $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),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
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<_$AppDatabase, $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),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$AccountsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $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);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
|
|
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<
|
|
_$AppDatabase,
|
|
$AccountsTable,
|
|
Account,
|
|
$$AccountsTableFilterComposer,
|
|
$$AccountsTableOrderingComposer,
|
|
$$AccountsTableAnnotationComposer,
|
|
$$AccountsTableCreateCompanionBuilder,
|
|
$$AccountsTableUpdateCompanionBuilder,
|
|
(Account, $$AccountsTableReferences),
|
|
Account,
|
|
PrefetchHooks Function({
|
|
bool recurringTransactionsRefs,
|
|
bool transactionsRefs,
|
|
})
|
|
> {
|
|
$$AccountsTableTableManager(_$AppDatabase 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(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
}) => AccountsCompanion(id: id, name: name, updatedAt: updatedAt),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
}) => AccountsCompanion.insert(
|
|
id: id,
|
|
name: name,
|
|
updatedAt: updatedAt,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$AccountsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({recurringTransactionsRefs = false, transactionsRefs = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [
|
|
if (recurringTransactionsRefs) db.recurringTransactions,
|
|
if (transactionsRefs) db.transactions,
|
|
],
|
|
addJoins: null,
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
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<
|
|
_$AppDatabase,
|
|
$AccountsTable,
|
|
Account,
|
|
$$AccountsTableFilterComposer,
|
|
$$AccountsTableOrderingComposer,
|
|
$$AccountsTableAnnotationComposer,
|
|
$$AccountsTableCreateCompanionBuilder,
|
|
$$AccountsTableUpdateCompanionBuilder,
|
|
(Account, $$AccountsTableReferences),
|
|
Account,
|
|
PrefetchHooks Function({
|
|
bool recurringTransactionsRefs,
|
|
bool transactionsRefs,
|
|
})
|
|
>;
|
|
typedef $$RecurringTransactionsTableCreateCompanionBuilder =
|
|
RecurringTransactionsCompanion Function({
|
|
Value<int> id,
|
|
Value<String> name,
|
|
Value<DateTime?> startDate,
|
|
required TimeFrameEnum timeFrame,
|
|
Value<double> amount,
|
|
required int accountId,
|
|
Value<DateTime> updatedAt,
|
|
});
|
|
typedef $$RecurringTransactionsTableUpdateCompanionBuilder =
|
|
RecurringTransactionsCompanion Function({
|
|
Value<int> id,
|
|
Value<String> name,
|
|
Value<DateTime?> startDate,
|
|
Value<TimeFrameEnum> timeFrame,
|
|
Value<double> amount,
|
|
Value<int> accountId,
|
|
Value<DateTime> updatedAt,
|
|
});
|
|
|
|
final class $$RecurringTransactionsTableReferences
|
|
extends
|
|
BaseReferences<
|
|
_$AppDatabase,
|
|
$RecurringTransactionsTable,
|
|
RecurringTransaction
|
|
> {
|
|
$$RecurringTransactionsTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static $AccountsTable _accountIdTable(_$AppDatabase 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]),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$TransactionsTable, List<Transaction>>
|
|
_transactionsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.transactions,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.recurringTransactions.id,
|
|
db.transactions.recurringTransactionId,
|
|
),
|
|
);
|
|
|
|
$$TransactionsTableProcessedTableManager get transactionsRefs {
|
|
final manager = $$TransactionsTableTableManager($_db, $_db.transactions)
|
|
.filter(
|
|
(f) =>
|
|
f.recurringTransactionId.id.sqlEquals($_itemColumn<int>('id')!),
|
|
);
|
|
|
|
final cache = $_typedResult.readTableOrNull(_transactionsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$RecurringTransactionsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $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<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get startDate => $composableBuilder(
|
|
column: $table.startDate,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnWithTypeConverterFilters<TimeFrameEnum, TimeFrameEnum, int>
|
|
get timeFrame => $composableBuilder(
|
|
column: $table.timeFrame,
|
|
builder: (column) => ColumnWithTypeConverterFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
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> transactionsRefs(
|
|
Expression<bool> Function($$TransactionsTableFilterComposer f) f,
|
|
) {
|
|
final $$TransactionsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.id,
|
|
referencedTable: $db.transactions,
|
|
getReferencedColumn: (t) => t.recurringTransactionId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$TransactionsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.transactions,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$RecurringTransactionsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $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<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get startDate => $composableBuilder(
|
|
column: $table.startDate,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get timeFrame => $composableBuilder(
|
|
column: $table.timeFrame,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
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 $$RecurringTransactionsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $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<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get startDate =>
|
|
$composableBuilder(column: $table.startDate, builder: (column) => column);
|
|
|
|
GeneratedColumnWithTypeConverter<TimeFrameEnum, int> get timeFrame =>
|
|
$composableBuilder(column: $table.timeFrame, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get amount =>
|
|
$composableBuilder(column: $table.amount, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, 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> 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.recurringTransactionId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$TransactionsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.transactions,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$RecurringTransactionsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$RecurringTransactionsTable,
|
|
RecurringTransaction,
|
|
$$RecurringTransactionsTableFilterComposer,
|
|
$$RecurringTransactionsTableOrderingComposer,
|
|
$$RecurringTransactionsTableAnnotationComposer,
|
|
$$RecurringTransactionsTableCreateCompanionBuilder,
|
|
$$RecurringTransactionsTableUpdateCompanionBuilder,
|
|
(RecurringTransaction, $$RecurringTransactionsTableReferences),
|
|
RecurringTransaction,
|
|
PrefetchHooks Function({bool accountId, bool transactionsRefs})
|
|
> {
|
|
$$RecurringTransactionsTableTableManager(
|
|
_$AppDatabase 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<String> name = const Value.absent(),
|
|
Value<DateTime?> startDate = const Value.absent(),
|
|
Value<TimeFrameEnum> timeFrame = const Value.absent(),
|
|
Value<double> amount = const Value.absent(),
|
|
Value<int> accountId = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
}) => RecurringTransactionsCompanion(
|
|
id: id,
|
|
name: name,
|
|
startDate: startDate,
|
|
timeFrame: timeFrame,
|
|
amount: amount,
|
|
accountId: accountId,
|
|
updatedAt: updatedAt,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<DateTime?> startDate = const Value.absent(),
|
|
required TimeFrameEnum timeFrame,
|
|
Value<double> amount = const Value.absent(),
|
|
required int accountId,
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
}) => RecurringTransactionsCompanion.insert(
|
|
id: id,
|
|
name: name,
|
|
startDate: startDate,
|
|
timeFrame: timeFrame,
|
|
amount: amount,
|
|
accountId: accountId,
|
|
updatedAt: updatedAt,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$RecurringTransactionsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({accountId = false, transactionsRefs = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [
|
|
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:
|
|
$$RecurringTransactionsTableReferences
|
|
._accountIdTable(db),
|
|
referencedColumn:
|
|
$$RecurringTransactionsTableReferences
|
|
._accountIdTable(db)
|
|
.id,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (transactionsRefs)
|
|
await $_getPrefetchedData<
|
|
RecurringTransaction,
|
|
$RecurringTransactionsTable,
|
|
Transaction
|
|
>(
|
|
currentTable: table,
|
|
referencedTable:
|
|
$$RecurringTransactionsTableReferences
|
|
._transactionsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$RecurringTransactionsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).transactionsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.recurringTransactionId == item.id,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$RecurringTransactionsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$RecurringTransactionsTable,
|
|
RecurringTransaction,
|
|
$$RecurringTransactionsTableFilterComposer,
|
|
$$RecurringTransactionsTableOrderingComposer,
|
|
$$RecurringTransactionsTableAnnotationComposer,
|
|
$$RecurringTransactionsTableCreateCompanionBuilder,
|
|
$$RecurringTransactionsTableUpdateCompanionBuilder,
|
|
(RecurringTransaction, $$RecurringTransactionsTableReferences),
|
|
RecurringTransaction,
|
|
PrefetchHooks Function({bool accountId, bool transactionsRefs})
|
|
>;
|
|
typedef $$TransactionsTableCreateCompanionBuilder =
|
|
TransactionsCompanion Function({
|
|
Value<int> id,
|
|
Value<String> name,
|
|
Value<DateTime?> date,
|
|
Value<double> amount,
|
|
Value<bool> checked,
|
|
required int accountId,
|
|
Value<int?> recurringTransactionId,
|
|
Value<DateTime> updatedAt,
|
|
});
|
|
typedef $$TransactionsTableUpdateCompanionBuilder =
|
|
TransactionsCompanion Function({
|
|
Value<int> id,
|
|
Value<String> name,
|
|
Value<DateTime?> date,
|
|
Value<double> amount,
|
|
Value<bool> checked,
|
|
Value<int> accountId,
|
|
Value<int?> recurringTransactionId,
|
|
Value<DateTime> updatedAt,
|
|
});
|
|
|
|
final class $$TransactionsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $TransactionsTable, Transaction> {
|
|
$$TransactionsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $AccountsTable _accountIdTable(_$AppDatabase 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 $RecurringTransactionsTable _recurringTransactionIdTable(
|
|
_$AppDatabase db,
|
|
) => db.recurringTransactions.createAlias(
|
|
$_aliasNameGenerator(
|
|
db.transactions.recurringTransactionId,
|
|
db.recurringTransactions.id,
|
|
),
|
|
);
|
|
|
|
$$RecurringTransactionsTableProcessedTableManager?
|
|
get recurringTransactionId {
|
|
final $_column = $_itemColumn<int>('recurring_transaction_id');
|
|
if ($_column == null) return null;
|
|
final manager = $$RecurringTransactionsTableTableManager(
|
|
$_db,
|
|
$_db.recurringTransactions,
|
|
).filter((f) => f.id.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(
|
|
_recurringTransactionIdTable($_db),
|
|
);
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$TransactionsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $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<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get date => $composableBuilder(
|
|
column: $table.date,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get checked => $composableBuilder(
|
|
column: $table.checked,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
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;
|
|
}
|
|
|
|
$$RecurringTransactionsTableFilterComposer get recurringTransactionId {
|
|
final $$RecurringTransactionsTableFilterComposer composer =
|
|
$composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.recurringTransactionId,
|
|
referencedTable: $db.recurringTransactions,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$RecurringTransactionsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.recurringTransactions,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$TransactionsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $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<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get date => $composableBuilder(
|
|
column: $table.date,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get checked => $composableBuilder(
|
|
column: $table.checked,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
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;
|
|
}
|
|
|
|
$$RecurringTransactionsTableOrderingComposer get recurringTransactionId {
|
|
final $$RecurringTransactionsTableOrderingComposer composer =
|
|
$composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.recurringTransactionId,
|
|
referencedTable: $db.recurringTransactions,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$RecurringTransactionsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.recurringTransactions,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$TransactionsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $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<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get date =>
|
|
$composableBuilder(column: $table.date, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get amount =>
|
|
$composableBuilder(column: $table.amount, builder: (column) => column);
|
|
|
|
GeneratedColumn<bool> get checked =>
|
|
$composableBuilder(column: $table.checked, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, 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;
|
|
}
|
|
|
|
$$RecurringTransactionsTableAnnotationComposer get recurringTransactionId {
|
|
final $$RecurringTransactionsTableAnnotationComposer composer =
|
|
$composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.recurringTransactionId,
|
|
referencedTable: $db.recurringTransactions,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$RecurringTransactionsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.recurringTransactions,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$TransactionsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$TransactionsTable,
|
|
Transaction,
|
|
$$TransactionsTableFilterComposer,
|
|
$$TransactionsTableOrderingComposer,
|
|
$$TransactionsTableAnnotationComposer,
|
|
$$TransactionsTableCreateCompanionBuilder,
|
|
$$TransactionsTableUpdateCompanionBuilder,
|
|
(Transaction, $$TransactionsTableReferences),
|
|
Transaction,
|
|
PrefetchHooks Function({bool accountId, bool recurringTransactionId})
|
|
> {
|
|
$$TransactionsTableTableManager(_$AppDatabase 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<String> name = const Value.absent(),
|
|
Value<DateTime?> date = const Value.absent(),
|
|
Value<double> amount = const Value.absent(),
|
|
Value<bool> checked = const Value.absent(),
|
|
Value<int> accountId = const Value.absent(),
|
|
Value<int?> recurringTransactionId = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
}) => TransactionsCompanion(
|
|
id: id,
|
|
name: name,
|
|
date: date,
|
|
amount: amount,
|
|
checked: checked,
|
|
accountId: accountId,
|
|
recurringTransactionId: recurringTransactionId,
|
|
updatedAt: updatedAt,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<DateTime?> date = const Value.absent(),
|
|
Value<double> amount = const Value.absent(),
|
|
Value<bool> checked = const Value.absent(),
|
|
required int accountId,
|
|
Value<int?> recurringTransactionId = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
}) => TransactionsCompanion.insert(
|
|
id: id,
|
|
name: name,
|
|
date: date,
|
|
amount: amount,
|
|
checked: checked,
|
|
accountId: accountId,
|
|
recurringTransactionId: recurringTransactionId,
|
|
updatedAt: updatedAt,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$TransactionsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({accountId = false, recurringTransactionId = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
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:
|
|
$$TransactionsTableReferences
|
|
._accountIdTable(db),
|
|
referencedColumn:
|
|
$$TransactionsTableReferences
|
|
._accountIdTable(db)
|
|
.id,
|
|
)
|
|
as T;
|
|
}
|
|
if (recurringTransactionId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.recurringTransactionId,
|
|
referencedTable:
|
|
$$TransactionsTableReferences
|
|
._recurringTransactionIdTable(db),
|
|
referencedColumn:
|
|
$$TransactionsTableReferences
|
|
._recurringTransactionIdTable(db)
|
|
.id,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$TransactionsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$TransactionsTable,
|
|
Transaction,
|
|
$$TransactionsTableFilterComposer,
|
|
$$TransactionsTableOrderingComposer,
|
|
$$TransactionsTableAnnotationComposer,
|
|
$$TransactionsTableCreateCompanionBuilder,
|
|
$$TransactionsTableUpdateCompanionBuilder,
|
|
(Transaction, $$TransactionsTableReferences),
|
|
Transaction,
|
|
PrefetchHooks Function({bool accountId, bool recurringTransactionId})
|
|
>;
|
|
typedef $$SyncLogTableCreateCompanionBuilder =
|
|
SyncLogCompanion Function({
|
|
Value<int> id,
|
|
required SyncLogTypeEnum type,
|
|
Value<String> description,
|
|
Value<DateTime> updatedAt,
|
|
});
|
|
typedef $$SyncLogTableUpdateCompanionBuilder =
|
|
SyncLogCompanion Function({
|
|
Value<int> id,
|
|
Value<SyncLogTypeEnum> type,
|
|
Value<String> description,
|
|
Value<DateTime> updatedAt,
|
|
});
|
|
|
|
class $$SyncLogTableFilterComposer
|
|
extends Composer<_$AppDatabase, $SyncLogTable> {
|
|
$$SyncLogTableFilterComposer({
|
|
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<SyncLogTypeEnum, SyncLogTypeEnum, int>
|
|
get type => $composableBuilder(
|
|
column: $table.type,
|
|
builder: (column) => ColumnWithTypeConverterFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get description => $composableBuilder(
|
|
column: $table.description,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
}
|
|
|
|
class $$SyncLogTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $SyncLogTable> {
|
|
$$SyncLogTableOrderingComposer({
|
|
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 type => $composableBuilder(
|
|
column: $table.type,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get description => $composableBuilder(
|
|
column: $table.description,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get updatedAt => $composableBuilder(
|
|
column: $table.updatedAt,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$SyncLogTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $SyncLogTable> {
|
|
$$SyncLogTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumnWithTypeConverter<SyncLogTypeEnum, int> get type =>
|
|
$composableBuilder(column: $table.type, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get description => $composableBuilder(
|
|
column: $table.description,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<DateTime> get updatedAt =>
|
|
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
|
|
}
|
|
|
|
class $$SyncLogTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$SyncLogTable,
|
|
SyncLogData,
|
|
$$SyncLogTableFilterComposer,
|
|
$$SyncLogTableOrderingComposer,
|
|
$$SyncLogTableAnnotationComposer,
|
|
$$SyncLogTableCreateCompanionBuilder,
|
|
$$SyncLogTableUpdateCompanionBuilder,
|
|
(
|
|
SyncLogData,
|
|
BaseReferences<_$AppDatabase, $SyncLogTable, SyncLogData>,
|
|
),
|
|
SyncLogData,
|
|
PrefetchHooks Function()
|
|
> {
|
|
$$SyncLogTableTableManager(_$AppDatabase db, $SyncLogTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$SyncLogTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$SyncLogTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$SyncLogTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
Value<SyncLogTypeEnum> type = const Value.absent(),
|
|
Value<String> description = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
}) => SyncLogCompanion(
|
|
id: id,
|
|
type: type,
|
|
description: description,
|
|
updatedAt: updatedAt,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
required SyncLogTypeEnum type,
|
|
Value<String> description = const Value.absent(),
|
|
Value<DateTime> updatedAt = const Value.absent(),
|
|
}) => SyncLogCompanion.insert(
|
|
id: id,
|
|
type: type,
|
|
description: description,
|
|
updatedAt: updatedAt,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
|
|
.toList(),
|
|
prefetchHooksCallback: null,
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$SyncLogTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$SyncLogTable,
|
|
SyncLogData,
|
|
$$SyncLogTableFilterComposer,
|
|
$$SyncLogTableOrderingComposer,
|
|
$$SyncLogTableAnnotationComposer,
|
|
$$SyncLogTableCreateCompanionBuilder,
|
|
$$SyncLogTableUpdateCompanionBuilder,
|
|
(SyncLogData, BaseReferences<_$AppDatabase, $SyncLogTable, SyncLogData>),
|
|
SyncLogData,
|
|
PrefetchHooks Function()
|
|
>;
|
|
|
|
class $AppDatabaseManager {
|
|
final _$AppDatabase _db;
|
|
$AppDatabaseManager(this._db);
|
|
$$AccountsTableTableManager get accounts =>
|
|
$$AccountsTableTableManager(_db, _db.accounts);
|
|
$$RecurringTransactionsTableTableManager get recurringTransactions =>
|
|
$$RecurringTransactionsTableTableManager(_db, _db.recurringTransactions);
|
|
$$TransactionsTableTableManager get transactions =>
|
|
$$TransactionsTableTableManager(_db, _db.transactions);
|
|
|
|
$$SyncLogTableTableManager get syncLog =>
|
|
$$SyncLogTableTableManager(_db, _db.syncLog);
|
|
}
|