groceries_manager/lib/db/database.g.dart
2025-01-05 16:01:21 +07:00

3265 lines
117 KiB
Dart

// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'database.dart';
// ignore_for_file: type=lint
class $ProductCategoryTable extends ProductCategory
with TableInfo<$ProductCategoryTable, ProductCategoryData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$ProductCategoryTable(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 _iconMeta = const VerificationMeta('icon');
@override
late final GeneratedColumn<String> icon = GeneratedColumn<String>(
'icon', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
@override
List<GeneratedColumn> get $columns => [id, name, icon];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'product_category';
@override
VerificationContext validateIntegrity(
Insertable<ProductCategoryData> 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('icon')) {
context.handle(
_iconMeta, icon.isAcceptableOrUnknown(data['icon']!, _iconMeta));
} else if (isInserting) {
context.missing(_iconMeta);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
ProductCategoryData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return ProductCategoryData(
id: attachedDatabase.typeMapping
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
name: attachedDatabase.typeMapping
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
icon: attachedDatabase.typeMapping
.read(DriftSqlType.string, data['${effectivePrefix}icon'])!,
);
}
@override
$ProductCategoryTable createAlias(String alias) {
return $ProductCategoryTable(attachedDatabase, alias);
}
}
class ProductCategoryData extends DataClass
implements Insertable<ProductCategoryData> {
final int id;
final String name;
final String icon;
const ProductCategoryData(
{required this.id, required this.name, required this.icon});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<int>(id);
map['name'] = Variable<String>(name);
map['icon'] = Variable<String>(icon);
return map;
}
ProductCategoryCompanion toCompanion(bool nullToAbsent) {
return ProductCategoryCompanion(
id: Value(id),
name: Value(name),
icon: Value(icon),
);
}
factory ProductCategoryData.fromJson(Map<String, dynamic> json,
{ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return ProductCategoryData(
id: serializer.fromJson<int>(json['id']),
name: serializer.fromJson<String>(json['name']),
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),
'icon': serializer.toJson<String>(icon),
};
}
ProductCategoryData copyWith({int? id, String? name, String? icon}) =>
ProductCategoryData(
id: id ?? this.id,
name: name ?? this.name,
icon: icon ?? this.icon,
);
ProductCategoryData copyWithCompanion(ProductCategoryCompanion data) {
return ProductCategoryData(
id: data.id.present ? data.id.value : this.id,
name: data.name.present ? data.name.value : this.name,
icon: data.icon.present ? data.icon.value : this.icon,
);
}
@override
String toString() {
return (StringBuffer('ProductCategoryData(')
..write('id: $id, ')
..write('name: $name, ')
..write('icon: $icon')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(id, name, icon);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is ProductCategoryData &&
other.id == this.id &&
other.name == this.name &&
other.icon == this.icon);
}
class ProductCategoryCompanion extends UpdateCompanion<ProductCategoryData> {
final Value<int> id;
final Value<String> name;
final Value<String> icon;
const ProductCategoryCompanion({
this.id = const Value.absent(),
this.name = const Value.absent(),
this.icon = const Value.absent(),
});
ProductCategoryCompanion.insert({
this.id = const Value.absent(),
required String name,
required String icon,
}) : name = Value(name),
icon = Value(icon);
static Insertable<ProductCategoryData> custom({
Expression<int>? id,
Expression<String>? name,
Expression<String>? icon,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (name != null) 'name': name,
if (icon != null) 'icon': icon,
});
}
ProductCategoryCompanion copyWith(
{Value<int>? id, Value<String>? name, Value<String>? icon}) {
return ProductCategoryCompanion(
id: id ?? this.id,
name: name ?? this.name,
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 (icon.present) {
map['icon'] = Variable<String>(icon.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('ProductCategoryCompanion(')
..write('id: $id, ')
..write('name: $name, ')
..write('icon: $icon')
..write(')'))
.toString();
}
}
class $StorageLocationTable extends StorageLocation
with TableInfo<$StorageLocationTable, StorageLocationData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$StorageLocationTable(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 _descriptionMeta =
const VerificationMeta('description');
@override
late final GeneratedColumn<String> description = GeneratedColumn<String>(
'description', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
static const VerificationMeta _temperatureModeMeta =
const VerificationMeta('temperatureMode');
@override
late final GeneratedColumn<String> temperatureMode = GeneratedColumn<String>(
'temperature_mode', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
static const VerificationMeta _iconMeta = const VerificationMeta('icon');
@override
late final GeneratedColumn<String> icon = GeneratedColumn<String>(
'icon', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
static const VerificationMeta _isDefaultMeta =
const VerificationMeta('isDefault');
@override
late final GeneratedColumn<bool> isDefault = GeneratedColumn<bool>(
'is_default', aliasedName, false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints:
GeneratedColumn.constraintIsAlways('CHECK ("is_default" IN (0, 1))'),
defaultValue: const Constant(false));
@override
List<GeneratedColumn> get $columns =>
[id, name, description, temperatureMode, icon, isDefault];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'storage_location';
@override
VerificationContext validateIntegrity(
Insertable<StorageLocationData> 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('description')) {
context.handle(
_descriptionMeta,
description.isAcceptableOrUnknown(
data['description']!, _descriptionMeta));
} else if (isInserting) {
context.missing(_descriptionMeta);
}
if (data.containsKey('temperature_mode')) {
context.handle(
_temperatureModeMeta,
temperatureMode.isAcceptableOrUnknown(
data['temperature_mode']!, _temperatureModeMeta));
} else if (isInserting) {
context.missing(_temperatureModeMeta);
}
if (data.containsKey('icon')) {
context.handle(
_iconMeta, icon.isAcceptableOrUnknown(data['icon']!, _iconMeta));
} else if (isInserting) {
context.missing(_iconMeta);
}
if (data.containsKey('is_default')) {
context.handle(_isDefaultMeta,
isDefault.isAcceptableOrUnknown(data['is_default']!, _isDefaultMeta));
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
StorageLocationData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return StorageLocationData(
id: attachedDatabase.typeMapping
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
name: attachedDatabase.typeMapping
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
description: attachedDatabase.typeMapping
.read(DriftSqlType.string, data['${effectivePrefix}description'])!,
temperatureMode: attachedDatabase.typeMapping.read(
DriftSqlType.string, data['${effectivePrefix}temperature_mode'])!,
icon: attachedDatabase.typeMapping
.read(DriftSqlType.string, data['${effectivePrefix}icon'])!,
isDefault: attachedDatabase.typeMapping
.read(DriftSqlType.bool, data['${effectivePrefix}is_default'])!,
);
}
@override
$StorageLocationTable createAlias(String alias) {
return $StorageLocationTable(attachedDatabase, alias);
}
}
class StorageLocationData extends DataClass
implements Insertable<StorageLocationData> {
final int id;
final String name;
final String description;
final String temperatureMode;
final String icon;
final bool isDefault;
const StorageLocationData(
{required this.id,
required this.name,
required this.description,
required this.temperatureMode,
required this.icon,
required this.isDefault});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<int>(id);
map['name'] = Variable<String>(name);
map['description'] = Variable<String>(description);
map['temperature_mode'] = Variable<String>(temperatureMode);
map['icon'] = Variable<String>(icon);
map['is_default'] = Variable<bool>(isDefault);
return map;
}
StorageLocationCompanion toCompanion(bool nullToAbsent) {
return StorageLocationCompanion(
id: Value(id),
name: Value(name),
description: Value(description),
temperatureMode: Value(temperatureMode),
icon: Value(icon),
isDefault: Value(isDefault),
);
}
factory StorageLocationData.fromJson(Map<String, dynamic> json,
{ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return StorageLocationData(
id: serializer.fromJson<int>(json['id']),
name: serializer.fromJson<String>(json['name']),
description: serializer.fromJson<String>(json['description']),
temperatureMode: serializer.fromJson<String>(json['temperatureMode']),
icon: serializer.fromJson<String>(json['icon']),
isDefault: serializer.fromJson<bool>(json['isDefault']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<int>(id),
'name': serializer.toJson<String>(name),
'description': serializer.toJson<String>(description),
'temperatureMode': serializer.toJson<String>(temperatureMode),
'icon': serializer.toJson<String>(icon),
'isDefault': serializer.toJson<bool>(isDefault),
};
}
StorageLocationData copyWith(
{int? id,
String? name,
String? description,
String? temperatureMode,
String? icon,
bool? isDefault}) =>
StorageLocationData(
id: id ?? this.id,
name: name ?? this.name,
description: description ?? this.description,
temperatureMode: temperatureMode ?? this.temperatureMode,
icon: icon ?? this.icon,
isDefault: isDefault ?? this.isDefault,
);
StorageLocationData copyWithCompanion(StorageLocationCompanion data) {
return StorageLocationData(
id: data.id.present ? data.id.value : this.id,
name: data.name.present ? data.name.value : this.name,
description:
data.description.present ? data.description.value : this.description,
temperatureMode: data.temperatureMode.present
? data.temperatureMode.value
: this.temperatureMode,
icon: data.icon.present ? data.icon.value : this.icon,
isDefault: data.isDefault.present ? data.isDefault.value : this.isDefault,
);
}
@override
String toString() {
return (StringBuffer('StorageLocationData(')
..write('id: $id, ')
..write('name: $name, ')
..write('description: $description, ')
..write('temperatureMode: $temperatureMode, ')
..write('icon: $icon, ')
..write('isDefault: $isDefault')
..write(')'))
.toString();
}
@override
int get hashCode =>
Object.hash(id, name, description, temperatureMode, icon, isDefault);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is StorageLocationData &&
other.id == this.id &&
other.name == this.name &&
other.description == this.description &&
other.temperatureMode == this.temperatureMode &&
other.icon == this.icon &&
other.isDefault == this.isDefault);
}
class StorageLocationCompanion extends UpdateCompanion<StorageLocationData> {
final Value<int> id;
final Value<String> name;
final Value<String> description;
final Value<String> temperatureMode;
final Value<String> icon;
final Value<bool> isDefault;
const StorageLocationCompanion({
this.id = const Value.absent(),
this.name = const Value.absent(),
this.description = const Value.absent(),
this.temperatureMode = const Value.absent(),
this.icon = const Value.absent(),
this.isDefault = const Value.absent(),
});
StorageLocationCompanion.insert({
this.id = const Value.absent(),
required String name,
required String description,
required String temperatureMode,
required String icon,
this.isDefault = const Value.absent(),
}) : name = Value(name),
description = Value(description),
temperatureMode = Value(temperatureMode),
icon = Value(icon);
static Insertable<StorageLocationData> custom({
Expression<int>? id,
Expression<String>? name,
Expression<String>? description,
Expression<String>? temperatureMode,
Expression<String>? icon,
Expression<bool>? isDefault,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (name != null) 'name': name,
if (description != null) 'description': description,
if (temperatureMode != null) 'temperature_mode': temperatureMode,
if (icon != null) 'icon': icon,
if (isDefault != null) 'is_default': isDefault,
});
}
StorageLocationCompanion copyWith(
{Value<int>? id,
Value<String>? name,
Value<String>? description,
Value<String>? temperatureMode,
Value<String>? icon,
Value<bool>? isDefault}) {
return StorageLocationCompanion(
id: id ?? this.id,
name: name ?? this.name,
description: description ?? this.description,
temperatureMode: temperatureMode ?? this.temperatureMode,
icon: icon ?? this.icon,
isDefault: isDefault ?? this.isDefault,
);
}
@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 (description.present) {
map['description'] = Variable<String>(description.value);
}
if (temperatureMode.present) {
map['temperature_mode'] = Variable<String>(temperatureMode.value);
}
if (icon.present) {
map['icon'] = Variable<String>(icon.value);
}
if (isDefault.present) {
map['is_default'] = Variable<bool>(isDefault.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('StorageLocationCompanion(')
..write('id: $id, ')
..write('name: $name, ')
..write('description: $description, ')
..write('temperatureMode: $temperatureMode, ')
..write('icon: $icon, ')
..write('isDefault: $isDefault')
..write(')'))
.toString();
}
}
class $ProductTable extends Product with TableInfo<$ProductTable, ProductData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$ProductTable(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 _categoryMeta =
const VerificationMeta('category');
@override
late final GeneratedColumn<int> category = GeneratedColumn<int>(
'category', aliasedName, false,
type: DriftSqlType.int,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES product_category (id)'));
static const VerificationMeta _storageMeta =
const VerificationMeta('storage');
@override
late final GeneratedColumn<int> storage = GeneratedColumn<int>(
'storage', aliasedName, false,
type: DriftSqlType.int,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES storage_location (id)'));
static const VerificationMeta _quantityMeta =
const VerificationMeta('quantity');
@override
late final GeneratedColumn<double> quantity = GeneratedColumn<double>(
'quantity', aliasedName, false,
type: DriftSqlType.double, requiredDuringInsert: true);
static const VerificationMeta _unitMeta = const VerificationMeta('unit');
@override
late final GeneratedColumn<String> unit = GeneratedColumn<String>(
'unit', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
static const VerificationMeta _purchaseDateMeta =
const VerificationMeta('purchaseDate');
@override
late final GeneratedColumn<DateTime> purchaseDate = GeneratedColumn<DateTime>(
'purchase_date', aliasedName, true,
type: DriftSqlType.dateTime, requiredDuringInsert: false);
static const VerificationMeta _expiryDateMeta =
const VerificationMeta('expiryDate');
@override
late final GeneratedColumn<DateTime> expiryDate = GeneratedColumn<DateTime>(
'expiry_date', aliasedName, true,
type: DriftSqlType.dateTime, requiredDuringInsert: false);
static const VerificationMeta _barcodeMeta =
const VerificationMeta('barcode');
@override
late final GeneratedColumn<String> barcode = GeneratedColumn<String>(
'barcode', aliasedName, false,
additionalChecks: GeneratedColumn.checkTextLength(maxTextLength: 20),
type: DriftSqlType.string,
requiredDuringInsert: true);
@override
List<GeneratedColumn> get $columns => [
id,
name,
category,
storage,
quantity,
unit,
purchaseDate,
expiryDate,
barcode
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'product';
@override
VerificationContext validateIntegrity(Insertable<ProductData> 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('category')) {
context.handle(_categoryMeta,
category.isAcceptableOrUnknown(data['category']!, _categoryMeta));
} else if (isInserting) {
context.missing(_categoryMeta);
}
if (data.containsKey('storage')) {
context.handle(_storageMeta,
storage.isAcceptableOrUnknown(data['storage']!, _storageMeta));
} else if (isInserting) {
context.missing(_storageMeta);
}
if (data.containsKey('quantity')) {
context.handle(_quantityMeta,
quantity.isAcceptableOrUnknown(data['quantity']!, _quantityMeta));
} else if (isInserting) {
context.missing(_quantityMeta);
}
if (data.containsKey('unit')) {
context.handle(
_unitMeta, unit.isAcceptableOrUnknown(data['unit']!, _unitMeta));
} else if (isInserting) {
context.missing(_unitMeta);
}
if (data.containsKey('purchase_date')) {
context.handle(
_purchaseDateMeta,
purchaseDate.isAcceptableOrUnknown(
data['purchase_date']!, _purchaseDateMeta));
}
if (data.containsKey('expiry_date')) {
context.handle(
_expiryDateMeta,
expiryDate.isAcceptableOrUnknown(
data['expiry_date']!, _expiryDateMeta));
}
if (data.containsKey('barcode')) {
context.handle(_barcodeMeta,
barcode.isAcceptableOrUnknown(data['barcode']!, _barcodeMeta));
} else if (isInserting) {
context.missing(_barcodeMeta);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
ProductData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return ProductData(
id: attachedDatabase.typeMapping
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
name: attachedDatabase.typeMapping
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
category: attachedDatabase.typeMapping
.read(DriftSqlType.int, data['${effectivePrefix}category'])!,
storage: attachedDatabase.typeMapping
.read(DriftSqlType.int, data['${effectivePrefix}storage'])!,
quantity: attachedDatabase.typeMapping
.read(DriftSqlType.double, data['${effectivePrefix}quantity'])!,
unit: attachedDatabase.typeMapping
.read(DriftSqlType.string, data['${effectivePrefix}unit'])!,
purchaseDate: attachedDatabase.typeMapping
.read(DriftSqlType.dateTime, data['${effectivePrefix}purchase_date']),
expiryDate: attachedDatabase.typeMapping
.read(DriftSqlType.dateTime, data['${effectivePrefix}expiry_date']),
barcode: attachedDatabase.typeMapping
.read(DriftSqlType.string, data['${effectivePrefix}barcode'])!,
);
}
@override
$ProductTable createAlias(String alias) {
return $ProductTable(attachedDatabase, alias);
}
}
class ProductData extends DataClass implements Insertable<ProductData> {
final int id;
final String name;
final int category;
final int storage;
final double quantity;
final String unit;
final DateTime? purchaseDate;
final DateTime? expiryDate;
final String barcode;
const ProductData(
{required this.id,
required this.name,
required this.category,
required this.storage,
required this.quantity,
required this.unit,
this.purchaseDate,
this.expiryDate,
required this.barcode});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<int>(id);
map['name'] = Variable<String>(name);
map['category'] = Variable<int>(category);
map['storage'] = Variable<int>(storage);
map['quantity'] = Variable<double>(quantity);
map['unit'] = Variable<String>(unit);
if (!nullToAbsent || purchaseDate != null) {
map['purchase_date'] = Variable<DateTime>(purchaseDate);
}
if (!nullToAbsent || expiryDate != null) {
map['expiry_date'] = Variable<DateTime>(expiryDate);
}
map['barcode'] = Variable<String>(barcode);
return map;
}
ProductCompanion toCompanion(bool nullToAbsent) {
return ProductCompanion(
id: Value(id),
name: Value(name),
category: Value(category),
storage: Value(storage),
quantity: Value(quantity),
unit: Value(unit),
purchaseDate: purchaseDate == null && nullToAbsent
? const Value.absent()
: Value(purchaseDate),
expiryDate: expiryDate == null && nullToAbsent
? const Value.absent()
: Value(expiryDate),
barcode: Value(barcode),
);
}
factory ProductData.fromJson(Map<String, dynamic> json,
{ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return ProductData(
id: serializer.fromJson<int>(json['id']),
name: serializer.fromJson<String>(json['name']),
category: serializer.fromJson<int>(json['category']),
storage: serializer.fromJson<int>(json['storage']),
quantity: serializer.fromJson<double>(json['quantity']),
unit: serializer.fromJson<String>(json['unit']),
purchaseDate: serializer.fromJson<DateTime?>(json['purchaseDate']),
expiryDate: serializer.fromJson<DateTime?>(json['expiryDate']),
barcode: serializer.fromJson<String>(json['barcode']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<int>(id),
'name': serializer.toJson<String>(name),
'category': serializer.toJson<int>(category),
'storage': serializer.toJson<int>(storage),
'quantity': serializer.toJson<double>(quantity),
'unit': serializer.toJson<String>(unit),
'purchaseDate': serializer.toJson<DateTime?>(purchaseDate),
'expiryDate': serializer.toJson<DateTime?>(expiryDate),
'barcode': serializer.toJson<String>(barcode),
};
}
ProductData copyWith(
{int? id,
String? name,
int? category,
int? storage,
double? quantity,
String? unit,
Value<DateTime?> purchaseDate = const Value.absent(),
Value<DateTime?> expiryDate = const Value.absent(),
String? barcode}) =>
ProductData(
id: id ?? this.id,
name: name ?? this.name,
category: category ?? this.category,
storage: storage ?? this.storage,
quantity: quantity ?? this.quantity,
unit: unit ?? this.unit,
purchaseDate:
purchaseDate.present ? purchaseDate.value : this.purchaseDate,
expiryDate: expiryDate.present ? expiryDate.value : this.expiryDate,
barcode: barcode ?? this.barcode,
);
ProductData copyWithCompanion(ProductCompanion data) {
return ProductData(
id: data.id.present ? data.id.value : this.id,
name: data.name.present ? data.name.value : this.name,
category: data.category.present ? data.category.value : this.category,
storage: data.storage.present ? data.storage.value : this.storage,
quantity: data.quantity.present ? data.quantity.value : this.quantity,
unit: data.unit.present ? data.unit.value : this.unit,
purchaseDate: data.purchaseDate.present
? data.purchaseDate.value
: this.purchaseDate,
expiryDate:
data.expiryDate.present ? data.expiryDate.value : this.expiryDate,
barcode: data.barcode.present ? data.barcode.value : this.barcode,
);
}
@override
String toString() {
return (StringBuffer('ProductData(')
..write('id: $id, ')
..write('name: $name, ')
..write('category: $category, ')
..write('storage: $storage, ')
..write('quantity: $quantity, ')
..write('unit: $unit, ')
..write('purchaseDate: $purchaseDate, ')
..write('expiryDate: $expiryDate, ')
..write('barcode: $barcode')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(id, name, category, storage, quantity, unit,
purchaseDate, expiryDate, barcode);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is ProductData &&
other.id == this.id &&
other.name == this.name &&
other.category == this.category &&
other.storage == this.storage &&
other.quantity == this.quantity &&
other.unit == this.unit &&
other.purchaseDate == this.purchaseDate &&
other.expiryDate == this.expiryDate &&
other.barcode == this.barcode);
}
class ProductCompanion extends UpdateCompanion<ProductData> {
final Value<int> id;
final Value<String> name;
final Value<int> category;
final Value<int> storage;
final Value<double> quantity;
final Value<String> unit;
final Value<DateTime?> purchaseDate;
final Value<DateTime?> expiryDate;
final Value<String> barcode;
const ProductCompanion({
this.id = const Value.absent(),
this.name = const Value.absent(),
this.category = const Value.absent(),
this.storage = const Value.absent(),
this.quantity = const Value.absent(),
this.unit = const Value.absent(),
this.purchaseDate = const Value.absent(),
this.expiryDate = const Value.absent(),
this.barcode = const Value.absent(),
});
ProductCompanion.insert({
this.id = const Value.absent(),
required String name,
required int category,
required int storage,
required double quantity,
required String unit,
this.purchaseDate = const Value.absent(),
this.expiryDate = const Value.absent(),
required String barcode,
}) : name = Value(name),
category = Value(category),
storage = Value(storage),
quantity = Value(quantity),
unit = Value(unit),
barcode = Value(barcode);
static Insertable<ProductData> custom({
Expression<int>? id,
Expression<String>? name,
Expression<int>? category,
Expression<int>? storage,
Expression<double>? quantity,
Expression<String>? unit,
Expression<DateTime>? purchaseDate,
Expression<DateTime>? expiryDate,
Expression<String>? barcode,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (name != null) 'name': name,
if (category != null) 'category': category,
if (storage != null) 'storage': storage,
if (quantity != null) 'quantity': quantity,
if (unit != null) 'unit': unit,
if (purchaseDate != null) 'purchase_date': purchaseDate,
if (expiryDate != null) 'expiry_date': expiryDate,
if (barcode != null) 'barcode': barcode,
});
}
ProductCompanion copyWith(
{Value<int>? id,
Value<String>? name,
Value<int>? category,
Value<int>? storage,
Value<double>? quantity,
Value<String>? unit,
Value<DateTime?>? purchaseDate,
Value<DateTime?>? expiryDate,
Value<String>? barcode}) {
return ProductCompanion(
id: id ?? this.id,
name: name ?? this.name,
category: category ?? this.category,
storage: storage ?? this.storage,
quantity: quantity ?? this.quantity,
unit: unit ?? this.unit,
purchaseDate: purchaseDate ?? this.purchaseDate,
expiryDate: expiryDate ?? this.expiryDate,
barcode: barcode ?? this.barcode,
);
}
@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 (category.present) {
map['category'] = Variable<int>(category.value);
}
if (storage.present) {
map['storage'] = Variable<int>(storage.value);
}
if (quantity.present) {
map['quantity'] = Variable<double>(quantity.value);
}
if (unit.present) {
map['unit'] = Variable<String>(unit.value);
}
if (purchaseDate.present) {
map['purchase_date'] = Variable<DateTime>(purchaseDate.value);
}
if (expiryDate.present) {
map['expiry_date'] = Variable<DateTime>(expiryDate.value);
}
if (barcode.present) {
map['barcode'] = Variable<String>(barcode.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('ProductCompanion(')
..write('id: $id, ')
..write('name: $name, ')
..write('category: $category, ')
..write('storage: $storage, ')
..write('quantity: $quantity, ')
..write('unit: $unit, ')
..write('purchaseDate: $purchaseDate, ')
..write('expiryDate: $expiryDate, ')
..write('barcode: $barcode')
..write(')'))
.toString();
}
}
class $ShoppingListItemTable extends ShoppingListItem
with TableInfo<$ShoppingListItemTable, ShoppingListItemData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$ShoppingListItemTable(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 _categoryMeta =
const VerificationMeta('category');
@override
late final GeneratedColumn<int> category = GeneratedColumn<int>(
'category', aliasedName, false,
type: DriftSqlType.int,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES product_category (id)'));
static const VerificationMeta _storageMeta =
const VerificationMeta('storage');
@override
late final GeneratedColumn<int> storage = GeneratedColumn<int>(
'storage', aliasedName, false,
type: DriftSqlType.int,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES storage_location (id)'));
static const VerificationMeta _quantityMeta =
const VerificationMeta('quantity');
@override
late final GeneratedColumn<double> quantity = GeneratedColumn<double>(
'quantity', aliasedName, false,
type: DriftSqlType.double, requiredDuringInsert: true);
static const VerificationMeta _unitMeta = const VerificationMeta('unit');
@override
late final GeneratedColumn<String> unit = GeneratedColumn<String>(
'unit', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
static const VerificationMeta _isPurchasedMeta =
const VerificationMeta('isPurchased');
@override
late final GeneratedColumn<bool> isPurchased = GeneratedColumn<bool>(
'is_purchased', aliasedName, false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'CHECK ("is_purchased" IN (0, 1))'),
defaultValue: const Constant(false));
static const VerificationMeta _dateAddedMeta =
const VerificationMeta('dateAdded');
@override
late final GeneratedColumn<DateTime> dateAdded = GeneratedColumn<DateTime>(
'date_added', aliasedName, true,
type: DriftSqlType.dateTime,
requiredDuringInsert: false,
defaultValue: currentDateAndTime);
@override
List<GeneratedColumn> get $columns =>
[id, name, category, storage, quantity, unit, isPurchased, dateAdded];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'shopping_list_item';
@override
VerificationContext validateIntegrity(
Insertable<ShoppingListItemData> 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('category')) {
context.handle(_categoryMeta,
category.isAcceptableOrUnknown(data['category']!, _categoryMeta));
} else if (isInserting) {
context.missing(_categoryMeta);
}
if (data.containsKey('storage')) {
context.handle(_storageMeta,
storage.isAcceptableOrUnknown(data['storage']!, _storageMeta));
} else if (isInserting) {
context.missing(_storageMeta);
}
if (data.containsKey('quantity')) {
context.handle(_quantityMeta,
quantity.isAcceptableOrUnknown(data['quantity']!, _quantityMeta));
} else if (isInserting) {
context.missing(_quantityMeta);
}
if (data.containsKey('unit')) {
context.handle(
_unitMeta, unit.isAcceptableOrUnknown(data['unit']!, _unitMeta));
} else if (isInserting) {
context.missing(_unitMeta);
}
if (data.containsKey('is_purchased')) {
context.handle(
_isPurchasedMeta,
isPurchased.isAcceptableOrUnknown(
data['is_purchased']!, _isPurchasedMeta));
}
if (data.containsKey('date_added')) {
context.handle(_dateAddedMeta,
dateAdded.isAcceptableOrUnknown(data['date_added']!, _dateAddedMeta));
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
ShoppingListItemData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return ShoppingListItemData(
id: attachedDatabase.typeMapping
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
name: attachedDatabase.typeMapping
.read(DriftSqlType.string, data['${effectivePrefix}name'])!,
category: attachedDatabase.typeMapping
.read(DriftSqlType.int, data['${effectivePrefix}category'])!,
storage: attachedDatabase.typeMapping
.read(DriftSqlType.int, data['${effectivePrefix}storage'])!,
quantity: attachedDatabase.typeMapping
.read(DriftSqlType.double, data['${effectivePrefix}quantity'])!,
unit: attachedDatabase.typeMapping
.read(DriftSqlType.string, data['${effectivePrefix}unit'])!,
isPurchased: attachedDatabase.typeMapping
.read(DriftSqlType.bool, data['${effectivePrefix}is_purchased'])!,
dateAdded: attachedDatabase.typeMapping
.read(DriftSqlType.dateTime, data['${effectivePrefix}date_added']),
);
}
@override
$ShoppingListItemTable createAlias(String alias) {
return $ShoppingListItemTable(attachedDatabase, alias);
}
}
class ShoppingListItemData extends DataClass
implements Insertable<ShoppingListItemData> {
final int id;
final String name;
final int category;
final int storage;
final double quantity;
final String unit;
final bool isPurchased;
final DateTime? dateAdded;
const ShoppingListItemData(
{required this.id,
required this.name,
required this.category,
required this.storage,
required this.quantity,
required this.unit,
required this.isPurchased,
this.dateAdded});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<int>(id);
map['name'] = Variable<String>(name);
map['category'] = Variable<int>(category);
map['storage'] = Variable<int>(storage);
map['quantity'] = Variable<double>(quantity);
map['unit'] = Variable<String>(unit);
map['is_purchased'] = Variable<bool>(isPurchased);
if (!nullToAbsent || dateAdded != null) {
map['date_added'] = Variable<DateTime>(dateAdded);
}
return map;
}
ShoppingListItemCompanion toCompanion(bool nullToAbsent) {
return ShoppingListItemCompanion(
id: Value(id),
name: Value(name),
category: Value(category),
storage: Value(storage),
quantity: Value(quantity),
unit: Value(unit),
isPurchased: Value(isPurchased),
dateAdded: dateAdded == null && nullToAbsent
? const Value.absent()
: Value(dateAdded),
);
}
factory ShoppingListItemData.fromJson(Map<String, dynamic> json,
{ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return ShoppingListItemData(
id: serializer.fromJson<int>(json['id']),
name: serializer.fromJson<String>(json['name']),
category: serializer.fromJson<int>(json['category']),
storage: serializer.fromJson<int>(json['storage']),
quantity: serializer.fromJson<double>(json['quantity']),
unit: serializer.fromJson<String>(json['unit']),
isPurchased: serializer.fromJson<bool>(json['isPurchased']),
dateAdded: serializer.fromJson<DateTime?>(json['dateAdded']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<int>(id),
'name': serializer.toJson<String>(name),
'category': serializer.toJson<int>(category),
'storage': serializer.toJson<int>(storage),
'quantity': serializer.toJson<double>(quantity),
'unit': serializer.toJson<String>(unit),
'isPurchased': serializer.toJson<bool>(isPurchased),
'dateAdded': serializer.toJson<DateTime?>(dateAdded),
};
}
ShoppingListItemData copyWith(
{int? id,
String? name,
int? category,
int? storage,
double? quantity,
String? unit,
bool? isPurchased,
Value<DateTime?> dateAdded = const Value.absent()}) =>
ShoppingListItemData(
id: id ?? this.id,
name: name ?? this.name,
category: category ?? this.category,
storage: storage ?? this.storage,
quantity: quantity ?? this.quantity,
unit: unit ?? this.unit,
isPurchased: isPurchased ?? this.isPurchased,
dateAdded: dateAdded.present ? dateAdded.value : this.dateAdded,
);
ShoppingListItemData copyWithCompanion(ShoppingListItemCompanion data) {
return ShoppingListItemData(
id: data.id.present ? data.id.value : this.id,
name: data.name.present ? data.name.value : this.name,
category: data.category.present ? data.category.value : this.category,
storage: data.storage.present ? data.storage.value : this.storage,
quantity: data.quantity.present ? data.quantity.value : this.quantity,
unit: data.unit.present ? data.unit.value : this.unit,
isPurchased:
data.isPurchased.present ? data.isPurchased.value : this.isPurchased,
dateAdded: data.dateAdded.present ? data.dateAdded.value : this.dateAdded,
);
}
@override
String toString() {
return (StringBuffer('ShoppingListItemData(')
..write('id: $id, ')
..write('name: $name, ')
..write('category: $category, ')
..write('storage: $storage, ')
..write('quantity: $quantity, ')
..write('unit: $unit, ')
..write('isPurchased: $isPurchased, ')
..write('dateAdded: $dateAdded')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id, name, category, storage, quantity, unit, isPurchased, dateAdded);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is ShoppingListItemData &&
other.id == this.id &&
other.name == this.name &&
other.category == this.category &&
other.storage == this.storage &&
other.quantity == this.quantity &&
other.unit == this.unit &&
other.isPurchased == this.isPurchased &&
other.dateAdded == this.dateAdded);
}
class ShoppingListItemCompanion extends UpdateCompanion<ShoppingListItemData> {
final Value<int> id;
final Value<String> name;
final Value<int> category;
final Value<int> storage;
final Value<double> quantity;
final Value<String> unit;
final Value<bool> isPurchased;
final Value<DateTime?> dateAdded;
const ShoppingListItemCompanion({
this.id = const Value.absent(),
this.name = const Value.absent(),
this.category = const Value.absent(),
this.storage = const Value.absent(),
this.quantity = const Value.absent(),
this.unit = const Value.absent(),
this.isPurchased = const Value.absent(),
this.dateAdded = const Value.absent(),
});
ShoppingListItemCompanion.insert({
this.id = const Value.absent(),
required String name,
required int category,
required int storage,
required double quantity,
required String unit,
this.isPurchased = const Value.absent(),
this.dateAdded = const Value.absent(),
}) : name = Value(name),
category = Value(category),
storage = Value(storage),
quantity = Value(quantity),
unit = Value(unit);
static Insertable<ShoppingListItemData> custom({
Expression<int>? id,
Expression<String>? name,
Expression<int>? category,
Expression<int>? storage,
Expression<double>? quantity,
Expression<String>? unit,
Expression<bool>? isPurchased,
Expression<DateTime>? dateAdded,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (name != null) 'name': name,
if (category != null) 'category': category,
if (storage != null) 'storage': storage,
if (quantity != null) 'quantity': quantity,
if (unit != null) 'unit': unit,
if (isPurchased != null) 'is_purchased': isPurchased,
if (dateAdded != null) 'date_added': dateAdded,
});
}
ShoppingListItemCompanion copyWith(
{Value<int>? id,
Value<String>? name,
Value<int>? category,
Value<int>? storage,
Value<double>? quantity,
Value<String>? unit,
Value<bool>? isPurchased,
Value<DateTime?>? dateAdded}) {
return ShoppingListItemCompanion(
id: id ?? this.id,
name: name ?? this.name,
category: category ?? this.category,
storage: storage ?? this.storage,
quantity: quantity ?? this.quantity,
unit: unit ?? this.unit,
isPurchased: isPurchased ?? this.isPurchased,
dateAdded: dateAdded ?? this.dateAdded,
);
}
@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 (category.present) {
map['category'] = Variable<int>(category.value);
}
if (storage.present) {
map['storage'] = Variable<int>(storage.value);
}
if (quantity.present) {
map['quantity'] = Variable<double>(quantity.value);
}
if (unit.present) {
map['unit'] = Variable<String>(unit.value);
}
if (isPurchased.present) {
map['is_purchased'] = Variable<bool>(isPurchased.value);
}
if (dateAdded.present) {
map['date_added'] = Variable<DateTime>(dateAdded.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('ShoppingListItemCompanion(')
..write('id: $id, ')
..write('name: $name, ')
..write('category: $category, ')
..write('storage: $storage, ')
..write('quantity: $quantity, ')
..write('unit: $unit, ')
..write('isPurchased: $isPurchased, ')
..write('dateAdded: $dateAdded')
..write(')'))
.toString();
}
}
class $UserTable extends User with TableInfo<$UserTable, UserData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$UserTable(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 _loginMeta = const VerificationMeta('login');
@override
late final GeneratedColumn<String> login = GeneratedColumn<String>(
'login', aliasedName, false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'));
static const VerificationMeta _passwordMeta =
const VerificationMeta('password');
@override
late final GeneratedColumn<String> password = GeneratedColumn<String>(
'password', aliasedName, false,
type: DriftSqlType.string, requiredDuringInsert: true);
@override
List<GeneratedColumn> get $columns => [id, login, password];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'user';
@override
VerificationContext validateIntegrity(Insertable<UserData> 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('login')) {
context.handle(
_loginMeta, login.isAcceptableOrUnknown(data['login']!, _loginMeta));
} else if (isInserting) {
context.missing(_loginMeta);
}
if (data.containsKey('password')) {
context.handle(_passwordMeta,
password.isAcceptableOrUnknown(data['password']!, _passwordMeta));
} else if (isInserting) {
context.missing(_passwordMeta);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
UserData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return UserData(
id: attachedDatabase.typeMapping
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
login: attachedDatabase.typeMapping
.read(DriftSqlType.string, data['${effectivePrefix}login'])!,
password: attachedDatabase.typeMapping
.read(DriftSqlType.string, data['${effectivePrefix}password'])!,
);
}
@override
$UserTable createAlias(String alias) {
return $UserTable(attachedDatabase, alias);
}
}
class UserData extends DataClass implements Insertable<UserData> {
final int id;
final String login;
final String password;
const UserData(
{required this.id, required this.login, required this.password});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<int>(id);
map['login'] = Variable<String>(login);
map['password'] = Variable<String>(password);
return map;
}
UserCompanion toCompanion(bool nullToAbsent) {
return UserCompanion(
id: Value(id),
login: Value(login),
password: Value(password),
);
}
factory UserData.fromJson(Map<String, dynamic> json,
{ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return UserData(
id: serializer.fromJson<int>(json['id']),
login: serializer.fromJson<String>(json['login']),
password: serializer.fromJson<String>(json['password']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<int>(id),
'login': serializer.toJson<String>(login),
'password': serializer.toJson<String>(password),
};
}
UserData copyWith({int? id, String? login, String? password}) => UserData(
id: id ?? this.id,
login: login ?? this.login,
password: password ?? this.password,
);
UserData copyWithCompanion(UserCompanion data) {
return UserData(
id: data.id.present ? data.id.value : this.id,
login: data.login.present ? data.login.value : this.login,
password: data.password.present ? data.password.value : this.password,
);
}
@override
String toString() {
return (StringBuffer('UserData(')
..write('id: $id, ')
..write('login: $login, ')
..write('password: $password')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(id, login, password);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is UserData &&
other.id == this.id &&
other.login == this.login &&
other.password == this.password);
}
class UserCompanion extends UpdateCompanion<UserData> {
final Value<int> id;
final Value<String> login;
final Value<String> password;
const UserCompanion({
this.id = const Value.absent(),
this.login = const Value.absent(),
this.password = const Value.absent(),
});
UserCompanion.insert({
this.id = const Value.absent(),
required String login,
required String password,
}) : login = Value(login),
password = Value(password);
static Insertable<UserData> custom({
Expression<int>? id,
Expression<String>? login,
Expression<String>? password,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (login != null) 'login': login,
if (password != null) 'password': password,
});
}
UserCompanion copyWith(
{Value<int>? id, Value<String>? login, Value<String>? password}) {
return UserCompanion(
id: id ?? this.id,
login: login ?? this.login,
password: password ?? this.password,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<int>(id.value);
}
if (login.present) {
map['login'] = Variable<String>(login.value);
}
if (password.present) {
map['password'] = Variable<String>(password.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('UserCompanion(')
..write('id: $id, ')
..write('login: $login, ')
..write('password: $password')
..write(')'))
.toString();
}
}
abstract class _$AppDatabase extends GeneratedDatabase {
_$AppDatabase(QueryExecutor e) : super(e);
$AppDatabaseManager get managers => $AppDatabaseManager(this);
late final $ProductCategoryTable productCategory =
$ProductCategoryTable(this);
late final $StorageLocationTable storageLocation =
$StorageLocationTable(this);
late final $ProductTable product = $ProductTable(this);
late final $ShoppingListItemTable shoppingListItem =
$ShoppingListItemTable(this);
late final $UserTable user = $UserTable(this);
@override
Iterable<TableInfo<Table, Object?>> get allTables =>
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
@override
List<DatabaseSchemaEntity> get allSchemaEntities =>
[productCategory, storageLocation, product, shoppingListItem, user];
}
typedef $$ProductCategoryTableCreateCompanionBuilder = ProductCategoryCompanion
Function({
Value<int> id,
required String name,
required String icon,
});
typedef $$ProductCategoryTableUpdateCompanionBuilder = ProductCategoryCompanion
Function({
Value<int> id,
Value<String> name,
Value<String> icon,
});
final class $$ProductCategoryTableReferences extends BaseReferences<
_$AppDatabase, $ProductCategoryTable, ProductCategoryData> {
$$ProductCategoryTableReferences(
super.$_db, super.$_table, super.$_typedResult);
static MultiTypedResultKey<$ProductTable, List<ProductData>>
_productRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.product,
aliasName:
$_aliasNameGenerator(db.productCategory.id, db.product.category));
$$ProductTableProcessedTableManager get productRefs {
final manager = $$ProductTableTableManager($_db, $_db.product)
.filter((f) => f.category.id($_item.id));
final cache = $_typedResult.readTableOrNull(_productRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache));
}
static MultiTypedResultKey<$ShoppingListItemTable, List<ShoppingListItemData>>
_shoppingListItemRefsTable(_$AppDatabase db) =>
MultiTypedResultKey.fromTable(db.shoppingListItem,
aliasName: $_aliasNameGenerator(
db.productCategory.id, db.shoppingListItem.category));
$$ShoppingListItemTableProcessedTableManager get shoppingListItemRefs {
final manager =
$$ShoppingListItemTableTableManager($_db, $_db.shoppingListItem)
.filter((f) => f.category.id($_item.id));
final cache =
$_typedResult.readTableOrNull(_shoppingListItemRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache));
}
}
class $$ProductCategoryTableFilterComposer
extends Composer<_$AppDatabase, $ProductCategoryTable> {
$$ProductCategoryTableFilterComposer({
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 icon => $composableBuilder(
column: $table.icon, builder: (column) => ColumnFilters(column));
Expression<bool> productRefs(
Expression<bool> Function($$ProductTableFilterComposer f) f) {
final $$ProductTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.product,
getReferencedColumn: (t) => t.category,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ProductTableFilterComposer(
$db: $db,
$table: $db.product,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return f(composer);
}
Expression<bool> shoppingListItemRefs(
Expression<bool> Function($$ShoppingListItemTableFilterComposer f) f) {
final $$ShoppingListItemTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.shoppingListItem,
getReferencedColumn: (t) => t.category,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ShoppingListItemTableFilterComposer(
$db: $db,
$table: $db.shoppingListItem,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return f(composer);
}
}
class $$ProductCategoryTableOrderingComposer
extends Composer<_$AppDatabase, $ProductCategoryTable> {
$$ProductCategoryTableOrderingComposer({
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 icon => $composableBuilder(
column: $table.icon, builder: (column) => ColumnOrderings(column));
}
class $$ProductCategoryTableAnnotationComposer
extends Composer<_$AppDatabase, $ProductCategoryTable> {
$$ProductCategoryTableAnnotationComposer({
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 icon =>
$composableBuilder(column: $table.icon, builder: (column) => column);
Expression<T> productRefs<T extends Object>(
Expression<T> Function($$ProductTableAnnotationComposer a) f) {
final $$ProductTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.product,
getReferencedColumn: (t) => t.category,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ProductTableAnnotationComposer(
$db: $db,
$table: $db.product,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return f(composer);
}
Expression<T> shoppingListItemRefs<T extends Object>(
Expression<T> Function($$ShoppingListItemTableAnnotationComposer a) f) {
final $$ShoppingListItemTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.shoppingListItem,
getReferencedColumn: (t) => t.category,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ShoppingListItemTableAnnotationComposer(
$db: $db,
$table: $db.shoppingListItem,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return f(composer);
}
}
class $$ProductCategoryTableTableManager extends RootTableManager<
_$AppDatabase,
$ProductCategoryTable,
ProductCategoryData,
$$ProductCategoryTableFilterComposer,
$$ProductCategoryTableOrderingComposer,
$$ProductCategoryTableAnnotationComposer,
$$ProductCategoryTableCreateCompanionBuilder,
$$ProductCategoryTableUpdateCompanionBuilder,
(ProductCategoryData, $$ProductCategoryTableReferences),
ProductCategoryData,
PrefetchHooks Function({bool productRefs, bool shoppingListItemRefs})> {
$$ProductCategoryTableTableManager(
_$AppDatabase db, $ProductCategoryTable table)
: super(TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$ProductCategoryTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$ProductCategoryTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$ProductCategoryTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback: ({
Value<int> id = const Value.absent(),
Value<String> name = const Value.absent(),
Value<String> icon = const Value.absent(),
}) =>
ProductCategoryCompanion(
id: id,
name: name,
icon: icon,
),
createCompanionCallback: ({
Value<int> id = const Value.absent(),
required String name,
required String icon,
}) =>
ProductCategoryCompanion.insert(
id: id,
name: name,
icon: icon,
),
withReferenceMapper: (p0) => p0
.map((e) => (
e.readTable(table),
$$ProductCategoryTableReferences(db, table, e)
))
.toList(),
prefetchHooksCallback: (
{productRefs = false, shoppingListItemRefs = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [
if (productRefs) db.product,
if (shoppingListItemRefs) db.shoppingListItem
],
addJoins: null,
getPrefetchedDataCallback: (items) async {
return [
if (productRefs)
await $_getPrefetchedData(
currentTable: table,
referencedTable: $$ProductCategoryTableReferences
._productRefsTable(db),
managerFromTypedResult: (p0) =>
$$ProductCategoryTableReferences(db, table, p0)
.productRefs,
referencedItemsForCurrentItem: (item,
referencedItems) =>
referencedItems.where((e) => e.category == item.id),
typedResults: items),
if (shoppingListItemRefs)
await $_getPrefetchedData(
currentTable: table,
referencedTable: $$ProductCategoryTableReferences
._shoppingListItemRefsTable(db),
managerFromTypedResult: (p0) =>
$$ProductCategoryTableReferences(db, table, p0)
.shoppingListItemRefs,
referencedItemsForCurrentItem: (item,
referencedItems) =>
referencedItems.where((e) => e.category == item.id),
typedResults: items)
];
},
);
},
));
}
typedef $$ProductCategoryTableProcessedTableManager = ProcessedTableManager<
_$AppDatabase,
$ProductCategoryTable,
ProductCategoryData,
$$ProductCategoryTableFilterComposer,
$$ProductCategoryTableOrderingComposer,
$$ProductCategoryTableAnnotationComposer,
$$ProductCategoryTableCreateCompanionBuilder,
$$ProductCategoryTableUpdateCompanionBuilder,
(ProductCategoryData, $$ProductCategoryTableReferences),
ProductCategoryData,
PrefetchHooks Function({bool productRefs, bool shoppingListItemRefs})>;
typedef $$StorageLocationTableCreateCompanionBuilder = StorageLocationCompanion
Function({
Value<int> id,
required String name,
required String description,
required String temperatureMode,
required String icon,
Value<bool> isDefault,
});
typedef $$StorageLocationTableUpdateCompanionBuilder = StorageLocationCompanion
Function({
Value<int> id,
Value<String> name,
Value<String> description,
Value<String> temperatureMode,
Value<String> icon,
Value<bool> isDefault,
});
final class $$StorageLocationTableReferences extends BaseReferences<
_$AppDatabase, $StorageLocationTable, StorageLocationData> {
$$StorageLocationTableReferences(
super.$_db, super.$_table, super.$_typedResult);
static MultiTypedResultKey<$ProductTable, List<ProductData>>
_productRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.product,
aliasName:
$_aliasNameGenerator(db.storageLocation.id, db.product.storage));
$$ProductTableProcessedTableManager get productRefs {
final manager = $$ProductTableTableManager($_db, $_db.product)
.filter((f) => f.storage.id($_item.id));
final cache = $_typedResult.readTableOrNull(_productRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache));
}
static MultiTypedResultKey<$ShoppingListItemTable, List<ShoppingListItemData>>
_shoppingListItemRefsTable(_$AppDatabase db) =>
MultiTypedResultKey.fromTable(db.shoppingListItem,
aliasName: $_aliasNameGenerator(
db.storageLocation.id, db.shoppingListItem.storage));
$$ShoppingListItemTableProcessedTableManager get shoppingListItemRefs {
final manager =
$$ShoppingListItemTableTableManager($_db, $_db.shoppingListItem)
.filter((f) => f.storage.id($_item.id));
final cache =
$_typedResult.readTableOrNull(_shoppingListItemRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache));
}
}
class $$StorageLocationTableFilterComposer
extends Composer<_$AppDatabase, $StorageLocationTable> {
$$StorageLocationTableFilterComposer({
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 description => $composableBuilder(
column: $table.description, builder: (column) => ColumnFilters(column));
ColumnFilters<String> get temperatureMode => $composableBuilder(
column: $table.temperatureMode,
builder: (column) => ColumnFilters(column));
ColumnFilters<String> get icon => $composableBuilder(
column: $table.icon, builder: (column) => ColumnFilters(column));
ColumnFilters<bool> get isDefault => $composableBuilder(
column: $table.isDefault, builder: (column) => ColumnFilters(column));
Expression<bool> productRefs(
Expression<bool> Function($$ProductTableFilterComposer f) f) {
final $$ProductTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.product,
getReferencedColumn: (t) => t.storage,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ProductTableFilterComposer(
$db: $db,
$table: $db.product,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return f(composer);
}
Expression<bool> shoppingListItemRefs(
Expression<bool> Function($$ShoppingListItemTableFilterComposer f) f) {
final $$ShoppingListItemTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.shoppingListItem,
getReferencedColumn: (t) => t.storage,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ShoppingListItemTableFilterComposer(
$db: $db,
$table: $db.shoppingListItem,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return f(composer);
}
}
class $$StorageLocationTableOrderingComposer
extends Composer<_$AppDatabase, $StorageLocationTable> {
$$StorageLocationTableOrderingComposer({
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 description => $composableBuilder(
column: $table.description, builder: (column) => ColumnOrderings(column));
ColumnOrderings<String> get temperatureMode => $composableBuilder(
column: $table.temperatureMode,
builder: (column) => ColumnOrderings(column));
ColumnOrderings<String> get icon => $composableBuilder(
column: $table.icon, builder: (column) => ColumnOrderings(column));
ColumnOrderings<bool> get isDefault => $composableBuilder(
column: $table.isDefault, builder: (column) => ColumnOrderings(column));
}
class $$StorageLocationTableAnnotationComposer
extends Composer<_$AppDatabase, $StorageLocationTable> {
$$StorageLocationTableAnnotationComposer({
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 description => $composableBuilder(
column: $table.description, builder: (column) => column);
GeneratedColumn<String> get temperatureMode => $composableBuilder(
column: $table.temperatureMode, builder: (column) => column);
GeneratedColumn<String> get icon =>
$composableBuilder(column: $table.icon, builder: (column) => column);
GeneratedColumn<bool> get isDefault =>
$composableBuilder(column: $table.isDefault, builder: (column) => column);
Expression<T> productRefs<T extends Object>(
Expression<T> Function($$ProductTableAnnotationComposer a) f) {
final $$ProductTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.product,
getReferencedColumn: (t) => t.storage,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ProductTableAnnotationComposer(
$db: $db,
$table: $db.product,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return f(composer);
}
Expression<T> shoppingListItemRefs<T extends Object>(
Expression<T> Function($$ShoppingListItemTableAnnotationComposer a) f) {
final $$ShoppingListItemTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.shoppingListItem,
getReferencedColumn: (t) => t.storage,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ShoppingListItemTableAnnotationComposer(
$db: $db,
$table: $db.shoppingListItem,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return f(composer);
}
}
class $$StorageLocationTableTableManager extends RootTableManager<
_$AppDatabase,
$StorageLocationTable,
StorageLocationData,
$$StorageLocationTableFilterComposer,
$$StorageLocationTableOrderingComposer,
$$StorageLocationTableAnnotationComposer,
$$StorageLocationTableCreateCompanionBuilder,
$$StorageLocationTableUpdateCompanionBuilder,
(StorageLocationData, $$StorageLocationTableReferences),
StorageLocationData,
PrefetchHooks Function({bool productRefs, bool shoppingListItemRefs})> {
$$StorageLocationTableTableManager(
_$AppDatabase db, $StorageLocationTable table)
: super(TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$StorageLocationTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$StorageLocationTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$StorageLocationTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback: ({
Value<int> id = const Value.absent(),
Value<String> name = const Value.absent(),
Value<String> description = const Value.absent(),
Value<String> temperatureMode = const Value.absent(),
Value<String> icon = const Value.absent(),
Value<bool> isDefault = const Value.absent(),
}) =>
StorageLocationCompanion(
id: id,
name: name,
description: description,
temperatureMode: temperatureMode,
icon: icon,
isDefault: isDefault,
),
createCompanionCallback: ({
Value<int> id = const Value.absent(),
required String name,
required String description,
required String temperatureMode,
required String icon,
Value<bool> isDefault = const Value.absent(),
}) =>
StorageLocationCompanion.insert(
id: id,
name: name,
description: description,
temperatureMode: temperatureMode,
icon: icon,
isDefault: isDefault,
),
withReferenceMapper: (p0) => p0
.map((e) => (
e.readTable(table),
$$StorageLocationTableReferences(db, table, e)
))
.toList(),
prefetchHooksCallback: (
{productRefs = false, shoppingListItemRefs = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [
if (productRefs) db.product,
if (shoppingListItemRefs) db.shoppingListItem
],
addJoins: null,
getPrefetchedDataCallback: (items) async {
return [
if (productRefs)
await $_getPrefetchedData(
currentTable: table,
referencedTable: $$StorageLocationTableReferences
._productRefsTable(db),
managerFromTypedResult: (p0) =>
$$StorageLocationTableReferences(db, table, p0)
.productRefs,
referencedItemsForCurrentItem: (item,
referencedItems) =>
referencedItems.where((e) => e.storage == item.id),
typedResults: items),
if (shoppingListItemRefs)
await $_getPrefetchedData(
currentTable: table,
referencedTable: $$StorageLocationTableReferences
._shoppingListItemRefsTable(db),
managerFromTypedResult: (p0) =>
$$StorageLocationTableReferences(db, table, p0)
.shoppingListItemRefs,
referencedItemsForCurrentItem: (item,
referencedItems) =>
referencedItems.where((e) => e.storage == item.id),
typedResults: items)
];
},
);
},
));
}
typedef $$StorageLocationTableProcessedTableManager = ProcessedTableManager<
_$AppDatabase,
$StorageLocationTable,
StorageLocationData,
$$StorageLocationTableFilterComposer,
$$StorageLocationTableOrderingComposer,
$$StorageLocationTableAnnotationComposer,
$$StorageLocationTableCreateCompanionBuilder,
$$StorageLocationTableUpdateCompanionBuilder,
(StorageLocationData, $$StorageLocationTableReferences),
StorageLocationData,
PrefetchHooks Function({bool productRefs, bool shoppingListItemRefs})>;
typedef $$ProductTableCreateCompanionBuilder = ProductCompanion Function({
Value<int> id,
required String name,
required int category,
required int storage,
required double quantity,
required String unit,
Value<DateTime?> purchaseDate,
Value<DateTime?> expiryDate,
required String barcode,
});
typedef $$ProductTableUpdateCompanionBuilder = ProductCompanion Function({
Value<int> id,
Value<String> name,
Value<int> category,
Value<int> storage,
Value<double> quantity,
Value<String> unit,
Value<DateTime?> purchaseDate,
Value<DateTime?> expiryDate,
Value<String> barcode,
});
final class $$ProductTableReferences
extends BaseReferences<_$AppDatabase, $ProductTable, ProductData> {
$$ProductTableReferences(super.$_db, super.$_table, super.$_typedResult);
static $ProductCategoryTable _categoryTable(_$AppDatabase db) =>
db.productCategory.createAlias(
$_aliasNameGenerator(db.product.category, db.productCategory.id));
$$ProductCategoryTableProcessedTableManager get category {
final manager =
$$ProductCategoryTableTableManager($_db, $_db.productCategory)
.filter((f) => f.id($_item.category!));
final item = $_typedResult.readTableOrNull(_categoryTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]));
}
static $StorageLocationTable _storageTable(_$AppDatabase db) =>
db.storageLocation.createAlias(
$_aliasNameGenerator(db.product.storage, db.storageLocation.id));
$$StorageLocationTableProcessedTableManager get storage {
final manager =
$$StorageLocationTableTableManager($_db, $_db.storageLocation)
.filter((f) => f.id($_item.storage!));
final item = $_typedResult.readTableOrNull(_storageTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]));
}
}
class $$ProductTableFilterComposer
extends Composer<_$AppDatabase, $ProductTable> {
$$ProductTableFilterComposer({
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 quantity => $composableBuilder(
column: $table.quantity, builder: (column) => ColumnFilters(column));
ColumnFilters<String> get unit => $composableBuilder(
column: $table.unit, builder: (column) => ColumnFilters(column));
ColumnFilters<DateTime> get purchaseDate => $composableBuilder(
column: $table.purchaseDate, builder: (column) => ColumnFilters(column));
ColumnFilters<DateTime> get expiryDate => $composableBuilder(
column: $table.expiryDate, builder: (column) => ColumnFilters(column));
ColumnFilters<String> get barcode => $composableBuilder(
column: $table.barcode, builder: (column) => ColumnFilters(column));
$$ProductCategoryTableFilterComposer get category {
final $$ProductCategoryTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.category,
referencedTable: $db.productCategory,
getReferencedColumn: (t) => t.id,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ProductCategoryTableFilterComposer(
$db: $db,
$table: $db.productCategory,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return composer;
}
$$StorageLocationTableFilterComposer get storage {
final $$StorageLocationTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.storage,
referencedTable: $db.storageLocation,
getReferencedColumn: (t) => t.id,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$StorageLocationTableFilterComposer(
$db: $db,
$table: $db.storageLocation,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return composer;
}
}
class $$ProductTableOrderingComposer
extends Composer<_$AppDatabase, $ProductTable> {
$$ProductTableOrderingComposer({
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 quantity => $composableBuilder(
column: $table.quantity, builder: (column) => ColumnOrderings(column));
ColumnOrderings<String> get unit => $composableBuilder(
column: $table.unit, builder: (column) => ColumnOrderings(column));
ColumnOrderings<DateTime> get purchaseDate => $composableBuilder(
column: $table.purchaseDate,
builder: (column) => ColumnOrderings(column));
ColumnOrderings<DateTime> get expiryDate => $composableBuilder(
column: $table.expiryDate, builder: (column) => ColumnOrderings(column));
ColumnOrderings<String> get barcode => $composableBuilder(
column: $table.barcode, builder: (column) => ColumnOrderings(column));
$$ProductCategoryTableOrderingComposer get category {
final $$ProductCategoryTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.category,
referencedTable: $db.productCategory,
getReferencedColumn: (t) => t.id,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ProductCategoryTableOrderingComposer(
$db: $db,
$table: $db.productCategory,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return composer;
}
$$StorageLocationTableOrderingComposer get storage {
final $$StorageLocationTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.storage,
referencedTable: $db.storageLocation,
getReferencedColumn: (t) => t.id,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$StorageLocationTableOrderingComposer(
$db: $db,
$table: $db.storageLocation,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return composer;
}
}
class $$ProductTableAnnotationComposer
extends Composer<_$AppDatabase, $ProductTable> {
$$ProductTableAnnotationComposer({
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 quantity =>
$composableBuilder(column: $table.quantity, builder: (column) => column);
GeneratedColumn<String> get unit =>
$composableBuilder(column: $table.unit, builder: (column) => column);
GeneratedColumn<DateTime> get purchaseDate => $composableBuilder(
column: $table.purchaseDate, builder: (column) => column);
GeneratedColumn<DateTime> get expiryDate => $composableBuilder(
column: $table.expiryDate, builder: (column) => column);
GeneratedColumn<String> get barcode =>
$composableBuilder(column: $table.barcode, builder: (column) => column);
$$ProductCategoryTableAnnotationComposer get category {
final $$ProductCategoryTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.category,
referencedTable: $db.productCategory,
getReferencedColumn: (t) => t.id,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ProductCategoryTableAnnotationComposer(
$db: $db,
$table: $db.productCategory,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return composer;
}
$$StorageLocationTableAnnotationComposer get storage {
final $$StorageLocationTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.storage,
referencedTable: $db.storageLocation,
getReferencedColumn: (t) => t.id,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$StorageLocationTableAnnotationComposer(
$db: $db,
$table: $db.storageLocation,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return composer;
}
}
class $$ProductTableTableManager extends RootTableManager<
_$AppDatabase,
$ProductTable,
ProductData,
$$ProductTableFilterComposer,
$$ProductTableOrderingComposer,
$$ProductTableAnnotationComposer,
$$ProductTableCreateCompanionBuilder,
$$ProductTableUpdateCompanionBuilder,
(ProductData, $$ProductTableReferences),
ProductData,
PrefetchHooks Function({bool category, bool storage})> {
$$ProductTableTableManager(_$AppDatabase db, $ProductTable table)
: super(TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$ProductTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$ProductTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$ProductTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback: ({
Value<int> id = const Value.absent(),
Value<String> name = const Value.absent(),
Value<int> category = const Value.absent(),
Value<int> storage = const Value.absent(),
Value<double> quantity = const Value.absent(),
Value<String> unit = const Value.absent(),
Value<DateTime?> purchaseDate = const Value.absent(),
Value<DateTime?> expiryDate = const Value.absent(),
Value<String> barcode = const Value.absent(),
}) =>
ProductCompanion(
id: id,
name: name,
category: category,
storage: storage,
quantity: quantity,
unit: unit,
purchaseDate: purchaseDate,
expiryDate: expiryDate,
barcode: barcode,
),
createCompanionCallback: ({
Value<int> id = const Value.absent(),
required String name,
required int category,
required int storage,
required double quantity,
required String unit,
Value<DateTime?> purchaseDate = const Value.absent(),
Value<DateTime?> expiryDate = const Value.absent(),
required String barcode,
}) =>
ProductCompanion.insert(
id: id,
name: name,
category: category,
storage: storage,
quantity: quantity,
unit: unit,
purchaseDate: purchaseDate,
expiryDate: expiryDate,
barcode: barcode,
),
withReferenceMapper: (p0) => p0
.map((e) =>
(e.readTable(table), $$ProductTableReferences(db, table, e)))
.toList(),
prefetchHooksCallback: ({category = false, storage = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins: <
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic>>(state) {
if (category) {
state = state.withJoin(
currentTable: table,
currentColumn: table.category,
referencedTable:
$$ProductTableReferences._categoryTable(db),
referencedColumn:
$$ProductTableReferences._categoryTable(db).id,
) as T;
}
if (storage) {
state = state.withJoin(
currentTable: table,
currentColumn: table.storage,
referencedTable: $$ProductTableReferences._storageTable(db),
referencedColumn:
$$ProductTableReferences._storageTable(db).id,
) as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
));
}
typedef $$ProductTableProcessedTableManager = ProcessedTableManager<
_$AppDatabase,
$ProductTable,
ProductData,
$$ProductTableFilterComposer,
$$ProductTableOrderingComposer,
$$ProductTableAnnotationComposer,
$$ProductTableCreateCompanionBuilder,
$$ProductTableUpdateCompanionBuilder,
(ProductData, $$ProductTableReferences),
ProductData,
PrefetchHooks Function({bool category, bool storage})>;
typedef $$ShoppingListItemTableCreateCompanionBuilder
= ShoppingListItemCompanion Function({
Value<int> id,
required String name,
required int category,
required int storage,
required double quantity,
required String unit,
Value<bool> isPurchased,
Value<DateTime?> dateAdded,
});
typedef $$ShoppingListItemTableUpdateCompanionBuilder
= ShoppingListItemCompanion Function({
Value<int> id,
Value<String> name,
Value<int> category,
Value<int> storage,
Value<double> quantity,
Value<String> unit,
Value<bool> isPurchased,
Value<DateTime?> dateAdded,
});
final class $$ShoppingListItemTableReferences extends BaseReferences<
_$AppDatabase, $ShoppingListItemTable, ShoppingListItemData> {
$$ShoppingListItemTableReferences(
super.$_db, super.$_table, super.$_typedResult);
static $ProductCategoryTable _categoryTable(_$AppDatabase db) =>
db.productCategory.createAlias($_aliasNameGenerator(
db.shoppingListItem.category, db.productCategory.id));
$$ProductCategoryTableProcessedTableManager get category {
final manager =
$$ProductCategoryTableTableManager($_db, $_db.productCategory)
.filter((f) => f.id($_item.category!));
final item = $_typedResult.readTableOrNull(_categoryTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]));
}
static $StorageLocationTable _storageTable(_$AppDatabase db) =>
db.storageLocation.createAlias($_aliasNameGenerator(
db.shoppingListItem.storage, db.storageLocation.id));
$$StorageLocationTableProcessedTableManager get storage {
final manager =
$$StorageLocationTableTableManager($_db, $_db.storageLocation)
.filter((f) => f.id($_item.storage!));
final item = $_typedResult.readTableOrNull(_storageTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]));
}
}
class $$ShoppingListItemTableFilterComposer
extends Composer<_$AppDatabase, $ShoppingListItemTable> {
$$ShoppingListItemTableFilterComposer({
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 quantity => $composableBuilder(
column: $table.quantity, builder: (column) => ColumnFilters(column));
ColumnFilters<String> get unit => $composableBuilder(
column: $table.unit, builder: (column) => ColumnFilters(column));
ColumnFilters<bool> get isPurchased => $composableBuilder(
column: $table.isPurchased, builder: (column) => ColumnFilters(column));
ColumnFilters<DateTime> get dateAdded => $composableBuilder(
column: $table.dateAdded, builder: (column) => ColumnFilters(column));
$$ProductCategoryTableFilterComposer get category {
final $$ProductCategoryTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.category,
referencedTable: $db.productCategory,
getReferencedColumn: (t) => t.id,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ProductCategoryTableFilterComposer(
$db: $db,
$table: $db.productCategory,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return composer;
}
$$StorageLocationTableFilterComposer get storage {
final $$StorageLocationTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.storage,
referencedTable: $db.storageLocation,
getReferencedColumn: (t) => t.id,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$StorageLocationTableFilterComposer(
$db: $db,
$table: $db.storageLocation,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return composer;
}
}
class $$ShoppingListItemTableOrderingComposer
extends Composer<_$AppDatabase, $ShoppingListItemTable> {
$$ShoppingListItemTableOrderingComposer({
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 quantity => $composableBuilder(
column: $table.quantity, builder: (column) => ColumnOrderings(column));
ColumnOrderings<String> get unit => $composableBuilder(
column: $table.unit, builder: (column) => ColumnOrderings(column));
ColumnOrderings<bool> get isPurchased => $composableBuilder(
column: $table.isPurchased, builder: (column) => ColumnOrderings(column));
ColumnOrderings<DateTime> get dateAdded => $composableBuilder(
column: $table.dateAdded, builder: (column) => ColumnOrderings(column));
$$ProductCategoryTableOrderingComposer get category {
final $$ProductCategoryTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.category,
referencedTable: $db.productCategory,
getReferencedColumn: (t) => t.id,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ProductCategoryTableOrderingComposer(
$db: $db,
$table: $db.productCategory,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return composer;
}
$$StorageLocationTableOrderingComposer get storage {
final $$StorageLocationTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.storage,
referencedTable: $db.storageLocation,
getReferencedColumn: (t) => t.id,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$StorageLocationTableOrderingComposer(
$db: $db,
$table: $db.storageLocation,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return composer;
}
}
class $$ShoppingListItemTableAnnotationComposer
extends Composer<_$AppDatabase, $ShoppingListItemTable> {
$$ShoppingListItemTableAnnotationComposer({
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 quantity =>
$composableBuilder(column: $table.quantity, builder: (column) => column);
GeneratedColumn<String> get unit =>
$composableBuilder(column: $table.unit, builder: (column) => column);
GeneratedColumn<bool> get isPurchased => $composableBuilder(
column: $table.isPurchased, builder: (column) => column);
GeneratedColumn<DateTime> get dateAdded =>
$composableBuilder(column: $table.dateAdded, builder: (column) => column);
$$ProductCategoryTableAnnotationComposer get category {
final $$ProductCategoryTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.category,
referencedTable: $db.productCategory,
getReferencedColumn: (t) => t.id,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$ProductCategoryTableAnnotationComposer(
$db: $db,
$table: $db.productCategory,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return composer;
}
$$StorageLocationTableAnnotationComposer get storage {
final $$StorageLocationTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.storage,
referencedTable: $db.storageLocation,
getReferencedColumn: (t) => t.id,
builder: (joinBuilder,
{$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer}) =>
$$StorageLocationTableAnnotationComposer(
$db: $db,
$table: $db.storageLocation,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
));
return composer;
}
}
class $$ShoppingListItemTableTableManager extends RootTableManager<
_$AppDatabase,
$ShoppingListItemTable,
ShoppingListItemData,
$$ShoppingListItemTableFilterComposer,
$$ShoppingListItemTableOrderingComposer,
$$ShoppingListItemTableAnnotationComposer,
$$ShoppingListItemTableCreateCompanionBuilder,
$$ShoppingListItemTableUpdateCompanionBuilder,
(ShoppingListItemData, $$ShoppingListItemTableReferences),
ShoppingListItemData,
PrefetchHooks Function({bool category, bool storage})> {
$$ShoppingListItemTableTableManager(
_$AppDatabase db, $ShoppingListItemTable table)
: super(TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$ShoppingListItemTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$ShoppingListItemTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$ShoppingListItemTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback: ({
Value<int> id = const Value.absent(),
Value<String> name = const Value.absent(),
Value<int> category = const Value.absent(),
Value<int> storage = const Value.absent(),
Value<double> quantity = const Value.absent(),
Value<String> unit = const Value.absent(),
Value<bool> isPurchased = const Value.absent(),
Value<DateTime?> dateAdded = const Value.absent(),
}) =>
ShoppingListItemCompanion(
id: id,
name: name,
category: category,
storage: storage,
quantity: quantity,
unit: unit,
isPurchased: isPurchased,
dateAdded: dateAdded,
),
createCompanionCallback: ({
Value<int> id = const Value.absent(),
required String name,
required int category,
required int storage,
required double quantity,
required String unit,
Value<bool> isPurchased = const Value.absent(),
Value<DateTime?> dateAdded = const Value.absent(),
}) =>
ShoppingListItemCompanion.insert(
id: id,
name: name,
category: category,
storage: storage,
quantity: quantity,
unit: unit,
isPurchased: isPurchased,
dateAdded: dateAdded,
),
withReferenceMapper: (p0) => p0
.map((e) => (
e.readTable(table),
$$ShoppingListItemTableReferences(db, table, e)
))
.toList(),
prefetchHooksCallback: ({category = false, storage = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins: <
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic>>(state) {
if (category) {
state = state.withJoin(
currentTable: table,
currentColumn: table.category,
referencedTable:
$$ShoppingListItemTableReferences._categoryTable(db),
referencedColumn:
$$ShoppingListItemTableReferences._categoryTable(db).id,
) as T;
}
if (storage) {
state = state.withJoin(
currentTable: table,
currentColumn: table.storage,
referencedTable:
$$ShoppingListItemTableReferences._storageTable(db),
referencedColumn:
$$ShoppingListItemTableReferences._storageTable(db).id,
) as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
));
}
typedef $$ShoppingListItemTableProcessedTableManager = ProcessedTableManager<
_$AppDatabase,
$ShoppingListItemTable,
ShoppingListItemData,
$$ShoppingListItemTableFilterComposer,
$$ShoppingListItemTableOrderingComposer,
$$ShoppingListItemTableAnnotationComposer,
$$ShoppingListItemTableCreateCompanionBuilder,
$$ShoppingListItemTableUpdateCompanionBuilder,
(ShoppingListItemData, $$ShoppingListItemTableReferences),
ShoppingListItemData,
PrefetchHooks Function({bool category, bool storage})>;
typedef $$UserTableCreateCompanionBuilder = UserCompanion Function({
Value<int> id,
required String login,
required String password,
});
typedef $$UserTableUpdateCompanionBuilder = UserCompanion Function({
Value<int> id,
Value<String> login,
Value<String> password,
});
class $$UserTableFilterComposer extends Composer<_$AppDatabase, $UserTable> {
$$UserTableFilterComposer({
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 login => $composableBuilder(
column: $table.login, builder: (column) => ColumnFilters(column));
ColumnFilters<String> get password => $composableBuilder(
column: $table.password, builder: (column) => ColumnFilters(column));
}
class $$UserTableOrderingComposer extends Composer<_$AppDatabase, $UserTable> {
$$UserTableOrderingComposer({
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 login => $composableBuilder(
column: $table.login, builder: (column) => ColumnOrderings(column));
ColumnOrderings<String> get password => $composableBuilder(
column: $table.password, builder: (column) => ColumnOrderings(column));
}
class $$UserTableAnnotationComposer
extends Composer<_$AppDatabase, $UserTable> {
$$UserTableAnnotationComposer({
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 login =>
$composableBuilder(column: $table.login, builder: (column) => column);
GeneratedColumn<String> get password =>
$composableBuilder(column: $table.password, builder: (column) => column);
}
class $$UserTableTableManager extends RootTableManager<
_$AppDatabase,
$UserTable,
UserData,
$$UserTableFilterComposer,
$$UserTableOrderingComposer,
$$UserTableAnnotationComposer,
$$UserTableCreateCompanionBuilder,
$$UserTableUpdateCompanionBuilder,
(UserData, BaseReferences<_$AppDatabase, $UserTable, UserData>),
UserData,
PrefetchHooks Function()> {
$$UserTableTableManager(_$AppDatabase db, $UserTable table)
: super(TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$UserTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$UserTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$UserTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback: ({
Value<int> id = const Value.absent(),
Value<String> login = const Value.absent(),
Value<String> password = const Value.absent(),
}) =>
UserCompanion(
id: id,
login: login,
password: password,
),
createCompanionCallback: ({
Value<int> id = const Value.absent(),
required String login,
required String password,
}) =>
UserCompanion.insert(
id: id,
login: login,
password: password,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
));
}
typedef $$UserTableProcessedTableManager = ProcessedTableManager<
_$AppDatabase,
$UserTable,
UserData,
$$UserTableFilterComposer,
$$UserTableOrderingComposer,
$$UserTableAnnotationComposer,
$$UserTableCreateCompanionBuilder,
$$UserTableUpdateCompanionBuilder,
(UserData, BaseReferences<_$AppDatabase, $UserTable, UserData>),
UserData,
PrefetchHooks Function()>;
class $AppDatabaseManager {
final _$AppDatabase _db;
$AppDatabaseManager(this._db);
$$ProductCategoryTableTableManager get productCategory =>
$$ProductCategoryTableTableManager(_db, _db.productCategory);
$$StorageLocationTableTableManager get storageLocation =>
$$StorageLocationTableTableManager(_db, _db.storageLocation);
$$ProductTableTableManager get product =>
$$ProductTableTableManager(_db, _db.product);
$$ShoppingListItemTableTableManager get shoppingListItem =>
$$ShoppingListItemTableTableManager(_db, _db.shoppingListItem);
$$UserTableTableManager get user => $$UserTableTableManager(_db, _db.user);
}