3875 lines
120 KiB
Dart
3875 lines
120 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'db.dart';
|
|
|
|
// ignore_for_file: type=lint
|
|
class $AccountsTable extends Accounts with TableInfo<$AccountsTable, Account> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$AccountsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'id',
|
|
aliasedName,
|
|
false,
|
|
hasAutoIncrement: true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'PRIMARY KEY AUTOINCREMENT',
|
|
),
|
|
);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _typeMeta = const VerificationMeta('type');
|
|
@override
|
|
late final GeneratedColumn<String> type = GeneratedColumn<String>(
|
|
'type',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _balanceMeta = const VerificationMeta(
|
|
'balance',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> balance = GeneratedColumn<double>(
|
|
'balance',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _isClosedMeta = const VerificationMeta(
|
|
'isClosed',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> isClosed = GeneratedColumn<bool>(
|
|
'is_closed',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("is_closed" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(false),
|
|
);
|
|
static const VerificationMeta _sortOrderMeta = const VerificationMeta(
|
|
'sortOrder',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> sortOrder = GeneratedColumn<int>(
|
|
'sort_order',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
id,
|
|
name,
|
|
type,
|
|
balance,
|
|
isClosed,
|
|
sortOrder,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'accounts';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Account> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('type')) {
|
|
context.handle(
|
|
_typeMeta,
|
|
type.isAcceptableOrUnknown(data['type']!, _typeMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_typeMeta);
|
|
}
|
|
if (data.containsKey('balance')) {
|
|
context.handle(
|
|
_balanceMeta,
|
|
balance.isAcceptableOrUnknown(data['balance']!, _balanceMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('is_closed')) {
|
|
context.handle(
|
|
_isClosedMeta,
|
|
isClosed.isAcceptableOrUnknown(data['is_closed']!, _isClosedMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sort_order')) {
|
|
context.handle(
|
|
_sortOrderMeta,
|
|
sortOrder.isAcceptableOrUnknown(data['sort_order']!, _sortOrderMeta),
|
|
);
|
|
}
|
|
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'],
|
|
)!,
|
|
type: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}type'],
|
|
)!,
|
|
balance: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}balance'],
|
|
)!,
|
|
isClosed: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}is_closed'],
|
|
)!,
|
|
sortOrder: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}sort_order'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$AccountsTable createAlias(String alias) {
|
|
return $AccountsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Account extends DataClass implements Insertable<Account> {
|
|
final int id;
|
|
final String name;
|
|
final String type;
|
|
final double balance;
|
|
final bool isClosed;
|
|
final int sortOrder;
|
|
const Account({
|
|
required this.id,
|
|
required this.name,
|
|
required this.type,
|
|
required this.balance,
|
|
required this.isClosed,
|
|
required this.sortOrder,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['name'] = Variable<String>(name);
|
|
map['type'] = Variable<String>(type);
|
|
map['balance'] = Variable<double>(balance);
|
|
map['is_closed'] = Variable<bool>(isClosed);
|
|
map['sort_order'] = Variable<int>(sortOrder);
|
|
return map;
|
|
}
|
|
|
|
AccountsCompanion toCompanion(bool nullToAbsent) {
|
|
return AccountsCompanion(
|
|
id: Value(id),
|
|
name: Value(name),
|
|
type: Value(type),
|
|
balance: Value(balance),
|
|
isClosed: Value(isClosed),
|
|
sortOrder: Value(sortOrder),
|
|
);
|
|
}
|
|
|
|
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']),
|
|
type: serializer.fromJson<String>(json['type']),
|
|
balance: serializer.fromJson<double>(json['balance']),
|
|
isClosed: serializer.fromJson<bool>(json['isClosed']),
|
|
sortOrder: serializer.fromJson<int>(json['sortOrder']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'name': serializer.toJson<String>(name),
|
|
'type': serializer.toJson<String>(type),
|
|
'balance': serializer.toJson<double>(balance),
|
|
'isClosed': serializer.toJson<bool>(isClosed),
|
|
'sortOrder': serializer.toJson<int>(sortOrder),
|
|
};
|
|
}
|
|
|
|
Account copyWith({
|
|
int? id,
|
|
String? name,
|
|
String? type,
|
|
double? balance,
|
|
bool? isClosed,
|
|
int? sortOrder,
|
|
}) => Account(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
type: type ?? this.type,
|
|
balance: balance ?? this.balance,
|
|
isClosed: isClosed ?? this.isClosed,
|
|
sortOrder: sortOrder ?? this.sortOrder,
|
|
);
|
|
Account copyWithCompanion(AccountsCompanion data) {
|
|
return Account(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
type: data.type.present ? data.type.value : this.type,
|
|
balance: data.balance.present ? data.balance.value : this.balance,
|
|
isClosed: data.isClosed.present ? data.isClosed.value : this.isClosed,
|
|
sortOrder: data.sortOrder.present ? data.sortOrder.value : this.sortOrder,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Account(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('type: $type, ')
|
|
..write('balance: $balance, ')
|
|
..write('isClosed: $isClosed, ')
|
|
..write('sortOrder: $sortOrder')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, name, type, balance, isClosed, sortOrder);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Account &&
|
|
other.id == this.id &&
|
|
other.name == this.name &&
|
|
other.type == this.type &&
|
|
other.balance == this.balance &&
|
|
other.isClosed == this.isClosed &&
|
|
other.sortOrder == this.sortOrder);
|
|
}
|
|
|
|
class AccountsCompanion extends UpdateCompanion<Account> {
|
|
final Value<int> id;
|
|
final Value<String> name;
|
|
final Value<String> type;
|
|
final Value<double> balance;
|
|
final Value<bool> isClosed;
|
|
final Value<int> sortOrder;
|
|
const AccountsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.type = const Value.absent(),
|
|
this.balance = const Value.absent(),
|
|
this.isClosed = const Value.absent(),
|
|
this.sortOrder = const Value.absent(),
|
|
});
|
|
AccountsCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required String name,
|
|
required String type,
|
|
this.balance = const Value.absent(),
|
|
this.isClosed = const Value.absent(),
|
|
this.sortOrder = const Value.absent(),
|
|
}) : name = Value(name),
|
|
type = Value(type);
|
|
static Insertable<Account> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? name,
|
|
Expression<String>? type,
|
|
Expression<double>? balance,
|
|
Expression<bool>? isClosed,
|
|
Expression<int>? sortOrder,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (name != null) 'name': name,
|
|
if (type != null) 'type': type,
|
|
if (balance != null) 'balance': balance,
|
|
if (isClosed != null) 'is_closed': isClosed,
|
|
if (sortOrder != null) 'sort_order': sortOrder,
|
|
});
|
|
}
|
|
|
|
AccountsCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<String>? name,
|
|
Value<String>? type,
|
|
Value<double>? balance,
|
|
Value<bool>? isClosed,
|
|
Value<int>? sortOrder,
|
|
}) {
|
|
return AccountsCompanion(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
type: type ?? this.type,
|
|
balance: balance ?? this.balance,
|
|
isClosed: isClosed ?? this.isClosed,
|
|
sortOrder: sortOrder ?? this.sortOrder,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (type.present) {
|
|
map['type'] = Variable<String>(type.value);
|
|
}
|
|
if (balance.present) {
|
|
map['balance'] = Variable<double>(balance.value);
|
|
}
|
|
if (isClosed.present) {
|
|
map['is_closed'] = Variable<bool>(isClosed.value);
|
|
}
|
|
if (sortOrder.present) {
|
|
map['sort_order'] = Variable<int>(sortOrder.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('AccountsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('type: $type, ')
|
|
..write('balance: $balance, ')
|
|
..write('isClosed: $isClosed, ')
|
|
..write('sortOrder: $sortOrder')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $CategoryGroupsTable extends CategoryGroups
|
|
with TableInfo<$CategoryGroupsTable, CategoryGroup> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$CategoryGroupsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'id',
|
|
aliasedName,
|
|
false,
|
|
hasAutoIncrement: true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'PRIMARY KEY AUTOINCREMENT',
|
|
),
|
|
);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _sortOrderMeta = const VerificationMeta(
|
|
'sortOrder',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> sortOrder = GeneratedColumn<int>(
|
|
'sort_order',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [id, name, sortOrder];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'category_groups';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<CategoryGroup> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('sort_order')) {
|
|
context.handle(
|
|
_sortOrderMeta,
|
|
sortOrder.isAcceptableOrUnknown(data['sort_order']!, _sortOrderMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
CategoryGroup map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return CategoryGroup(
|
|
id: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}id'],
|
|
)!,
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
sortOrder: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}sort_order'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$CategoryGroupsTable createAlias(String alias) {
|
|
return $CategoryGroupsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class CategoryGroup extends DataClass implements Insertable<CategoryGroup> {
|
|
final int id;
|
|
final String name;
|
|
final int sortOrder;
|
|
const CategoryGroup({
|
|
required this.id,
|
|
required this.name,
|
|
required this.sortOrder,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['name'] = Variable<String>(name);
|
|
map['sort_order'] = Variable<int>(sortOrder);
|
|
return map;
|
|
}
|
|
|
|
CategoryGroupsCompanion toCompanion(bool nullToAbsent) {
|
|
return CategoryGroupsCompanion(
|
|
id: Value(id),
|
|
name: Value(name),
|
|
sortOrder: Value(sortOrder),
|
|
);
|
|
}
|
|
|
|
factory CategoryGroup.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return CategoryGroup(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
sortOrder: serializer.fromJson<int>(json['sortOrder']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'name': serializer.toJson<String>(name),
|
|
'sortOrder': serializer.toJson<int>(sortOrder),
|
|
};
|
|
}
|
|
|
|
CategoryGroup copyWith({int? id, String? name, int? sortOrder}) =>
|
|
CategoryGroup(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
sortOrder: sortOrder ?? this.sortOrder,
|
|
);
|
|
CategoryGroup copyWithCompanion(CategoryGroupsCompanion data) {
|
|
return CategoryGroup(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
sortOrder: data.sortOrder.present ? data.sortOrder.value : this.sortOrder,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('CategoryGroup(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('sortOrder: $sortOrder')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, name, sortOrder);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is CategoryGroup &&
|
|
other.id == this.id &&
|
|
other.name == this.name &&
|
|
other.sortOrder == this.sortOrder);
|
|
}
|
|
|
|
class CategoryGroupsCompanion extends UpdateCompanion<CategoryGroup> {
|
|
final Value<int> id;
|
|
final Value<String> name;
|
|
final Value<int> sortOrder;
|
|
const CategoryGroupsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.sortOrder = const Value.absent(),
|
|
});
|
|
CategoryGroupsCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required String name,
|
|
this.sortOrder = const Value.absent(),
|
|
}) : name = Value(name);
|
|
static Insertable<CategoryGroup> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? name,
|
|
Expression<int>? sortOrder,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (name != null) 'name': name,
|
|
if (sortOrder != null) 'sort_order': sortOrder,
|
|
});
|
|
}
|
|
|
|
CategoryGroupsCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<String>? name,
|
|
Value<int>? sortOrder,
|
|
}) {
|
|
return CategoryGroupsCompanion(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
sortOrder: sortOrder ?? this.sortOrder,
|
|
);
|
|
}
|
|
|
|
@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 (sortOrder.present) {
|
|
map['sort_order'] = Variable<int>(sortOrder.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('CategoryGroupsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('sortOrder: $sortOrder')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $CategoriesTable extends Categories
|
|
with TableInfo<$CategoriesTable, Category> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$CategoriesTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'id',
|
|
aliasedName,
|
|
false,
|
|
hasAutoIncrement: true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'PRIMARY KEY AUTOINCREMENT',
|
|
),
|
|
);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _groupIdMeta = const VerificationMeta(
|
|
'groupId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> groupId = GeneratedColumn<int>(
|
|
'group_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES category_groups (id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _budgetedMeta = const VerificationMeta(
|
|
'budgeted',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> budgeted = GeneratedColumn<double>(
|
|
'budgeted',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _sortOrderMeta = const VerificationMeta(
|
|
'sortOrder',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> sortOrder = GeneratedColumn<int>(
|
|
'sort_order',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
static const VerificationMeta _iconMeta = const VerificationMeta('icon');
|
|
@override
|
|
late final GeneratedColumn<String> icon = GeneratedColumn<String>(
|
|
'icon',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
id,
|
|
name,
|
|
groupId,
|
|
budgeted,
|
|
sortOrder,
|
|
icon,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'categories';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Category> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('group_id')) {
|
|
context.handle(
|
|
_groupIdMeta,
|
|
groupId.isAcceptableOrUnknown(data['group_id']!, _groupIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_groupIdMeta);
|
|
}
|
|
if (data.containsKey('budgeted')) {
|
|
context.handle(
|
|
_budgetedMeta,
|
|
budgeted.isAcceptableOrUnknown(data['budgeted']!, _budgetedMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sort_order')) {
|
|
context.handle(
|
|
_sortOrderMeta,
|
|
sortOrder.isAcceptableOrUnknown(data['sort_order']!, _sortOrderMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('icon')) {
|
|
context.handle(
|
|
_iconMeta,
|
|
icon.isAcceptableOrUnknown(data['icon']!, _iconMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
Category map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Category(
|
|
id: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}id'],
|
|
)!,
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
groupId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}group_id'],
|
|
)!,
|
|
budgeted: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}budgeted'],
|
|
)!,
|
|
sortOrder: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}sort_order'],
|
|
)!,
|
|
icon: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}icon'],
|
|
),
|
|
);
|
|
}
|
|
|
|
@override
|
|
$CategoriesTable createAlias(String alias) {
|
|
return $CategoriesTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Category extends DataClass implements Insertable<Category> {
|
|
final int id;
|
|
final String name;
|
|
final int groupId;
|
|
final double budgeted;
|
|
final int sortOrder;
|
|
final String? icon;
|
|
const Category({
|
|
required this.id,
|
|
required this.name,
|
|
required this.groupId,
|
|
required this.budgeted,
|
|
required this.sortOrder,
|
|
this.icon,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['name'] = Variable<String>(name);
|
|
map['group_id'] = Variable<int>(groupId);
|
|
map['budgeted'] = Variable<double>(budgeted);
|
|
map['sort_order'] = Variable<int>(sortOrder);
|
|
if (!nullToAbsent || icon != null) {
|
|
map['icon'] = Variable<String>(icon);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
CategoriesCompanion toCompanion(bool nullToAbsent) {
|
|
return CategoriesCompanion(
|
|
id: Value(id),
|
|
name: Value(name),
|
|
groupId: Value(groupId),
|
|
budgeted: Value(budgeted),
|
|
sortOrder: Value(sortOrder),
|
|
icon: icon == null && nullToAbsent ? const Value.absent() : Value(icon),
|
|
);
|
|
}
|
|
|
|
factory Category.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Category(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
groupId: serializer.fromJson<int>(json['groupId']),
|
|
budgeted: serializer.fromJson<double>(json['budgeted']),
|
|
sortOrder: serializer.fromJson<int>(json['sortOrder']),
|
|
icon: serializer.fromJson<String?>(json['icon']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'name': serializer.toJson<String>(name),
|
|
'groupId': serializer.toJson<int>(groupId),
|
|
'budgeted': serializer.toJson<double>(budgeted),
|
|
'sortOrder': serializer.toJson<int>(sortOrder),
|
|
'icon': serializer.toJson<String?>(icon),
|
|
};
|
|
}
|
|
|
|
Category copyWith({
|
|
int? id,
|
|
String? name,
|
|
int? groupId,
|
|
double? budgeted,
|
|
int? sortOrder,
|
|
Value<String?> icon = const Value.absent(),
|
|
}) => Category(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
groupId: groupId ?? this.groupId,
|
|
budgeted: budgeted ?? this.budgeted,
|
|
sortOrder: sortOrder ?? this.sortOrder,
|
|
icon: icon.present ? icon.value : this.icon,
|
|
);
|
|
Category copyWithCompanion(CategoriesCompanion data) {
|
|
return Category(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
groupId: data.groupId.present ? data.groupId.value : this.groupId,
|
|
budgeted: data.budgeted.present ? data.budgeted.value : this.budgeted,
|
|
sortOrder: data.sortOrder.present ? data.sortOrder.value : this.sortOrder,
|
|
icon: data.icon.present ? data.icon.value : this.icon,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Category(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('groupId: $groupId, ')
|
|
..write('budgeted: $budgeted, ')
|
|
..write('sortOrder: $sortOrder, ')
|
|
..write('icon: $icon')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, name, groupId, budgeted, sortOrder, icon);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Category &&
|
|
other.id == this.id &&
|
|
other.name == this.name &&
|
|
other.groupId == this.groupId &&
|
|
other.budgeted == this.budgeted &&
|
|
other.sortOrder == this.sortOrder &&
|
|
other.icon == this.icon);
|
|
}
|
|
|
|
class CategoriesCompanion extends UpdateCompanion<Category> {
|
|
final Value<int> id;
|
|
final Value<String> name;
|
|
final Value<int> groupId;
|
|
final Value<double> budgeted;
|
|
final Value<int> sortOrder;
|
|
final Value<String?> icon;
|
|
const CategoriesCompanion({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.groupId = const Value.absent(),
|
|
this.budgeted = const Value.absent(),
|
|
this.sortOrder = const Value.absent(),
|
|
this.icon = const Value.absent(),
|
|
});
|
|
CategoriesCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required String name,
|
|
required int groupId,
|
|
this.budgeted = const Value.absent(),
|
|
this.sortOrder = const Value.absent(),
|
|
this.icon = const Value.absent(),
|
|
}) : name = Value(name),
|
|
groupId = Value(groupId);
|
|
static Insertable<Category> custom({
|
|
Expression<int>? id,
|
|
Expression<String>? name,
|
|
Expression<int>? groupId,
|
|
Expression<double>? budgeted,
|
|
Expression<int>? sortOrder,
|
|
Expression<String>? icon,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (name != null) 'name': name,
|
|
if (groupId != null) 'group_id': groupId,
|
|
if (budgeted != null) 'budgeted': budgeted,
|
|
if (sortOrder != null) 'sort_order': sortOrder,
|
|
if (icon != null) 'icon': icon,
|
|
});
|
|
}
|
|
|
|
CategoriesCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<String>? name,
|
|
Value<int>? groupId,
|
|
Value<double>? budgeted,
|
|
Value<int>? sortOrder,
|
|
Value<String?>? icon,
|
|
}) {
|
|
return CategoriesCompanion(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
groupId: groupId ?? this.groupId,
|
|
budgeted: budgeted ?? this.budgeted,
|
|
sortOrder: sortOrder ?? this.sortOrder,
|
|
icon: icon ?? this.icon,
|
|
);
|
|
}
|
|
|
|
@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 (groupId.present) {
|
|
map['group_id'] = Variable<int>(groupId.value);
|
|
}
|
|
if (budgeted.present) {
|
|
map['budgeted'] = Variable<double>(budgeted.value);
|
|
}
|
|
if (sortOrder.present) {
|
|
map['sort_order'] = Variable<int>(sortOrder.value);
|
|
}
|
|
if (icon.present) {
|
|
map['icon'] = Variable<String>(icon.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('CategoriesCompanion(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('groupId: $groupId, ')
|
|
..write('budgeted: $budgeted, ')
|
|
..write('sortOrder: $sortOrder, ')
|
|
..write('icon: $icon')
|
|
..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 _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 _categoryIdMeta = const VerificationMeta(
|
|
'categoryId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> categoryId = GeneratedColumn<int>(
|
|
'category_id',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES categories (id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _payeeMeta = const VerificationMeta('payee');
|
|
@override
|
|
late final GeneratedColumn<String> payee = GeneratedColumn<String>(
|
|
'payee',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _notesMeta = const VerificationMeta('notes');
|
|
@override
|
|
late final GeneratedColumn<String> notes = GeneratedColumn<String>(
|
|
'notes',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _amountMeta = const VerificationMeta('amount');
|
|
@override
|
|
late final GeneratedColumn<double> amount = GeneratedColumn<double>(
|
|
'amount',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _dateMeta = const VerificationMeta('date');
|
|
@override
|
|
late final GeneratedColumn<DateTime> date = GeneratedColumn<DateTime>(
|
|
'date',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.dateTime,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _clearedMeta = const VerificationMeta(
|
|
'cleared',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> cleared = GeneratedColumn<bool>(
|
|
'cleared',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("cleared" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(false),
|
|
);
|
|
static const VerificationMeta _sortOrderMeta = const VerificationMeta(
|
|
'sortOrder',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> sortOrder = GeneratedColumn<int>(
|
|
'sort_order',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
id,
|
|
accountId,
|
|
categoryId,
|
|
payee,
|
|
notes,
|
|
amount,
|
|
date,
|
|
cleared,
|
|
sortOrder,
|
|
];
|
|
@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('account_id')) {
|
|
context.handle(
|
|
_accountIdMeta,
|
|
accountId.isAcceptableOrUnknown(data['account_id']!, _accountIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_accountIdMeta);
|
|
}
|
|
if (data.containsKey('category_id')) {
|
|
context.handle(
|
|
_categoryIdMeta,
|
|
categoryId.isAcceptableOrUnknown(data['category_id']!, _categoryIdMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('payee')) {
|
|
context.handle(
|
|
_payeeMeta,
|
|
payee.isAcceptableOrUnknown(data['payee']!, _payeeMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_payeeMeta);
|
|
}
|
|
if (data.containsKey('notes')) {
|
|
context.handle(
|
|
_notesMeta,
|
|
notes.isAcceptableOrUnknown(data['notes']!, _notesMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('amount')) {
|
|
context.handle(
|
|
_amountMeta,
|
|
amount.isAcceptableOrUnknown(data['amount']!, _amountMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_amountMeta);
|
|
}
|
|
if (data.containsKey('date')) {
|
|
context.handle(
|
|
_dateMeta,
|
|
date.isAcceptableOrUnknown(data['date']!, _dateMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_dateMeta);
|
|
}
|
|
if (data.containsKey('cleared')) {
|
|
context.handle(
|
|
_clearedMeta,
|
|
cleared.isAcceptableOrUnknown(data['cleared']!, _clearedMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sort_order')) {
|
|
context.handle(
|
|
_sortOrderMeta,
|
|
sortOrder.isAcceptableOrUnknown(data['sort_order']!, _sortOrderMeta),
|
|
);
|
|
}
|
|
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'],
|
|
)!,
|
|
accountId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}account_id'],
|
|
)!,
|
|
categoryId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}category_id'],
|
|
),
|
|
payee: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}payee'],
|
|
)!,
|
|
notes: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}notes'],
|
|
),
|
|
amount: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}amount'],
|
|
)!,
|
|
date: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.dateTime,
|
|
data['${effectivePrefix}date'],
|
|
)!,
|
|
cleared: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}cleared'],
|
|
)!,
|
|
sortOrder: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}sort_order'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$TransactionsTable createAlias(String alias) {
|
|
return $TransactionsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Transaction extends DataClass implements Insertable<Transaction> {
|
|
final int id;
|
|
final int accountId;
|
|
final int? categoryId;
|
|
final String payee;
|
|
final String? notes;
|
|
final double amount;
|
|
final DateTime date;
|
|
final bool cleared;
|
|
final int sortOrder;
|
|
const Transaction({
|
|
required this.id,
|
|
required this.accountId,
|
|
this.categoryId,
|
|
required this.payee,
|
|
this.notes,
|
|
required this.amount,
|
|
required this.date,
|
|
required this.cleared,
|
|
required this.sortOrder,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['account_id'] = Variable<int>(accountId);
|
|
if (!nullToAbsent || categoryId != null) {
|
|
map['category_id'] = Variable<int>(categoryId);
|
|
}
|
|
map['payee'] = Variable<String>(payee);
|
|
if (!nullToAbsent || notes != null) {
|
|
map['notes'] = Variable<String>(notes);
|
|
}
|
|
map['amount'] = Variable<double>(amount);
|
|
map['date'] = Variable<DateTime>(date);
|
|
map['cleared'] = Variable<bool>(cleared);
|
|
map['sort_order'] = Variable<int>(sortOrder);
|
|
return map;
|
|
}
|
|
|
|
TransactionsCompanion toCompanion(bool nullToAbsent) {
|
|
return TransactionsCompanion(
|
|
id: Value(id),
|
|
accountId: Value(accountId),
|
|
categoryId: categoryId == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(categoryId),
|
|
payee: Value(payee),
|
|
notes: notes == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(notes),
|
|
amount: Value(amount),
|
|
date: Value(date),
|
|
cleared: Value(cleared),
|
|
sortOrder: Value(sortOrder),
|
|
);
|
|
}
|
|
|
|
factory Transaction.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Transaction(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
accountId: serializer.fromJson<int>(json['accountId']),
|
|
categoryId: serializer.fromJson<int?>(json['categoryId']),
|
|
payee: serializer.fromJson<String>(json['payee']),
|
|
notes: serializer.fromJson<String?>(json['notes']),
|
|
amount: serializer.fromJson<double>(json['amount']),
|
|
date: serializer.fromJson<DateTime>(json['date']),
|
|
cleared: serializer.fromJson<bool>(json['cleared']),
|
|
sortOrder: serializer.fromJson<int>(json['sortOrder']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'accountId': serializer.toJson<int>(accountId),
|
|
'categoryId': serializer.toJson<int?>(categoryId),
|
|
'payee': serializer.toJson<String>(payee),
|
|
'notes': serializer.toJson<String?>(notes),
|
|
'amount': serializer.toJson<double>(amount),
|
|
'date': serializer.toJson<DateTime>(date),
|
|
'cleared': serializer.toJson<bool>(cleared),
|
|
'sortOrder': serializer.toJson<int>(sortOrder),
|
|
};
|
|
}
|
|
|
|
Transaction copyWith({
|
|
int? id,
|
|
int? accountId,
|
|
Value<int?> categoryId = const Value.absent(),
|
|
String? payee,
|
|
Value<String?> notes = const Value.absent(),
|
|
double? amount,
|
|
DateTime? date,
|
|
bool? cleared,
|
|
int? sortOrder,
|
|
}) => Transaction(
|
|
id: id ?? this.id,
|
|
accountId: accountId ?? this.accountId,
|
|
categoryId: categoryId.present ? categoryId.value : this.categoryId,
|
|
payee: payee ?? this.payee,
|
|
notes: notes.present ? notes.value : this.notes,
|
|
amount: amount ?? this.amount,
|
|
date: date ?? this.date,
|
|
cleared: cleared ?? this.cleared,
|
|
sortOrder: sortOrder ?? this.sortOrder,
|
|
);
|
|
Transaction copyWithCompanion(TransactionsCompanion data) {
|
|
return Transaction(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
accountId: data.accountId.present ? data.accountId.value : this.accountId,
|
|
categoryId: data.categoryId.present
|
|
? data.categoryId.value
|
|
: this.categoryId,
|
|
payee: data.payee.present ? data.payee.value : this.payee,
|
|
notes: data.notes.present ? data.notes.value : this.notes,
|
|
amount: data.amount.present ? data.amount.value : this.amount,
|
|
date: data.date.present ? data.date.value : this.date,
|
|
cleared: data.cleared.present ? data.cleared.value : this.cleared,
|
|
sortOrder: data.sortOrder.present ? data.sortOrder.value : this.sortOrder,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Transaction(')
|
|
..write('id: $id, ')
|
|
..write('accountId: $accountId, ')
|
|
..write('categoryId: $categoryId, ')
|
|
..write('payee: $payee, ')
|
|
..write('notes: $notes, ')
|
|
..write('amount: $amount, ')
|
|
..write('date: $date, ')
|
|
..write('cleared: $cleared, ')
|
|
..write('sortOrder: $sortOrder')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
id,
|
|
accountId,
|
|
categoryId,
|
|
payee,
|
|
notes,
|
|
amount,
|
|
date,
|
|
cleared,
|
|
sortOrder,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Transaction &&
|
|
other.id == this.id &&
|
|
other.accountId == this.accountId &&
|
|
other.categoryId == this.categoryId &&
|
|
other.payee == this.payee &&
|
|
other.notes == this.notes &&
|
|
other.amount == this.amount &&
|
|
other.date == this.date &&
|
|
other.cleared == this.cleared &&
|
|
other.sortOrder == this.sortOrder);
|
|
}
|
|
|
|
class TransactionsCompanion extends UpdateCompanion<Transaction> {
|
|
final Value<int> id;
|
|
final Value<int> accountId;
|
|
final Value<int?> categoryId;
|
|
final Value<String> payee;
|
|
final Value<String?> notes;
|
|
final Value<double> amount;
|
|
final Value<DateTime> date;
|
|
final Value<bool> cleared;
|
|
final Value<int> sortOrder;
|
|
const TransactionsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.accountId = const Value.absent(),
|
|
this.categoryId = const Value.absent(),
|
|
this.payee = const Value.absent(),
|
|
this.notes = const Value.absent(),
|
|
this.amount = const Value.absent(),
|
|
this.date = const Value.absent(),
|
|
this.cleared = const Value.absent(),
|
|
this.sortOrder = const Value.absent(),
|
|
});
|
|
TransactionsCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required int accountId,
|
|
this.categoryId = const Value.absent(),
|
|
required String payee,
|
|
this.notes = const Value.absent(),
|
|
required double amount,
|
|
required DateTime date,
|
|
this.cleared = const Value.absent(),
|
|
this.sortOrder = const Value.absent(),
|
|
}) : accountId = Value(accountId),
|
|
payee = Value(payee),
|
|
amount = Value(amount),
|
|
date = Value(date);
|
|
static Insertable<Transaction> custom({
|
|
Expression<int>? id,
|
|
Expression<int>? accountId,
|
|
Expression<int>? categoryId,
|
|
Expression<String>? payee,
|
|
Expression<String>? notes,
|
|
Expression<double>? amount,
|
|
Expression<DateTime>? date,
|
|
Expression<bool>? cleared,
|
|
Expression<int>? sortOrder,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (accountId != null) 'account_id': accountId,
|
|
if (categoryId != null) 'category_id': categoryId,
|
|
if (payee != null) 'payee': payee,
|
|
if (notes != null) 'notes': notes,
|
|
if (amount != null) 'amount': amount,
|
|
if (date != null) 'date': date,
|
|
if (cleared != null) 'cleared': cleared,
|
|
if (sortOrder != null) 'sort_order': sortOrder,
|
|
});
|
|
}
|
|
|
|
TransactionsCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<int>? accountId,
|
|
Value<int?>? categoryId,
|
|
Value<String>? payee,
|
|
Value<String?>? notes,
|
|
Value<double>? amount,
|
|
Value<DateTime>? date,
|
|
Value<bool>? cleared,
|
|
Value<int>? sortOrder,
|
|
}) {
|
|
return TransactionsCompanion(
|
|
id: id ?? this.id,
|
|
accountId: accountId ?? this.accountId,
|
|
categoryId: categoryId ?? this.categoryId,
|
|
payee: payee ?? this.payee,
|
|
notes: notes ?? this.notes,
|
|
amount: amount ?? this.amount,
|
|
date: date ?? this.date,
|
|
cleared: cleared ?? this.cleared,
|
|
sortOrder: sortOrder ?? this.sortOrder,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (accountId.present) {
|
|
map['account_id'] = Variable<int>(accountId.value);
|
|
}
|
|
if (categoryId.present) {
|
|
map['category_id'] = Variable<int>(categoryId.value);
|
|
}
|
|
if (payee.present) {
|
|
map['payee'] = Variable<String>(payee.value);
|
|
}
|
|
if (notes.present) {
|
|
map['notes'] = Variable<String>(notes.value);
|
|
}
|
|
if (amount.present) {
|
|
map['amount'] = Variable<double>(amount.value);
|
|
}
|
|
if (date.present) {
|
|
map['date'] = Variable<DateTime>(date.value);
|
|
}
|
|
if (cleared.present) {
|
|
map['cleared'] = Variable<bool>(cleared.value);
|
|
}
|
|
if (sortOrder.present) {
|
|
map['sort_order'] = Variable<int>(sortOrder.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('TransactionsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('accountId: $accountId, ')
|
|
..write('categoryId: $categoryId, ')
|
|
..write('payee: $payee, ')
|
|
..write('notes: $notes, ')
|
|
..write('amount: $amount, ')
|
|
..write('date: $date, ')
|
|
..write('cleared: $cleared, ')
|
|
..write('sortOrder: $sortOrder')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $BudgetsTable extends Budgets with TableInfo<$BudgetsTable, Budget> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$BudgetsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'id',
|
|
aliasedName,
|
|
false,
|
|
hasAutoIncrement: true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'PRIMARY KEY AUTOINCREMENT',
|
|
),
|
|
);
|
|
static const VerificationMeta _categoryIdMeta = const VerificationMeta(
|
|
'categoryId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> categoryId = GeneratedColumn<int>(
|
|
'category_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES categories (id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _monthMeta = const VerificationMeta('month');
|
|
@override
|
|
late final GeneratedColumn<String> month = GeneratedColumn<String>(
|
|
'month',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _budgetedMeta = const VerificationMeta(
|
|
'budgeted',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<double> budgeted = GeneratedColumn<double>(
|
|
'budgeted',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.double,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0.0),
|
|
);
|
|
static const VerificationMeta _sortOrderMeta = const VerificationMeta(
|
|
'sortOrder',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> sortOrder = GeneratedColumn<int>(
|
|
'sort_order',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultValue: const Constant(0),
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
id,
|
|
categoryId,
|
|
month,
|
|
budgeted,
|
|
sortOrder,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'budgets';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Budget> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
}
|
|
if (data.containsKey('category_id')) {
|
|
context.handle(
|
|
_categoryIdMeta,
|
|
categoryId.isAcceptableOrUnknown(data['category_id']!, _categoryIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_categoryIdMeta);
|
|
}
|
|
if (data.containsKey('month')) {
|
|
context.handle(
|
|
_monthMeta,
|
|
month.isAcceptableOrUnknown(data['month']!, _monthMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_monthMeta);
|
|
}
|
|
if (data.containsKey('budgeted')) {
|
|
context.handle(
|
|
_budgetedMeta,
|
|
budgeted.isAcceptableOrUnknown(data['budgeted']!, _budgetedMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('sort_order')) {
|
|
context.handle(
|
|
_sortOrderMeta,
|
|
sortOrder.isAcceptableOrUnknown(data['sort_order']!, _sortOrderMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
Budget map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Budget(
|
|
id: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}id'],
|
|
)!,
|
|
categoryId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}category_id'],
|
|
)!,
|
|
month: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}month'],
|
|
)!,
|
|
budgeted: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.double,
|
|
data['${effectivePrefix}budgeted'],
|
|
)!,
|
|
sortOrder: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}sort_order'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$BudgetsTable createAlias(String alias) {
|
|
return $BudgetsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Budget extends DataClass implements Insertable<Budget> {
|
|
final int id;
|
|
final int categoryId;
|
|
final String month;
|
|
final double budgeted;
|
|
final int sortOrder;
|
|
const Budget({
|
|
required this.id,
|
|
required this.categoryId,
|
|
required this.month,
|
|
required this.budgeted,
|
|
required this.sortOrder,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<int>(id);
|
|
map['category_id'] = Variable<int>(categoryId);
|
|
map['month'] = Variable<String>(month);
|
|
map['budgeted'] = Variable<double>(budgeted);
|
|
map['sort_order'] = Variable<int>(sortOrder);
|
|
return map;
|
|
}
|
|
|
|
BudgetsCompanion toCompanion(bool nullToAbsent) {
|
|
return BudgetsCompanion(
|
|
id: Value(id),
|
|
categoryId: Value(categoryId),
|
|
month: Value(month),
|
|
budgeted: Value(budgeted),
|
|
sortOrder: Value(sortOrder),
|
|
);
|
|
}
|
|
|
|
factory Budget.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Budget(
|
|
id: serializer.fromJson<int>(json['id']),
|
|
categoryId: serializer.fromJson<int>(json['categoryId']),
|
|
month: serializer.fromJson<String>(json['month']),
|
|
budgeted: serializer.fromJson<double>(json['budgeted']),
|
|
sortOrder: serializer.fromJson<int>(json['sortOrder']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<int>(id),
|
|
'categoryId': serializer.toJson<int>(categoryId),
|
|
'month': serializer.toJson<String>(month),
|
|
'budgeted': serializer.toJson<double>(budgeted),
|
|
'sortOrder': serializer.toJson<int>(sortOrder),
|
|
};
|
|
}
|
|
|
|
Budget copyWith({
|
|
int? id,
|
|
int? categoryId,
|
|
String? month,
|
|
double? budgeted,
|
|
int? sortOrder,
|
|
}) => Budget(
|
|
id: id ?? this.id,
|
|
categoryId: categoryId ?? this.categoryId,
|
|
month: month ?? this.month,
|
|
budgeted: budgeted ?? this.budgeted,
|
|
sortOrder: sortOrder ?? this.sortOrder,
|
|
);
|
|
Budget copyWithCompanion(BudgetsCompanion data) {
|
|
return Budget(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
categoryId: data.categoryId.present
|
|
? data.categoryId.value
|
|
: this.categoryId,
|
|
month: data.month.present ? data.month.value : this.month,
|
|
budgeted: data.budgeted.present ? data.budgeted.value : this.budgeted,
|
|
sortOrder: data.sortOrder.present ? data.sortOrder.value : this.sortOrder,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Budget(')
|
|
..write('id: $id, ')
|
|
..write('categoryId: $categoryId, ')
|
|
..write('month: $month, ')
|
|
..write('budgeted: $budgeted, ')
|
|
..write('sortOrder: $sortOrder')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, categoryId, month, budgeted, sortOrder);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Budget &&
|
|
other.id == this.id &&
|
|
other.categoryId == this.categoryId &&
|
|
other.month == this.month &&
|
|
other.budgeted == this.budgeted &&
|
|
other.sortOrder == this.sortOrder);
|
|
}
|
|
|
|
class BudgetsCompanion extends UpdateCompanion<Budget> {
|
|
final Value<int> id;
|
|
final Value<int> categoryId;
|
|
final Value<String> month;
|
|
final Value<double> budgeted;
|
|
final Value<int> sortOrder;
|
|
const BudgetsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.categoryId = const Value.absent(),
|
|
this.month = const Value.absent(),
|
|
this.budgeted = const Value.absent(),
|
|
this.sortOrder = const Value.absent(),
|
|
});
|
|
BudgetsCompanion.insert({
|
|
this.id = const Value.absent(),
|
|
required int categoryId,
|
|
required String month,
|
|
this.budgeted = const Value.absent(),
|
|
this.sortOrder = const Value.absent(),
|
|
}) : categoryId = Value(categoryId),
|
|
month = Value(month);
|
|
static Insertable<Budget> custom({
|
|
Expression<int>? id,
|
|
Expression<int>? categoryId,
|
|
Expression<String>? month,
|
|
Expression<double>? budgeted,
|
|
Expression<int>? sortOrder,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (categoryId != null) 'category_id': categoryId,
|
|
if (month != null) 'month': month,
|
|
if (budgeted != null) 'budgeted': budgeted,
|
|
if (sortOrder != null) 'sort_order': sortOrder,
|
|
});
|
|
}
|
|
|
|
BudgetsCompanion copyWith({
|
|
Value<int>? id,
|
|
Value<int>? categoryId,
|
|
Value<String>? month,
|
|
Value<double>? budgeted,
|
|
Value<int>? sortOrder,
|
|
}) {
|
|
return BudgetsCompanion(
|
|
id: id ?? this.id,
|
|
categoryId: categoryId ?? this.categoryId,
|
|
month: month ?? this.month,
|
|
budgeted: budgeted ?? this.budgeted,
|
|
sortOrder: sortOrder ?? this.sortOrder,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<int>(id.value);
|
|
}
|
|
if (categoryId.present) {
|
|
map['category_id'] = Variable<int>(categoryId.value);
|
|
}
|
|
if (month.present) {
|
|
map['month'] = Variable<String>(month.value);
|
|
}
|
|
if (budgeted.present) {
|
|
map['budgeted'] = Variable<double>(budgeted.value);
|
|
}
|
|
if (sortOrder.present) {
|
|
map['sort_order'] = Variable<int>(sortOrder.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('BudgetsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('categoryId: $categoryId, ')
|
|
..write('month: $month, ')
|
|
..write('budgeted: $budgeted, ')
|
|
..write('sortOrder: $sortOrder')
|
|
..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 $CategoryGroupsTable categoryGroups = $CategoryGroupsTable(this);
|
|
late final $CategoriesTable categories = $CategoriesTable(this);
|
|
late final $TransactionsTable transactions = $TransactionsTable(this);
|
|
late final $BudgetsTable budgets = $BudgetsTable(this);
|
|
@override
|
|
Iterable<TableInfo<Table, Object?>> get allTables =>
|
|
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
|
@override
|
|
List<DatabaseSchemaEntity> get allSchemaEntities => [
|
|
accounts,
|
|
categoryGroups,
|
|
categories,
|
|
transactions,
|
|
budgets,
|
|
];
|
|
}
|
|
|
|
typedef $$AccountsTableCreateCompanionBuilder =
|
|
AccountsCompanion Function({
|
|
Value<int> id,
|
|
required String name,
|
|
required String type,
|
|
Value<double> balance,
|
|
Value<bool> isClosed,
|
|
Value<int> sortOrder,
|
|
});
|
|
typedef $$AccountsTableUpdateCompanionBuilder =
|
|
AccountsCompanion Function({
|
|
Value<int> id,
|
|
Value<String> name,
|
|
Value<String> type,
|
|
Value<double> balance,
|
|
Value<bool> isClosed,
|
|
Value<int> sortOrder,
|
|
});
|
|
|
|
final class $$AccountsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $AccountsTable, Account> {
|
|
$$AccountsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
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<String> get type => $composableBuilder(
|
|
column: $table.type,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get balance => $composableBuilder(
|
|
column: $table.balance,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get isClosed => $composableBuilder(
|
|
column: $table.isClosed,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get sortOrder => $composableBuilder(
|
|
column: $table.sortOrder,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
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<String> get type => $composableBuilder(
|
|
column: $table.type,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get balance => $composableBuilder(
|
|
column: $table.balance,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get isClosed => $composableBuilder(
|
|
column: $table.isClosed,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get sortOrder => $composableBuilder(
|
|
column: $table.sortOrder,
|
|
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<String> get type =>
|
|
$composableBuilder(column: $table.type, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get balance =>
|
|
$composableBuilder(column: $table.balance, builder: (column) => column);
|
|
|
|
GeneratedColumn<bool> get isClosed =>
|
|
$composableBuilder(column: $table.isClosed, builder: (column) => column);
|
|
|
|
GeneratedColumn<int> get sortOrder =>
|
|
$composableBuilder(column: $table.sortOrder, builder: (column) => column);
|
|
|
|
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 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<String> type = const Value.absent(),
|
|
Value<double> balance = const Value.absent(),
|
|
Value<bool> isClosed = const Value.absent(),
|
|
Value<int> sortOrder = const Value.absent(),
|
|
}) => AccountsCompanion(
|
|
id: id,
|
|
name: name,
|
|
type: type,
|
|
balance: balance,
|
|
isClosed: isClosed,
|
|
sortOrder: sortOrder,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
required String name,
|
|
required String type,
|
|
Value<double> balance = const Value.absent(),
|
|
Value<bool> isClosed = const Value.absent(),
|
|
Value<int> sortOrder = const Value.absent(),
|
|
}) => AccountsCompanion.insert(
|
|
id: id,
|
|
name: name,
|
|
type: type,
|
|
balance: balance,
|
|
isClosed: isClosed,
|
|
sortOrder: sortOrder,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$AccountsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({transactionsRefs = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [if (transactionsRefs) db.transactions],
|
|
addJoins: null,
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
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 transactionsRefs})
|
|
>;
|
|
typedef $$CategoryGroupsTableCreateCompanionBuilder =
|
|
CategoryGroupsCompanion Function({
|
|
Value<int> id,
|
|
required String name,
|
|
Value<int> sortOrder,
|
|
});
|
|
typedef $$CategoryGroupsTableUpdateCompanionBuilder =
|
|
CategoryGroupsCompanion Function({
|
|
Value<int> id,
|
|
Value<String> name,
|
|
Value<int> sortOrder,
|
|
});
|
|
|
|
final class $$CategoryGroupsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $CategoryGroupsTable, CategoryGroup> {
|
|
$$CategoryGroupsTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static MultiTypedResultKey<$CategoriesTable, List<Category>>
|
|
_categoriesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
|
|
db.categories,
|
|
aliasName: $_aliasNameGenerator(
|
|
db.categoryGroups.id,
|
|
db.categories.groupId,
|
|
),
|
|
);
|
|
|
|
$$CategoriesTableProcessedTableManager get categoriesRefs {
|
|
final manager = $$CategoriesTableTableManager(
|
|
$_db,
|
|
$_db.categories,
|
|
).filter((f) => f.groupId.id.sqlEquals($_itemColumn<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_categoriesRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$CategoryGroupsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $CategoryGroupsTable> {
|
|
$$CategoryGroupsTableFilterComposer({
|
|
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<int> get sortOrder => $composableBuilder(
|
|
column: $table.sortOrder,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
Expression<bool> categoriesRefs(
|
|
Expression<bool> Function($$CategoriesTableFilterComposer f) f,
|
|
) {
|
|
final $$CategoriesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.id,
|
|
referencedTable: $db.categories,
|
|
getReferencedColumn: (t) => t.groupId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoriesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.categories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$CategoryGroupsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $CategoryGroupsTable> {
|
|
$$CategoryGroupsTableOrderingComposer({
|
|
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<int> get sortOrder => $composableBuilder(
|
|
column: $table.sortOrder,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$CategoryGroupsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $CategoryGroupsTable> {
|
|
$$CategoryGroupsTableAnnotationComposer({
|
|
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<int> get sortOrder =>
|
|
$composableBuilder(column: $table.sortOrder, builder: (column) => column);
|
|
|
|
Expression<T> categoriesRefs<T extends Object>(
|
|
Expression<T> Function($$CategoriesTableAnnotationComposer a) f,
|
|
) {
|
|
final $$CategoriesTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.id,
|
|
referencedTable: $db.categories,
|
|
getReferencedColumn: (t) => t.groupId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoriesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.categories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$CategoryGroupsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$CategoryGroupsTable,
|
|
CategoryGroup,
|
|
$$CategoryGroupsTableFilterComposer,
|
|
$$CategoryGroupsTableOrderingComposer,
|
|
$$CategoryGroupsTableAnnotationComposer,
|
|
$$CategoryGroupsTableCreateCompanionBuilder,
|
|
$$CategoryGroupsTableUpdateCompanionBuilder,
|
|
(CategoryGroup, $$CategoryGroupsTableReferences),
|
|
CategoryGroup,
|
|
PrefetchHooks Function({bool categoriesRefs})
|
|
> {
|
|
$$CategoryGroupsTableTableManager(
|
|
_$AppDatabase db,
|
|
$CategoryGroupsTable table,
|
|
) : super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$CategoryGroupsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$CategoryGroupsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$CategoryGroupsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<int> sortOrder = const Value.absent(),
|
|
}) => CategoryGroupsCompanion(
|
|
id: id,
|
|
name: name,
|
|
sortOrder: sortOrder,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
required String name,
|
|
Value<int> sortOrder = const Value.absent(),
|
|
}) => CategoryGroupsCompanion.insert(
|
|
id: id,
|
|
name: name,
|
|
sortOrder: sortOrder,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$CategoryGroupsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({categoriesRefs = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [if (categoriesRefs) db.categories],
|
|
addJoins: null,
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (categoriesRefs)
|
|
await $_getPrefetchedData<
|
|
CategoryGroup,
|
|
$CategoryGroupsTable,
|
|
Category
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$CategoryGroupsTableReferences
|
|
._categoriesRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$CategoryGroupsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).categoriesRefs,
|
|
referencedItemsForCurrentItem: (item, referencedItems) =>
|
|
referencedItems.where((e) => e.groupId == item.id),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$CategoryGroupsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$CategoryGroupsTable,
|
|
CategoryGroup,
|
|
$$CategoryGroupsTableFilterComposer,
|
|
$$CategoryGroupsTableOrderingComposer,
|
|
$$CategoryGroupsTableAnnotationComposer,
|
|
$$CategoryGroupsTableCreateCompanionBuilder,
|
|
$$CategoryGroupsTableUpdateCompanionBuilder,
|
|
(CategoryGroup, $$CategoryGroupsTableReferences),
|
|
CategoryGroup,
|
|
PrefetchHooks Function({bool categoriesRefs})
|
|
>;
|
|
typedef $$CategoriesTableCreateCompanionBuilder =
|
|
CategoriesCompanion Function({
|
|
Value<int> id,
|
|
required String name,
|
|
required int groupId,
|
|
Value<double> budgeted,
|
|
Value<int> sortOrder,
|
|
Value<String?> icon,
|
|
});
|
|
typedef $$CategoriesTableUpdateCompanionBuilder =
|
|
CategoriesCompanion Function({
|
|
Value<int> id,
|
|
Value<String> name,
|
|
Value<int> groupId,
|
|
Value<double> budgeted,
|
|
Value<int> sortOrder,
|
|
Value<String?> icon,
|
|
});
|
|
|
|
final class $$CategoriesTableReferences
|
|
extends BaseReferences<_$AppDatabase, $CategoriesTable, Category> {
|
|
$$CategoriesTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $CategoryGroupsTable _groupIdTable(_$AppDatabase db) =>
|
|
db.categoryGroups.createAlias(
|
|
$_aliasNameGenerator(db.categories.groupId, db.categoryGroups.id),
|
|
);
|
|
|
|
$$CategoryGroupsTableProcessedTableManager get groupId {
|
|
final $_column = $_itemColumn<int>('group_id')!;
|
|
|
|
final manager = $$CategoryGroupsTableTableManager(
|
|
$_db,
|
|
$_db.categoryGroups,
|
|
).filter((f) => f.id.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_groupIdTable($_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.categories.id,
|
|
db.transactions.categoryId,
|
|
),
|
|
);
|
|
|
|
$$TransactionsTableProcessedTableManager get transactionsRefs {
|
|
final manager = $$TransactionsTableTableManager(
|
|
$_db,
|
|
$_db.transactions,
|
|
).filter((f) => f.categoryId.id.sqlEquals($_itemColumn<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_transactionsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$BudgetsTable, List<Budget>> _budgetsRefsTable(
|
|
_$AppDatabase db,
|
|
) => MultiTypedResultKey.fromTable(
|
|
db.budgets,
|
|
aliasName: $_aliasNameGenerator(db.categories.id, db.budgets.categoryId),
|
|
);
|
|
|
|
$$BudgetsTableProcessedTableManager get budgetsRefs {
|
|
final manager = $$BudgetsTableTableManager(
|
|
$_db,
|
|
$_db.budgets,
|
|
).filter((f) => f.categoryId.id.sqlEquals($_itemColumn<int>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_budgetsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$CategoriesTableFilterComposer
|
|
extends Composer<_$AppDatabase, $CategoriesTable> {
|
|
$$CategoriesTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get budgeted => $composableBuilder(
|
|
column: $table.budgeted,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get sortOrder => $composableBuilder(
|
|
column: $table.sortOrder,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get icon => $composableBuilder(
|
|
column: $table.icon,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$CategoryGroupsTableFilterComposer get groupId {
|
|
final $$CategoryGroupsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.groupId,
|
|
referencedTable: $db.categoryGroups,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoryGroupsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.categoryGroups,
|
|
$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.categoryId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$TransactionsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.transactions,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> budgetsRefs(
|
|
Expression<bool> Function($$BudgetsTableFilterComposer f) f,
|
|
) {
|
|
final $$BudgetsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.id,
|
|
referencedTable: $db.budgets,
|
|
getReferencedColumn: (t) => t.categoryId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$BudgetsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.budgets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$CategoriesTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $CategoriesTable> {
|
|
$$CategoriesTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get budgeted => $composableBuilder(
|
|
column: $table.budgeted,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get sortOrder => $composableBuilder(
|
|
column: $table.sortOrder,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get icon => $composableBuilder(
|
|
column: $table.icon,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$CategoryGroupsTableOrderingComposer get groupId {
|
|
final $$CategoryGroupsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.groupId,
|
|
referencedTable: $db.categoryGroups,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoryGroupsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.categoryGroups,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$CategoriesTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $CategoriesTable> {
|
|
$$CategoriesTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get budgeted =>
|
|
$composableBuilder(column: $table.budgeted, builder: (column) => column);
|
|
|
|
GeneratedColumn<int> get sortOrder =>
|
|
$composableBuilder(column: $table.sortOrder, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get icon =>
|
|
$composableBuilder(column: $table.icon, builder: (column) => column);
|
|
|
|
$$CategoryGroupsTableAnnotationComposer get groupId {
|
|
final $$CategoryGroupsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.groupId,
|
|
referencedTable: $db.categoryGroups,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoryGroupsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.categoryGroups,
|
|
$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.categoryId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$TransactionsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.transactions,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> budgetsRefs<T extends Object>(
|
|
Expression<T> Function($$BudgetsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$BudgetsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.id,
|
|
referencedTable: $db.budgets,
|
|
getReferencedColumn: (t) => t.categoryId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$BudgetsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.budgets,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$CategoriesTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$CategoriesTable,
|
|
Category,
|
|
$$CategoriesTableFilterComposer,
|
|
$$CategoriesTableOrderingComposer,
|
|
$$CategoriesTableAnnotationComposer,
|
|
$$CategoriesTableCreateCompanionBuilder,
|
|
$$CategoriesTableUpdateCompanionBuilder,
|
|
(Category, $$CategoriesTableReferences),
|
|
Category,
|
|
PrefetchHooks Function({
|
|
bool groupId,
|
|
bool transactionsRefs,
|
|
bool budgetsRefs,
|
|
})
|
|
> {
|
|
$$CategoriesTableTableManager(_$AppDatabase db, $CategoriesTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$CategoriesTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$CategoriesTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$CategoriesTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<int> groupId = const Value.absent(),
|
|
Value<double> budgeted = const Value.absent(),
|
|
Value<int> sortOrder = const Value.absent(),
|
|
Value<String?> icon = const Value.absent(),
|
|
}) => CategoriesCompanion(
|
|
id: id,
|
|
name: name,
|
|
groupId: groupId,
|
|
budgeted: budgeted,
|
|
sortOrder: sortOrder,
|
|
icon: icon,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
required String name,
|
|
required int groupId,
|
|
Value<double> budgeted = const Value.absent(),
|
|
Value<int> sortOrder = const Value.absent(),
|
|
Value<String?> icon = const Value.absent(),
|
|
}) => CategoriesCompanion.insert(
|
|
id: id,
|
|
name: name,
|
|
groupId: groupId,
|
|
budgeted: budgeted,
|
|
sortOrder: sortOrder,
|
|
icon: icon,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$CategoriesTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({
|
|
groupId = false,
|
|
transactionsRefs = false,
|
|
budgetsRefs = false,
|
|
}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [
|
|
if (transactionsRefs) db.transactions,
|
|
if (budgetsRefs) db.budgets,
|
|
],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (groupId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.groupId,
|
|
referencedTable: $$CategoriesTableReferences
|
|
._groupIdTable(db),
|
|
referencedColumn:
|
|
$$CategoriesTableReferences
|
|
._groupIdTable(db)
|
|
.id,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (transactionsRefs)
|
|
await $_getPrefetchedData<
|
|
Category,
|
|
$CategoriesTable,
|
|
Transaction
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$CategoriesTableReferences
|
|
._transactionsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$CategoriesTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).transactionsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.categoryId == item.id,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (budgetsRefs)
|
|
await $_getPrefetchedData<
|
|
Category,
|
|
$CategoriesTable,
|
|
Budget
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$CategoriesTableReferences
|
|
._budgetsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$CategoriesTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).budgetsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.categoryId == item.id,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$CategoriesTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$CategoriesTable,
|
|
Category,
|
|
$$CategoriesTableFilterComposer,
|
|
$$CategoriesTableOrderingComposer,
|
|
$$CategoriesTableAnnotationComposer,
|
|
$$CategoriesTableCreateCompanionBuilder,
|
|
$$CategoriesTableUpdateCompanionBuilder,
|
|
(Category, $$CategoriesTableReferences),
|
|
Category,
|
|
PrefetchHooks Function({
|
|
bool groupId,
|
|
bool transactionsRefs,
|
|
bool budgetsRefs,
|
|
})
|
|
>;
|
|
typedef $$TransactionsTableCreateCompanionBuilder =
|
|
TransactionsCompanion Function({
|
|
Value<int> id,
|
|
required int accountId,
|
|
Value<int?> categoryId,
|
|
required String payee,
|
|
Value<String?> notes,
|
|
required double amount,
|
|
required DateTime date,
|
|
Value<bool> cleared,
|
|
Value<int> sortOrder,
|
|
});
|
|
typedef $$TransactionsTableUpdateCompanionBuilder =
|
|
TransactionsCompanion Function({
|
|
Value<int> id,
|
|
Value<int> accountId,
|
|
Value<int?> categoryId,
|
|
Value<String> payee,
|
|
Value<String?> notes,
|
|
Value<double> amount,
|
|
Value<DateTime> date,
|
|
Value<bool> cleared,
|
|
Value<int> sortOrder,
|
|
});
|
|
|
|
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 $CategoriesTable _categoryIdTable(_$AppDatabase db) =>
|
|
db.categories.createAlias(
|
|
$_aliasNameGenerator(db.transactions.categoryId, db.categories.id),
|
|
);
|
|
|
|
$$CategoriesTableProcessedTableManager? get categoryId {
|
|
final $_column = $_itemColumn<int>('category_id');
|
|
if ($_column == null) return null;
|
|
final manager = $$CategoriesTableTableManager(
|
|
$_db,
|
|
$_db.categories,
|
|
).filter((f) => f.id.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_categoryIdTable($_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 payee => $composableBuilder(
|
|
column: $table.payee,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get notes => $composableBuilder(
|
|
column: $table.notes,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<DateTime> get date => $composableBuilder(
|
|
column: $table.date,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get cleared => $composableBuilder(
|
|
column: $table.cleared,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get sortOrder => $composableBuilder(
|
|
column: $table.sortOrder,
|
|
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;
|
|
}
|
|
|
|
$$CategoriesTableFilterComposer get categoryId {
|
|
final $$CategoriesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.categoryId,
|
|
referencedTable: $db.categories,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoriesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.categories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$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 payee => $composableBuilder(
|
|
column: $table.payee,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get notes => $composableBuilder(
|
|
column: $table.notes,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get amount => $composableBuilder(
|
|
column: $table.amount,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<DateTime> get date => $composableBuilder(
|
|
column: $table.date,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get cleared => $composableBuilder(
|
|
column: $table.cleared,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get sortOrder => $composableBuilder(
|
|
column: $table.sortOrder,
|
|
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;
|
|
}
|
|
|
|
$$CategoriesTableOrderingComposer get categoryId {
|
|
final $$CategoriesTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.categoryId,
|
|
referencedTable: $db.categories,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoriesTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.categories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$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 payee =>
|
|
$composableBuilder(column: $table.payee, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get notes =>
|
|
$composableBuilder(column: $table.notes, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get amount =>
|
|
$composableBuilder(column: $table.amount, builder: (column) => column);
|
|
|
|
GeneratedColumn<DateTime> get date =>
|
|
$composableBuilder(column: $table.date, builder: (column) => column);
|
|
|
|
GeneratedColumn<bool> get cleared =>
|
|
$composableBuilder(column: $table.cleared, builder: (column) => column);
|
|
|
|
GeneratedColumn<int> get sortOrder =>
|
|
$composableBuilder(column: $table.sortOrder, 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;
|
|
}
|
|
|
|
$$CategoriesTableAnnotationComposer get categoryId {
|
|
final $$CategoriesTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.categoryId,
|
|
referencedTable: $db.categories,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoriesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.categories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$TransactionsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$TransactionsTable,
|
|
Transaction,
|
|
$$TransactionsTableFilterComposer,
|
|
$$TransactionsTableOrderingComposer,
|
|
$$TransactionsTableAnnotationComposer,
|
|
$$TransactionsTableCreateCompanionBuilder,
|
|
$$TransactionsTableUpdateCompanionBuilder,
|
|
(Transaction, $$TransactionsTableReferences),
|
|
Transaction,
|
|
PrefetchHooks Function({bool accountId, bool categoryId})
|
|
> {
|
|
$$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<int> accountId = const Value.absent(),
|
|
Value<int?> categoryId = const Value.absent(),
|
|
Value<String> payee = const Value.absent(),
|
|
Value<String?> notes = const Value.absent(),
|
|
Value<double> amount = const Value.absent(),
|
|
Value<DateTime> date = const Value.absent(),
|
|
Value<bool> cleared = const Value.absent(),
|
|
Value<int> sortOrder = const Value.absent(),
|
|
}) => TransactionsCompanion(
|
|
id: id,
|
|
accountId: accountId,
|
|
categoryId: categoryId,
|
|
payee: payee,
|
|
notes: notes,
|
|
amount: amount,
|
|
date: date,
|
|
cleared: cleared,
|
|
sortOrder: sortOrder,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
required int accountId,
|
|
Value<int?> categoryId = const Value.absent(),
|
|
required String payee,
|
|
Value<String?> notes = const Value.absent(),
|
|
required double amount,
|
|
required DateTime date,
|
|
Value<bool> cleared = const Value.absent(),
|
|
Value<int> sortOrder = const Value.absent(),
|
|
}) => TransactionsCompanion.insert(
|
|
id: id,
|
|
accountId: accountId,
|
|
categoryId: categoryId,
|
|
payee: payee,
|
|
notes: notes,
|
|
amount: amount,
|
|
date: date,
|
|
cleared: cleared,
|
|
sortOrder: sortOrder,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$TransactionsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({accountId = false, categoryId = 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 (categoryId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.categoryId,
|
|
referencedTable: $$TransactionsTableReferences
|
|
._categoryIdTable(db),
|
|
referencedColumn: $$TransactionsTableReferences
|
|
._categoryIdTable(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 categoryId})
|
|
>;
|
|
typedef $$BudgetsTableCreateCompanionBuilder =
|
|
BudgetsCompanion Function({
|
|
Value<int> id,
|
|
required int categoryId,
|
|
required String month,
|
|
Value<double> budgeted,
|
|
Value<int> sortOrder,
|
|
});
|
|
typedef $$BudgetsTableUpdateCompanionBuilder =
|
|
BudgetsCompanion Function({
|
|
Value<int> id,
|
|
Value<int> categoryId,
|
|
Value<String> month,
|
|
Value<double> budgeted,
|
|
Value<int> sortOrder,
|
|
});
|
|
|
|
final class $$BudgetsTableReferences
|
|
extends BaseReferences<_$AppDatabase, $BudgetsTable, Budget> {
|
|
$$BudgetsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $CategoriesTable _categoryIdTable(_$AppDatabase db) =>
|
|
db.categories.createAlias(
|
|
$_aliasNameGenerator(db.budgets.categoryId, db.categories.id),
|
|
);
|
|
|
|
$$CategoriesTableProcessedTableManager get categoryId {
|
|
final $_column = $_itemColumn<int>('category_id')!;
|
|
|
|
final manager = $$CategoriesTableTableManager(
|
|
$_db,
|
|
$_db.categories,
|
|
).filter((f) => f.id.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_categoryIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$BudgetsTableFilterComposer
|
|
extends Composer<_$AppDatabase, $BudgetsTable> {
|
|
$$BudgetsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get month => $composableBuilder(
|
|
column: $table.month,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<double> get budgeted => $composableBuilder(
|
|
column: $table.budgeted,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get sortOrder => $composableBuilder(
|
|
column: $table.sortOrder,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$CategoriesTableFilterComposer get categoryId {
|
|
final $$CategoriesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.categoryId,
|
|
referencedTable: $db.categories,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoriesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.categories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$BudgetsTableOrderingComposer
|
|
extends Composer<_$AppDatabase, $BudgetsTable> {
|
|
$$BudgetsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get month => $composableBuilder(
|
|
column: $table.month,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<double> get budgeted => $composableBuilder(
|
|
column: $table.budgeted,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get sortOrder => $composableBuilder(
|
|
column: $table.sortOrder,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$CategoriesTableOrderingComposer get categoryId {
|
|
final $$CategoriesTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.categoryId,
|
|
referencedTable: $db.categories,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoriesTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.categories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$BudgetsTableAnnotationComposer
|
|
extends Composer<_$AppDatabase, $BudgetsTable> {
|
|
$$BudgetsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get month =>
|
|
$composableBuilder(column: $table.month, builder: (column) => column);
|
|
|
|
GeneratedColumn<double> get budgeted =>
|
|
$composableBuilder(column: $table.budgeted, builder: (column) => column);
|
|
|
|
GeneratedColumn<int> get sortOrder =>
|
|
$composableBuilder(column: $table.sortOrder, builder: (column) => column);
|
|
|
|
$$CategoriesTableAnnotationComposer get categoryId {
|
|
final $$CategoriesTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.categoryId,
|
|
referencedTable: $db.categories,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$CategoriesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.categories,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$BudgetsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$AppDatabase,
|
|
$BudgetsTable,
|
|
Budget,
|
|
$$BudgetsTableFilterComposer,
|
|
$$BudgetsTableOrderingComposer,
|
|
$$BudgetsTableAnnotationComposer,
|
|
$$BudgetsTableCreateCompanionBuilder,
|
|
$$BudgetsTableUpdateCompanionBuilder,
|
|
(Budget, $$BudgetsTableReferences),
|
|
Budget,
|
|
PrefetchHooks Function({bool categoryId})
|
|
> {
|
|
$$BudgetsTableTableManager(_$AppDatabase db, $BudgetsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$BudgetsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$BudgetsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$BudgetsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
Value<int> categoryId = const Value.absent(),
|
|
Value<String> month = const Value.absent(),
|
|
Value<double> budgeted = const Value.absent(),
|
|
Value<int> sortOrder = const Value.absent(),
|
|
}) => BudgetsCompanion(
|
|
id: id,
|
|
categoryId: categoryId,
|
|
month: month,
|
|
budgeted: budgeted,
|
|
sortOrder: sortOrder,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
Value<int> id = const Value.absent(),
|
|
required int categoryId,
|
|
required String month,
|
|
Value<double> budgeted = const Value.absent(),
|
|
Value<int> sortOrder = const Value.absent(),
|
|
}) => BudgetsCompanion.insert(
|
|
id: id,
|
|
categoryId: categoryId,
|
|
month: month,
|
|
budgeted: budgeted,
|
|
sortOrder: sortOrder,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$BudgetsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({categoryId = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (categoryId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.categoryId,
|
|
referencedTable: $$BudgetsTableReferences
|
|
._categoryIdTable(db),
|
|
referencedColumn: $$BudgetsTableReferences
|
|
._categoryIdTable(db)
|
|
.id,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$BudgetsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$AppDatabase,
|
|
$BudgetsTable,
|
|
Budget,
|
|
$$BudgetsTableFilterComposer,
|
|
$$BudgetsTableOrderingComposer,
|
|
$$BudgetsTableAnnotationComposer,
|
|
$$BudgetsTableCreateCompanionBuilder,
|
|
$$BudgetsTableUpdateCompanionBuilder,
|
|
(Budget, $$BudgetsTableReferences),
|
|
Budget,
|
|
PrefetchHooks Function({bool categoryId})
|
|
>;
|
|
|
|
class $AppDatabaseManager {
|
|
final _$AppDatabase _db;
|
|
$AppDatabaseManager(this._db);
|
|
$$AccountsTableTableManager get accounts =>
|
|
$$AccountsTableTableManager(_db, _db.accounts);
|
|
$$CategoryGroupsTableTableManager get categoryGroups =>
|
|
$$CategoryGroupsTableTableManager(_db, _db.categoryGroups);
|
|
$$CategoriesTableTableManager get categories =>
|
|
$$CategoriesTableTableManager(_db, _db.categories);
|
|
$$TransactionsTableTableManager get transactions =>
|
|
$$TransactionsTableTableManager(_db, _db.transactions);
|
|
$$BudgetsTableTableManager get budgets =>
|
|
$$BudgetsTableTableManager(_db, _db.budgets);
|
|
}
|