// GENERATED CODE - DO NOT MODIFY BY HAND part of 'database.dart'; // ************************************************************************** // MoorGenerator // ************************************************************************** class TodoEntry { final int id; final String content; final DateTime targetDate; final int category; TodoEntry({this.id, this.content, this.targetDate, this.category}); factory TodoEntry.fromData(Map data, GeneratedDatabase db) { final intType = db.typeSystem.forDartType(); final stringType = db.typeSystem.forDartType(); final dateTimeType = db.typeSystem.forDartType(); return TodoEntry( id: intType.mapFromDatabaseResponse(data['id']), content: stringType.mapFromDatabaseResponse(data['content']), targetDate: dateTimeType.mapFromDatabaseResponse(data['target_date']), category: intType.mapFromDatabaseResponse(data['category']), ); } Map toJson() { return { 'id': id, 'content': content, 'targetDate': targetDate, 'category': category, }; } TodoEntry copyWith( {int id, String content, DateTime targetDate, int category}) => TodoEntry( id: id ?? this.id, content: content ?? this.content, targetDate: targetDate ?? this.targetDate, category: category ?? this.category, ); @override String toString() { return (StringBuffer('TodoEntry(') ..write('id: $id, ') ..write('content: $content, ') ..write('targetDate: $targetDate, ') ..write('category: $category') ..write(')')) .toString(); } @override int get hashCode => (((id.hashCode) * 31 + content.hashCode) * 31 + targetDate.hashCode) * 31 + category.hashCode; @override bool operator ==(other) => identical(this, other) || (other is TodoEntry && other.id == id && other.content == content && other.targetDate == targetDate && other.category == category); } class $TodosTable extends Todos implements TableInfo { final GeneratedDatabase _db; $TodosTable(this._db); @override GeneratedIntColumn get id => GeneratedIntColumn('id', false, hasAutoIncrement: true); @override GeneratedTextColumn get content => GeneratedTextColumn( 'content', false, ); @override GeneratedDateTimeColumn get targetDate => GeneratedDateTimeColumn( 'target_date', true, ); @override GeneratedIntColumn get category => GeneratedIntColumn( 'category', true, ); @override List get $columns => [id, content, targetDate, category]; @override Todos get asDslTable => this; @override String get $tableName => 'todos'; @override bool validateIntegrity(TodoEntry instance, bool isInserting) => id.isAcceptableValue(instance.id, isInserting) && content.isAcceptableValue(instance.content, isInserting) && targetDate.isAcceptableValue(instance.targetDate, isInserting) && category.isAcceptableValue(instance.category, isInserting); @override Set get $primaryKey => {id}; @override TodoEntry map(Map data) { return TodoEntry.fromData(data, _db); } @override Map entityToSql(TodoEntry d, {bool includeNulls = false}) { final map = {}; if (d.id != null || includeNulls) { map['id'] = Variable(d.id); } if (d.content != null || includeNulls) { map['content'] = Variable(d.content); } if (d.targetDate != null || includeNulls) { map['target_date'] = Variable(d.targetDate); } if (d.category != null || includeNulls) { map['category'] = Variable(d.category); } return map; } } class Category { final int id; final String description; Category({this.id, this.description}); factory Category.fromData(Map data, GeneratedDatabase db) { final intType = db.typeSystem.forDartType(); final stringType = db.typeSystem.forDartType(); return Category( id: intType.mapFromDatabaseResponse(data['id']), description: stringType.mapFromDatabaseResponse(data['`desc`']), ); } Map toJson() { return { 'id': id, 'description': description, }; } Category copyWith({int id, String description}) => Category( id: id ?? this.id, description: description ?? this.description, ); @override String toString() { return (StringBuffer('Category(') ..write('id: $id, ') ..write('description: $description') ..write(')')) .toString(); } @override int get hashCode => (id.hashCode) * 31 + description.hashCode; @override bool operator ==(other) => identical(this, other) || (other is Category && other.id == id && other.description == description); } class $CategoriesTable extends Categories implements TableInfo { final GeneratedDatabase _db; $CategoriesTable(this._db); @override GeneratedIntColumn get id => GeneratedIntColumn('id', false, hasAutoIncrement: true); @override GeneratedTextColumn get description => GeneratedTextColumn( '`desc`', false, ); @override List get $columns => [id, description]; @override Categories get asDslTable => this; @override String get $tableName => 'categories'; @override bool validateIntegrity(Category instance, bool isInserting) => id.isAcceptableValue(instance.id, isInserting) && description.isAcceptableValue(instance.description, isInserting); @override Set get $primaryKey => {id}; @override Category map(Map data) { return Category.fromData(data, _db); } @override Map entityToSql(Category d, {bool includeNulls = false}) { final map = {}; if (d.id != null || includeNulls) { map['id'] = Variable(d.id); } if (d.description != null || includeNulls) { map['`desc`'] = Variable(d.description); } return map; } } abstract class _$Database extends GeneratedDatabase { _$Database(QueryExecutor e) : super(const SqlTypeSystem.withDefaults(), e); $TodosTable get todos => $TodosTable(this); $CategoriesTable get categories => $CategoriesTable(this); TodosDao _todosDao; TodosDao get todosDao => _todosDao ??= TodosDao(this as Database); @override List get allTables => [todos, categories]; }