// GENERATED CODE, DO NOT EDIT BY HAND. // ignore_for_file: type=lint //@dart=2.12 import 'package:drift/drift.dart'; class Todos extends Table with TableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; Todos(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 title = GeneratedColumn( 'title', aliasedName, false, additionalChecks: GeneratedColumn.checkTextLength(minTextLength: 6, maxTextLength: 10), type: DriftSqlType.string, requiredDuringInsert: true); late final GeneratedColumn content = GeneratedColumn( 'body', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true); late final GeneratedColumn category = GeneratedColumn( 'category', aliasedName, true, type: DriftSqlType.int, requiredDuringInsert: false); late final GeneratedColumn dueDate = GeneratedColumn( 'due_date', aliasedName, true, type: DriftSqlType.dateTime, requiredDuringInsert: false); @override List get $columns => [id, title, content, category, dueDate]; @override String get aliasedName => _alias ?? 'todos'; @override String get actualTableName => 'todos'; @override Set get $primaryKey => {id}; @override TodosData map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return TodosData( 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']), dueDate: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}due_date']), ); } @override Todos createAlias(String alias) { return Todos(attachedDatabase, alias); } } class TodosData extends DataClass implements Insertable { final int id; final String title; final String content; final int? category; final DateTime? dueDate; const TodosData( {required this.id, required this.title, required this.content, this.category, this.dueDate}); @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); } if (!nullToAbsent || dueDate != null) { map['due_date'] = Variable(dueDate); } 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), dueDate: dueDate == null && nullToAbsent ? const Value.absent() : Value(dueDate), ); } factory TodosData.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return TodosData( id: serializer.fromJson(json['id']), title: serializer.fromJson(json['title']), content: serializer.fromJson(json['content']), category: serializer.fromJson(json['category']), dueDate: serializer.fromJson(json['dueDate']), ); } @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), 'dueDate': serializer.toJson(dueDate), }; } TodosData copyWith( {int? id, String? title, String? content, Value category = const Value.absent(), Value dueDate = const Value.absent()}) => TodosData( id: id ?? this.id, title: title ?? this.title, content: content ?? this.content, category: category.present ? category.value : this.category, dueDate: dueDate.present ? dueDate.value : this.dueDate, ); @override String toString() { return (StringBuffer('TodosData(') ..write('id: $id, ') ..write('title: $title, ') ..write('content: $content, ') ..write('category: $category, ') ..write('dueDate: $dueDate') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, title, content, category, dueDate); @override bool operator ==(Object other) => identical(this, other) || (other is TodosData && other.id == this.id && other.title == this.title && other.content == this.content && other.category == this.category && other.dueDate == this.dueDate); } class TodosCompanion extends UpdateCompanion { final Value id; final Value title; final Value content; final Value category; final Value dueDate; const TodosCompanion({ this.id = const Value.absent(), this.title = const Value.absent(), this.content = const Value.absent(), this.category = const Value.absent(), this.dueDate = const Value.absent(), }); TodosCompanion.insert({ this.id = const Value.absent(), required String title, required String content, this.category = const Value.absent(), this.dueDate = const Value.absent(), }) : title = Value(title), content = Value(content); static Insertable custom({ Expression? id, Expression? title, Expression? content, Expression? category, Expression? dueDate, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (title != null) 'title': title, if (content != null) 'body': content, if (category != null) 'category': category, if (dueDate != null) 'due_date': dueDate, }); } TodosCompanion copyWith( {Value? id, Value? title, Value? content, Value? category, Value? dueDate}) { return TodosCompanion( id: id ?? this.id, title: title ?? this.title, content: content ?? this.content, category: category ?? this.category, dueDate: dueDate ?? this.dueDate, ); } @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); } if (dueDate.present) { map['due_date'] = Variable(dueDate.value); } return map; } @override String toString() { return (StringBuffer('TodosCompanion(') ..write('id: $id, ') ..write('title: $title, ') ..write('content: $content, ') ..write('category: $category, ') ..write('dueDate: $dueDate') ..write(')')) .toString(); } } class DatabaseAtV2 extends GeneratedDatabase { DatabaseAtV2(QueryExecutor e) : super(e); late final Todos todos = Todos(this); @override Iterable> get allTables => allSchemaEntities.whereType>(); @override List get allSchemaEntities => [todos]; @override int get schemaVersion => 2; }