// GENERATED CODE - DO NOT MODIFY BY HAND part of 'database.dart'; // ignore_for_file: type=lint class $TodosTable extends Todos with TableInfo<$TodosTable, Todo> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $TodosTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _titleMeta = const VerificationMeta('title'); @override late final GeneratedColumn title = GeneratedColumn( 'title', aliasedName, false, additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 32), type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _contentMeta = const VerificationMeta('content'); @override late final GeneratedColumn content = GeneratedColumn( 'body', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); static const VerificationMeta _categoryMeta = const VerificationMeta('category'); @override late final GeneratedColumn category = GeneratedColumn( 'category', aliasedName, true, type: DriftSqlType.int, requiredDuringInsert: false); @override List get $columns => [id, title, content, category]; @override String get aliasedName => _alias ?? 'todos'; @override String get actualTableName => 'todos'; @override VerificationContext validateIntegrity(Insertable 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('title')) { context.handle( _titleMeta, title.isAcceptableOrUnknown(data['title']!, _titleMeta)); } else if (isInserting) { context.missing(_titleMeta); } if (data.containsKey('body')) { context.handle(_contentMeta, content.isAcceptableOrUnknown(data['body']!, _contentMeta)); } else if (isInserting) { context.missing(_contentMeta); } if (data.containsKey('category')) { context.handle(_categoryMeta, category.isAcceptableOrUnknown(data['category']!, _categoryMeta)); } return context; } @override Set get $primaryKey => {id}; @override Todo map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Todo( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, title: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}title'])!, content: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}body'])!, category: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}category']), ); } @override $TodosTable createAlias(String alias) { return $TodosTable(attachedDatabase, alias); } } class Todo extends DataClass implements Insertable { final int id; final String title; final String content; final int? category; const Todo( {required this.id, required this.title, required this.content, this.category}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['title'] = Variable(title); map['body'] = Variable(content); if (!nullToAbsent || category != null) { map['category'] = Variable(category); } return map; } TodosCompanion toCompanion(bool nullToAbsent) { return TodosCompanion( id: Value(id), title: Value(title), content: Value(content), category: category == null && nullToAbsent ? const Value.absent() : Value(category), ); } factory Todo.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Todo( id: serializer.fromJson(json['id']), title: serializer.fromJson(json['title']), content: serializer.fromJson(json['content']), category: serializer.fromJson(json['category']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'title': serializer.toJson(title), 'content': serializer.toJson(content), 'category': serializer.toJson(category), }; } Todo copyWith( {int? id, String? title, String? content, Value category = const Value.absent()}) => Todo( id: id ?? this.id, title: title ?? this.title, content: content ?? this.content, category: category.present ? category.value : this.category, ); @override String toString() { return (StringBuffer('Todo(') ..write('id: $id, ') ..write('title: $title, ') ..write('content: $content, ') ..write('category: $category') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, title, content, category); @override bool operator ==(Object other) => identical(this, other) || (other is Todo && other.id == this.id && other.title == this.title && other.content == this.content && other.category == this.category); } class TodosCompanion extends UpdateCompanion { final Value id; final Value title; final Value content; final Value category; const TodosCompanion({ this.id = const Value.absent(), this.title = const Value.absent(), this.content = const Value.absent(), this.category = const Value.absent(), }); TodosCompanion.insert({ this.id = const Value.absent(), required String title, required String content, this.category = const Value.absent(), }) : title = Value(title), content = Value(content); static Insertable custom({ Expression? id, Expression? title, Expression? content, Expression? category, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (title != null) 'title': title, if (content != null) 'body': content, if (category != null) 'category': category, }); } TodosCompanion copyWith( {Value? id, Value? title, Value? content, Value? category}) { return TodosCompanion( id: id ?? this.id, title: title ?? this.title, content: content ?? this.content, category: category ?? this.category, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (title.present) { map['title'] = Variable(title.value); } if (content.present) { map['body'] = Variable(content.value); } if (category.present) { map['category'] = Variable(category.value); } return map; } @override String toString() { return (StringBuffer('TodosCompanion(') ..write('id: $id, ') ..write('title: $title, ') ..write('content: $content, ') ..write('category: $category') ..write(')')) .toString(); } } class $CategoriesTable extends Categories with TableInfo<$CategoriesTable, Category> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $CategoriesTable(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); @override late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('PRIMARY KEY AUTOINCREMENT')); static const VerificationMeta _descriptionMeta = const VerificationMeta('description'); @override late final GeneratedColumn description = GeneratedColumn( 'description', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); @override List get $columns => [id, description]; @override String get aliasedName => _alias ?? 'categories'; @override String get actualTableName => 'categories'; @override VerificationContext validateIntegrity(Insertable 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('description')) { context.handle( _descriptionMeta, description.isAcceptableOrUnknown( data['description']!, _descriptionMeta)); } else if (isInserting) { context.missing(_descriptionMeta); } return context; } @override Set get $primaryKey => {id}; @override Category map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Category( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, description: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}description'])!, ); } @override $CategoriesTable createAlias(String alias) { return $CategoriesTable(attachedDatabase, alias); } } class Category extends DataClass implements Insertable { final int id; final String description; const Category({required this.id, required this.description}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['description'] = Variable(description); return map; } CategoriesCompanion toCompanion(bool nullToAbsent) { return CategoriesCompanion( id: Value(id), description: Value(description), ); } factory Category.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Category( id: serializer.fromJson(json['id']), description: serializer.fromJson(json['description']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'description': serializer.toJson(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 => Object.hash(id, description); @override bool operator ==(Object other) => identical(this, other) || (other is Category && other.id == this.id && other.description == this.description); } class CategoriesCompanion extends UpdateCompanion { final Value id; final Value description; const CategoriesCompanion({ this.id = const Value.absent(), this.description = const Value.absent(), }); CategoriesCompanion.insert({ this.id = const Value.absent(), required String description, }) : description = Value(description); static Insertable custom({ Expression? id, Expression? description, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (description != null) 'description': description, }); } CategoriesCompanion copyWith({Value? id, Value? description}) { return CategoriesCompanion( id: id ?? this.id, description: description ?? this.description, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (description.present) { map['description'] = Variable(description.value); } return map; } @override String toString() { return (StringBuffer('CategoriesCompanion(') ..write('id: $id, ') ..write('description: $description') ..write(')')) .toString(); } } abstract class _$MyDatabase extends GeneratedDatabase { _$MyDatabase(QueryExecutor e) : super(e); late final $TodosTable todos = $TodosTable(this); late final $CategoriesTable categories = $CategoriesTable(this); @override Iterable> get allTables => allSchemaEntities.whereType>(); @override List get allSchemaEntities => [todos, categories]; }