1233 lines
42 KiB
Dart
1233 lines
42 KiB
Dart
// 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<ProductCategory, ProductCategoryData> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
ProductCategory(this.attachedDatabase, [this._alias]);
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'id', aliasedName, false,
|
|
hasAutoIncrement: true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints:
|
|
GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'));
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name', aliasedName, false,
|
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
|
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
|
|
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
|
|
ProductCategory createAlias(String alias) {
|
|
return ProductCategory(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 StorageLocation extends Table
|
|
with TableInfo<StorageLocation, StorageLocationData> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
StorageLocation(this.attachedDatabase, [this._alias]);
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'id', aliasedName, false,
|
|
hasAutoIncrement: true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints:
|
|
GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'));
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name', aliasedName, false,
|
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
|
late final GeneratedColumn<String> description = GeneratedColumn<String>(
|
|
'description', aliasedName, false,
|
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
|
late final GeneratedColumn<String> temperatureMode = GeneratedColumn<String>(
|
|
'temperature_mode', aliasedName, false,
|
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
|
late final GeneratedColumn<String> icon = GeneratedColumn<String>(
|
|
'icon', aliasedName, false,
|
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
|
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
|
|
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
|
|
StorageLocation createAlias(String alias) {
|
|
return StorageLocation(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 Product extends Table with TableInfo<Product, ProductData> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
Product(this.attachedDatabase, [this._alias]);
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'id', aliasedName, false,
|
|
hasAutoIncrement: true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints:
|
|
GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'));
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name', aliasedName, false,
|
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
|
late final GeneratedColumn<int> category = GeneratedColumn<int>(
|
|
'category', aliasedName, false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES product_category (id)'));
|
|
late final GeneratedColumn<int> storage = GeneratedColumn<int>(
|
|
'storage', aliasedName, false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES storage_location (id)'));
|
|
late final GeneratedColumn<double> quantity = GeneratedColumn<double>(
|
|
'quantity', aliasedName, false,
|
|
type: DriftSqlType.double, requiredDuringInsert: true);
|
|
late final GeneratedColumn<String> unit = GeneratedColumn<String>(
|
|
'unit', aliasedName, false,
|
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
|
late final GeneratedColumn<DateTime> purchaseDate = GeneratedColumn<DateTime>(
|
|
'purchase_date', aliasedName, true,
|
|
type: DriftSqlType.dateTime, requiredDuringInsert: false);
|
|
late final GeneratedColumn<DateTime> expiryDate = GeneratedColumn<DateTime>(
|
|
'expiry_date', aliasedName, true,
|
|
type: DriftSqlType.dateTime, requiredDuringInsert: false);
|
|
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
|
|
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
|
|
Product createAlias(String alias) {
|
|
return Product(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 ShoppingListItem extends Table
|
|
with TableInfo<ShoppingListItem, ShoppingListItemData> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
ShoppingListItem(this.attachedDatabase, [this._alias]);
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
'id', aliasedName, false,
|
|
hasAutoIncrement: true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints:
|
|
GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT'));
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name', aliasedName, false,
|
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
|
late final GeneratedColumn<int> category = GeneratedColumn<int>(
|
|
'category', aliasedName, false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES product_category (id)'));
|
|
late final GeneratedColumn<int> storage = GeneratedColumn<int>(
|
|
'storage', aliasedName, false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES storage_location (id)'));
|
|
late final GeneratedColumn<double> quantity = GeneratedColumn<double>(
|
|
'quantity', aliasedName, false,
|
|
type: DriftSqlType.double, requiredDuringInsert: true);
|
|
late final GeneratedColumn<String> unit = GeneratedColumn<String>(
|
|
'unit', aliasedName, false,
|
|
type: DriftSqlType.string, requiredDuringInsert: true);
|
|
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));
|
|
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
|
|
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
|
|
ShoppingListItem createAlias(String alias) {
|
|
return ShoppingListItem(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 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<TableInfo<Table, Object?>> get allTables =>
|
|
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
|
@override
|
|
List<DatabaseSchemaEntity> get allSchemaEntities =>
|
|
[productCategory, storageLocation, product, shoppingListItem];
|
|
@override
|
|
int get schemaVersion => 1;
|
|
}
|