// dart format width=80 // GENERATED CODE, DO NOT EDIT BY HAND. // ignore_for_file: type=lint import 'package:drift/drift.dart'; class ProductCategory extends Table with TableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; ProductCategory(this.attachedDatabase, [this._alias]); late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); late final GeneratedColumn name = GeneratedColumn( 'name', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); late final GeneratedColumn icon = GeneratedColumn( 'icon', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); @override List get $columns => [id, name, icon]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'product_category'; @override Set get $primaryKey => {id}; @override ProductCategoryData map(Map 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 ProductCategory createAlias(String alias) { return ProductCategory(attachedDatabase, alias); } } class ProductCategoryData extends DataClass implements Insertable { final int id; final String name; final String icon; const ProductCategoryData( {required this.id, required this.name, required this.icon}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); map['icon'] = Variable(icon); return map; } ProductCategoryCompanion toCompanion(bool nullToAbsent) { return ProductCategoryCompanion( id: Value(id), name: Value(name), icon: Value(icon), ); } factory ProductCategoryData.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return ProductCategoryData( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), icon: serializer.fromJson(json['icon']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), 'icon': serializer.toJson(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 { final Value id; final Value name; final Value 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 custom({ Expression? id, Expression? name, Expression? icon, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (name != null) 'name': name, if (icon != null) 'icon': icon, }); } ProductCategoryCompanion copyWith( {Value? id, Value? name, Value? icon}) { return ProductCategoryCompanion( id: id ?? this.id, name: name ?? this.name, icon: icon ?? this.icon, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (name.present) { map['name'] = Variable(name.value); } if (icon.present) { map['icon'] = Variable(icon.value); } return map; } @override String toString() { return (StringBuffer('ProductCategoryCompanion(') ..write('id: $id, ') ..write('name: $name, ') ..write('icon: $icon') ..write(')')) .toString(); } } class StorageLocation extends Table with TableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; StorageLocation(this.attachedDatabase, [this._alias]); late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); late final GeneratedColumn name = GeneratedColumn( 'name', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); late final GeneratedColumn description = GeneratedColumn( 'description', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); late final GeneratedColumn temperatureMode = GeneratedColumn( 'temperature_mode', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); late final GeneratedColumn icon = GeneratedColumn( 'icon', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); late final GeneratedColumn isDefault = GeneratedColumn( 'is_default', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('CHECK ("is_default" IN (0, 1))'), defaultValue: const Constant(false)); @override List 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 Set get $primaryKey => {id}; @override StorageLocationData map(Map 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 StorageLocation createAlias(String alias) { return StorageLocation(attachedDatabase, alias); } } class StorageLocationData extends DataClass implements Insertable { 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 toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); map['description'] = Variable(description); map['temperature_mode'] = Variable(temperatureMode); map['icon'] = Variable(icon); map['is_default'] = Variable(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 json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return StorageLocationData( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), description: serializer.fromJson(json['description']), temperatureMode: serializer.fromJson(json['temperatureMode']), icon: serializer.fromJson(json['icon']), isDefault: serializer.fromJson(json['isDefault']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), 'description': serializer.toJson(description), 'temperatureMode': serializer.toJson(temperatureMode), 'icon': serializer.toJson(icon), 'isDefault': serializer.toJson(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 { final Value id; final Value name; final Value description; final Value temperatureMode; final Value icon; final Value 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 custom({ Expression? id, Expression? name, Expression? description, Expression? temperatureMode, Expression? icon, Expression? 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? id, Value? name, Value? description, Value? temperatureMode, Value? icon, Value? 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 toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (name.present) { map['name'] = Variable(name.value); } if (description.present) { map['description'] = Variable(description.value); } if (temperatureMode.present) { map['temperature_mode'] = Variable(temperatureMode.value); } if (icon.present) { map['icon'] = Variable(icon.value); } if (isDefault.present) { map['is_default'] = Variable(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 Product extends Table with TableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; Product(this.attachedDatabase, [this._alias]); late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); late final GeneratedColumn name = GeneratedColumn( 'name', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); late final GeneratedColumn category = GeneratedColumn( 'category', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES product_category (id)')); late final GeneratedColumn storage = GeneratedColumn( 'storage', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES storage_location (id)')); late final GeneratedColumn quantity = GeneratedColumn( 'quantity', aliasedName, false, type: DriftSqlType.double, requiredDuringInsert: true); late final GeneratedColumn unit = GeneratedColumn( 'unit', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); late final GeneratedColumn purchaseDate = GeneratedColumn( 'purchase_date', aliasedName, true, type: DriftSqlType.dateTime, requiredDuringInsert: false); late final GeneratedColumn expiryDate = GeneratedColumn( 'expiry_date', aliasedName, true, type: DriftSqlType.dateTime, requiredDuringInsert: false); late final GeneratedColumn barcode = GeneratedColumn( 'barcode', aliasedName, false, additionalChecks: GeneratedColumn.checkTextLength(maxTextLength: 20), type: DriftSqlType.string, requiredDuringInsert: true); @override List 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 Set get $primaryKey => {id}; @override ProductData map(Map 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 Product createAlias(String alias) { return Product(attachedDatabase, alias); } } class ProductData extends DataClass implements Insertable { 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 toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); map['category'] = Variable(category); map['storage'] = Variable(storage); map['quantity'] = Variable(quantity); map['unit'] = Variable(unit); if (!nullToAbsent || purchaseDate != null) { map['purchase_date'] = Variable(purchaseDate); } if (!nullToAbsent || expiryDate != null) { map['expiry_date'] = Variable(expiryDate); } map['barcode'] = Variable(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 json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return ProductData( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), category: serializer.fromJson(json['category']), storage: serializer.fromJson(json['storage']), quantity: serializer.fromJson(json['quantity']), unit: serializer.fromJson(json['unit']), purchaseDate: serializer.fromJson(json['purchaseDate']), expiryDate: serializer.fromJson(json['expiryDate']), barcode: serializer.fromJson(json['barcode']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), 'category': serializer.toJson(category), 'storage': serializer.toJson(storage), 'quantity': serializer.toJson(quantity), 'unit': serializer.toJson(unit), 'purchaseDate': serializer.toJson(purchaseDate), 'expiryDate': serializer.toJson(expiryDate), 'barcode': serializer.toJson(barcode), }; } ProductData copyWith( {int? id, String? name, int? category, int? storage, double? quantity, String? unit, Value purchaseDate = const Value.absent(), Value 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 { final Value id; final Value name; final Value category; final Value storage; final Value quantity; final Value unit; final Value purchaseDate; final Value expiryDate; final Value 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 custom({ Expression? id, Expression? name, Expression? category, Expression? storage, Expression? quantity, Expression? unit, Expression? purchaseDate, Expression? expiryDate, Expression? 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? id, Value? name, Value? category, Value? storage, Value? quantity, Value? unit, Value? purchaseDate, Value? expiryDate, Value? 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 toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (name.present) { map['name'] = Variable(name.value); } if (category.present) { map['category'] = Variable(category.value); } if (storage.present) { map['storage'] = Variable(storage.value); } if (quantity.present) { map['quantity'] = Variable(quantity.value); } if (unit.present) { map['unit'] = Variable(unit.value); } if (purchaseDate.present) { map['purchase_date'] = Variable(purchaseDate.value); } if (expiryDate.present) { map['expiry_date'] = Variable(expiryDate.value); } if (barcode.present) { map['barcode'] = Variable(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 ShoppingListItem extends Table with TableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; ShoppingListItem(this.attachedDatabase, [this._alias]); late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); late final GeneratedColumn name = GeneratedColumn( 'name', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); late final GeneratedColumn category = GeneratedColumn( 'category', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES product_category (id)')); late final GeneratedColumn storage = GeneratedColumn( 'storage', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, defaultConstraints: GeneratedColumn.constraintIsAlways( 'REFERENCES storage_location (id)')); late final GeneratedColumn quantity = GeneratedColumn( 'quantity', aliasedName, false, type: DriftSqlType.double, requiredDuringInsert: true); late final GeneratedColumn unit = GeneratedColumn( 'unit', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); late final GeneratedColumn isPurchased = GeneratedColumn( 'is_purchased', aliasedName, false, type: DriftSqlType.bool, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways( 'CHECK ("is_purchased" IN (0, 1))'), defaultValue: const Constant(false)); late final GeneratedColumn dateAdded = GeneratedColumn( 'date_added', aliasedName, true, type: DriftSqlType.dateTime, requiredDuringInsert: false, defaultValue: currentDateAndTime); @override List 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 Set get $primaryKey => {id}; @override ShoppingListItemData map(Map 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 ShoppingListItem createAlias(String alias) { return ShoppingListItem(attachedDatabase, alias); } } class ShoppingListItemData extends DataClass implements Insertable { 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 toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); map['category'] = Variable(category); map['storage'] = Variable(storage); map['quantity'] = Variable(quantity); map['unit'] = Variable(unit); map['is_purchased'] = Variable(isPurchased); if (!nullToAbsent || dateAdded != null) { map['date_added'] = Variable(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 json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return ShoppingListItemData( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), category: serializer.fromJson(json['category']), storage: serializer.fromJson(json['storage']), quantity: serializer.fromJson(json['quantity']), unit: serializer.fromJson(json['unit']), isPurchased: serializer.fromJson(json['isPurchased']), dateAdded: serializer.fromJson(json['dateAdded']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), 'category': serializer.toJson(category), 'storage': serializer.toJson(storage), 'quantity': serializer.toJson(quantity), 'unit': serializer.toJson(unit), 'isPurchased': serializer.toJson(isPurchased), 'dateAdded': serializer.toJson(dateAdded), }; } ShoppingListItemData copyWith( {int? id, String? name, int? category, int? storage, double? quantity, String? unit, bool? isPurchased, Value 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 { final Value id; final Value name; final Value category; final Value storage; final Value quantity; final Value unit; final Value isPurchased; final Value 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 custom({ Expression? id, Expression? name, Expression? category, Expression? storage, Expression? quantity, Expression? unit, Expression? isPurchased, Expression? 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? id, Value? name, Value? category, Value? storage, Value? quantity, Value? unit, Value? isPurchased, Value? 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 toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (name.present) { map['name'] = Variable(name.value); } if (category.present) { map['category'] = Variable(category.value); } if (storage.present) { map['storage'] = Variable(storage.value); } if (quantity.present) { map['quantity'] = Variable(quantity.value); } if (unit.present) { map['unit'] = Variable(unit.value); } if (isPurchased.present) { map['is_purchased'] = Variable(isPurchased.value); } if (dateAdded.present) { map['date_added'] = Variable(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 DatabaseAtV1 extends GeneratedDatabase { DatabaseAtV1(QueryExecutor e) : super(e); late final ProductCategory productCategory = ProductCategory(this); late final StorageLocation storageLocation = StorageLocation(this); late final Product product = Product(this); late final ShoppingListItem shoppingListItem = ShoppingListItem(this); @override Iterable> get allTables => allSchemaEntities.whereType>(); @override List get allSchemaEntities => [productCategory, storageLocation, product, shoppingListItem]; @override int get schemaVersion => 1; }