// GENERATED CODE - DO NOT MODIFY BY HAND part of 'database.dart'; // ignore_for_file: type=lint class $UsersTable extends Users with TableInfo<$UsersTable, User> { @override final GeneratedDatabase attachedDatabase; final String? _alias; $UsersTable(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 _nameMeta = const VerificationMeta('name'); @override late final GeneratedColumn name = GeneratedColumn( 'name', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('name')); static const VerificationMeta _birthdayMeta = const VerificationMeta('birthday'); @override late final GeneratedColumn birthday = GeneratedColumn( 'birthday', aliasedName, true, type: DriftSqlType.dateTime, requiredDuringInsert: false); static const VerificationMeta _nextUserMeta = const VerificationMeta('nextUser'); @override late final GeneratedColumn nextUser = GeneratedColumn( 'next_user', aliasedName, true, type: DriftSqlType.int, requiredDuringInsert: false, defaultConstraints: GeneratedColumn.constraintIsAlways('REFERENCES users (id)')); @override List get $columns => [id, name, birthday, nextUser]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'users'; @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('name')) { context.handle( _nameMeta, name.isAcceptableOrUnknown(data['name']!, _nameMeta)); } if (data.containsKey('birthday')) { context.handle(_birthdayMeta, birthday.isAcceptableOrUnknown(data['birthday']!, _birthdayMeta)); } if (data.containsKey('next_user')) { context.handle(_nextUserMeta, nextUser.isAcceptableOrUnknown(data['next_user']!, _nextUserMeta)); } return context; } @override Set get $primaryKey => {id}; @override List> get uniqueKeys => [ {name, birthday}, ]; @override User map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return User( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, name: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}name'])!, birthday: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}birthday']), nextUser: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}next_user']), ); } @override $UsersTable createAlias(String alias) { return $UsersTable(attachedDatabase, alias); } } class User extends DataClass implements Insertable { final int id; final String name; final DateTime? birthday; final int? nextUser; const User( {required this.id, required this.name, this.birthday, this.nextUser}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); if (!nullToAbsent || birthday != null) { map['birthday'] = Variable(birthday); } if (!nullToAbsent || nextUser != null) { map['next_user'] = Variable(nextUser); } return map; } UsersCompanion toCompanion(bool nullToAbsent) { return UsersCompanion( id: Value(id), name: Value(name), birthday: birthday == null && nullToAbsent ? const Value.absent() : Value(birthday), nextUser: nextUser == null && nullToAbsent ? const Value.absent() : Value(nextUser), ); } factory User.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return User( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), birthday: serializer.fromJson(json['birthday']), nextUser: serializer.fromJson(json['nextUser']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), 'birthday': serializer.toJson(birthday), 'nextUser': serializer.toJson(nextUser), }; } User copyWith( {int? id, String? name, Value birthday = const Value.absent(), Value nextUser = const Value.absent()}) => User( id: id ?? this.id, name: name ?? this.name, birthday: birthday.present ? birthday.value : this.birthday, nextUser: nextUser.present ? nextUser.value : this.nextUser, ); @override String toString() { return (StringBuffer('User(') ..write('id: $id, ') ..write('name: $name, ') ..write('birthday: $birthday, ') ..write('nextUser: $nextUser') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, name, birthday, nextUser); @override bool operator ==(Object other) => identical(this, other) || (other is User && other.id == this.id && other.name == this.name && other.birthday == this.birthday && other.nextUser == this.nextUser); } class UsersCompanion extends UpdateCompanion { final Value id; final Value name; final Value birthday; final Value nextUser; const UsersCompanion({ this.id = const Value.absent(), this.name = const Value.absent(), this.birthday = const Value.absent(), this.nextUser = const Value.absent(), }); UsersCompanion.insert({ this.id = const Value.absent(), this.name = const Value.absent(), this.birthday = const Value.absent(), this.nextUser = const Value.absent(), }); static Insertable custom({ Expression? id, Expression? name, Expression? birthday, Expression? nextUser, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (name != null) 'name': name, if (birthday != null) 'birthday': birthday, if (nextUser != null) 'next_user': nextUser, }); } UsersCompanion copyWith( {Value? id, Value? name, Value? birthday, Value? nextUser}) { return UsersCompanion( id: id ?? this.id, name: name ?? this.name, birthday: birthday ?? this.birthday, nextUser: nextUser ?? this.nextUser, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (name.present) { map['name'] = Variable(name.value); } if (birthday.present) { map['birthday'] = Variable(birthday.value); } if (nextUser.present) { map['next_user'] = Variable(nextUser.value); } return map; } @override String toString() { return (StringBuffer('UsersCompanion(') ..write('id: $id, ') ..write('name: $name, ') ..write('birthday: $birthday, ') ..write('nextUser: $nextUser') ..write(')')) .toString(); } } class Groups extends Table with TableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; Groups(this.attachedDatabase, [this._alias]); static const VerificationMeta _idMeta = const VerificationMeta('id'); late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: false, $customConstraints: 'NOT NULL'); static const VerificationMeta _titleMeta = const VerificationMeta('title'); late final GeneratedColumn title = GeneratedColumn( 'title', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: 'NOT NULL'); static const VerificationMeta _deletedMeta = const VerificationMeta('deleted'); late final GeneratedColumn deleted = GeneratedColumn( 'deleted', aliasedName, true, type: DriftSqlType.bool, requiredDuringInsert: false, $customConstraints: 'DEFAULT FALSE', defaultValue: const CustomExpression('FALSE')); static const VerificationMeta _ownerMeta = const VerificationMeta('owner'); late final GeneratedColumn owner = GeneratedColumn( 'owner', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: true, $customConstraints: 'NOT NULL REFERENCES users(id)'); @override List get $columns => [id, title, deleted, owner]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'groups'; @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('deleted')) { context.handle(_deletedMeta, deleted.isAcceptableOrUnknown(data['deleted']!, _deletedMeta)); } if (data.containsKey('owner')) { context.handle( _ownerMeta, owner.isAcceptableOrUnknown(data['owner']!, _ownerMeta)); } else if (isInserting) { context.missing(_ownerMeta); } return context; } @override Set get $primaryKey => {id}; @override Group map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Group( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, title: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}title'])!, deleted: attachedDatabase.typeMapping .read(DriftSqlType.bool, data['${effectivePrefix}deleted']), owner: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}owner'])!, ); } @override Groups createAlias(String alias) { return Groups(attachedDatabase, alias); } @override List get customConstraints => const ['PRIMARY KEY(id)']; @override bool get dontWriteConstraints => true; } class Group extends DataClass implements Insertable { final int id; final String title; final bool? deleted; final int owner; const Group( {required this.id, required this.title, this.deleted, required this.owner}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['title'] = Variable(title); if (!nullToAbsent || deleted != null) { map['deleted'] = Variable(deleted); } map['owner'] = Variable(owner); return map; } GroupsCompanion toCompanion(bool nullToAbsent) { return GroupsCompanion( id: Value(id), title: Value(title), deleted: deleted == null && nullToAbsent ? const Value.absent() : Value(deleted), owner: Value(owner), ); } factory Group.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Group( id: serializer.fromJson(json['id']), title: serializer.fromJson(json['title']), deleted: serializer.fromJson(json['deleted']), owner: serializer.fromJson(json['owner']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'title': serializer.toJson(title), 'deleted': serializer.toJson(deleted), 'owner': serializer.toJson(owner), }; } Group copyWith( {int? id, String? title, Value deleted = const Value.absent(), int? owner}) => Group( id: id ?? this.id, title: title ?? this.title, deleted: deleted.present ? deleted.value : this.deleted, owner: owner ?? this.owner, ); @override String toString() { return (StringBuffer('Group(') ..write('id: $id, ') ..write('title: $title, ') ..write('deleted: $deleted, ') ..write('owner: $owner') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, title, deleted, owner); @override bool operator ==(Object other) => identical(this, other) || (other is Group && other.id == this.id && other.title == this.title && other.deleted == this.deleted && other.owner == this.owner); } class GroupsCompanion extends UpdateCompanion { final Value id; final Value title; final Value deleted; final Value owner; const GroupsCompanion({ this.id = const Value.absent(), this.title = const Value.absent(), this.deleted = const Value.absent(), this.owner = const Value.absent(), }); GroupsCompanion.insert({ this.id = const Value.absent(), required String title, this.deleted = const Value.absent(), required int owner, }) : title = Value(title), owner = Value(owner); static Insertable custom({ Expression? id, Expression? title, Expression? deleted, Expression? owner, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (title != null) 'title': title, if (deleted != null) 'deleted': deleted, if (owner != null) 'owner': owner, }); } GroupsCompanion copyWith( {Value? id, Value? title, Value? deleted, Value? owner}) { return GroupsCompanion( id: id ?? this.id, title: title ?? this.title, deleted: deleted ?? this.deleted, owner: owner ?? this.owner, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (title.present) { map['title'] = Variable(title.value); } if (deleted.present) { map['deleted'] = Variable(deleted.value); } if (owner.present) { map['owner'] = Variable(owner.value); } return map; } @override String toString() { return (StringBuffer('GroupsCompanion(') ..write('id: $id, ') ..write('title: $title, ') ..write('deleted: $deleted, ') ..write('owner: $owner') ..write(')')) .toString(); } } class Notes extends Table with TableInfo, VirtualTableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; Notes(this.attachedDatabase, [this._alias]); static const VerificationMeta _titleMeta = const VerificationMeta('title'); late final GeneratedColumn title = GeneratedColumn( 'title', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: ''); static const VerificationMeta _contentMeta = const VerificationMeta('content'); late final GeneratedColumn content = GeneratedColumn( 'content', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: ''); static const VerificationMeta _searchTermsMeta = const VerificationMeta('searchTerms'); late final GeneratedColumn searchTerms = GeneratedColumn( 'search_terms', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: ''); @override List get $columns => [title, content, searchTerms]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'notes'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('title')) { context.handle( _titleMeta, title.isAcceptableOrUnknown(data['title']!, _titleMeta)); } else if (isInserting) { context.missing(_titleMeta); } if (data.containsKey('content')) { context.handle(_contentMeta, content.isAcceptableOrUnknown(data['content']!, _contentMeta)); } else if (isInserting) { context.missing(_contentMeta); } if (data.containsKey('search_terms')) { context.handle( _searchTermsMeta, searchTerms.isAcceptableOrUnknown( data['search_terms']!, _searchTermsMeta)); } else if (isInserting) { context.missing(_searchTermsMeta); } return context; } @override Set get $primaryKey => const {}; @override Note map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return Note( title: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}title'])!, content: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}content'])!, searchTerms: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}search_terms'])!, ); } @override Notes createAlias(String alias) { return Notes(attachedDatabase, alias); } @override bool get dontWriteConstraints => true; @override String get moduleAndArgs => 'fts5(title, content, search_terms, tokenize = "unicode61 tokenchars \'.\'")'; } class Note extends DataClass implements Insertable { final String title; final String content; final String searchTerms; const Note( {required this.title, required this.content, required this.searchTerms}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['title'] = Variable(title); map['content'] = Variable(content); map['search_terms'] = Variable(searchTerms); return map; } NotesCompanion toCompanion(bool nullToAbsent) { return NotesCompanion( title: Value(title), content: Value(content), searchTerms: Value(searchTerms), ); } factory Note.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Note( title: serializer.fromJson(json['title']), content: serializer.fromJson(json['content']), searchTerms: serializer.fromJson(json['search_terms']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'title': serializer.toJson(title), 'content': serializer.toJson(content), 'search_terms': serializer.toJson(searchTerms), }; } Note copyWith({String? title, String? content, String? searchTerms}) => Note( title: title ?? this.title, content: content ?? this.content, searchTerms: searchTerms ?? this.searchTerms, ); @override String toString() { return (StringBuffer('Note(') ..write('title: $title, ') ..write('content: $content, ') ..write('searchTerms: $searchTerms') ..write(')')) .toString(); } @override int get hashCode => Object.hash(title, content, searchTerms); @override bool operator ==(Object other) => identical(this, other) || (other is Note && other.title == this.title && other.content == this.content && other.searchTerms == this.searchTerms); } class NotesCompanion extends UpdateCompanion { final Value title; final Value content; final Value searchTerms; final Value rowid; const NotesCompanion({ this.title = const Value.absent(), this.content = const Value.absent(), this.searchTerms = const Value.absent(), this.rowid = const Value.absent(), }); NotesCompanion.insert({ required String title, required String content, required String searchTerms, this.rowid = const Value.absent(), }) : title = Value(title), content = Value(content), searchTerms = Value(searchTerms); static Insertable custom({ Expression? title, Expression? content, Expression? searchTerms, Expression? rowid, }) { return RawValuesInsertable({ if (title != null) 'title': title, if (content != null) 'content': content, if (searchTerms != null) 'search_terms': searchTerms, if (rowid != null) 'rowid': rowid, }); } NotesCompanion copyWith( {Value? title, Value? content, Value? searchTerms, Value? rowid}) { return NotesCompanion( title: title ?? this.title, content: content ?? this.content, searchTerms: searchTerms ?? this.searchTerms, rowid: rowid ?? this.rowid, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (title.present) { map['title'] = Variable(title.value); } if (content.present) { map['content'] = Variable(content.value); } if (searchTerms.present) { map['search_terms'] = Variable(searchTerms.value); } if (rowid.present) { map['rowid'] = Variable(rowid.value); } return map; } @override String toString() { return (StringBuffer('NotesCompanion(') ..write('title: $title, ') ..write('content: $content, ') ..write('searchTerms: $searchTerms, ') ..write('rowid: $rowid') ..write(')')) .toString(); } } class GroupCountData extends DataClass { final int id; final String name; final DateTime? birthday; final int? nextUser; final int groupCount; const GroupCountData( {required this.id, required this.name, this.birthday, this.nextUser, required this.groupCount}); factory GroupCountData.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return GroupCountData( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), birthday: serializer.fromJson(json['birthday']), nextUser: serializer.fromJson(json['next_user']), groupCount: serializer.fromJson(json['group_count']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), 'birthday': serializer.toJson(birthday), 'next_user': serializer.toJson(nextUser), 'group_count': serializer.toJson(groupCount), }; } GroupCountData copyWith( {int? id, String? name, Value birthday = const Value.absent(), Value nextUser = const Value.absent(), int? groupCount}) => GroupCountData( id: id ?? this.id, name: name ?? this.name, birthday: birthday.present ? birthday.value : this.birthday, nextUser: nextUser.present ? nextUser.value : this.nextUser, groupCount: groupCount ?? this.groupCount, ); @override String toString() { return (StringBuffer('GroupCountData(') ..write('id: $id, ') ..write('name: $name, ') ..write('birthday: $birthday, ') ..write('nextUser: $nextUser, ') ..write('groupCount: $groupCount') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, name, birthday, nextUser, groupCount); @override bool operator ==(Object other) => identical(this, other) || (other is GroupCountData && other.id == this.id && other.name == this.name && other.birthday == this.birthday && other.nextUser == this.nextUser && other.groupCount == this.groupCount); } class GroupCount extends ViewInfo implements HasResultSet { final String? _alias; @override final _$Database attachedDatabase; GroupCount(this.attachedDatabase, [this._alias]); @override List get $columns => [id, name, birthday, nextUser, groupCount]; @override String get aliasedName => _alias ?? entityName; @override String get entityName => 'group_count'; @override Map get createViewStatements => { SqlDialect.sqlite: 'CREATE VIEW group_count AS SELECT users.*, (SELECT COUNT(*) FROM "groups" WHERE owner = users.id) AS group_count FROM users', }; @override GroupCount get asDslTable => this; @override GroupCountData map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return GroupCountData( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, name: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}name'])!, birthday: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}birthday']), nextUser: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}next_user']), groupCount: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}group_count'])!, ); } late final GeneratedColumn id = GeneratedColumn('id', aliasedName, false, type: DriftSqlType.int); late final GeneratedColumn name = GeneratedColumn( 'name', aliasedName, false, type: DriftSqlType.string); late final GeneratedColumn birthday = GeneratedColumn( 'birthday', aliasedName, true, type: DriftSqlType.dateTime); late final GeneratedColumn nextUser = GeneratedColumn( 'next_user', aliasedName, true, type: DriftSqlType.int); late final GeneratedColumn groupCount = GeneratedColumn( 'group_count', aliasedName, false, type: DriftSqlType.int); @override GroupCount createAlias(String alias) { return GroupCount(attachedDatabase, alias); } @override Query? get query => null; @override Set get readTables => const {'users', 'groups'}; } abstract class _$Database extends GeneratedDatabase { _$Database(QueryExecutor e) : super(e); late final $UsersTable users = $UsersTable(this); late final Groups groups = Groups(this); late final Notes notes = Notes(this); late final GroupCount groupCount = GroupCount(this); late final Index userName = Index('user_name', 'CREATE INDEX user_name ON users (name)'); @override Iterable> get allTables => allSchemaEntities.whereType>(); @override List get allSchemaEntities => [users, groups, notes, groupCount, userName]; @override DriftDatabaseOptions get options => const DriftDatabaseOptions(storeDateTimeAsText: true); }