// GENERATED CODE, DO NOT EDIT BY HAND. // ignore_for_file: type=lint //@dart=2.12 import 'package:drift/drift.dart'; class Users extends Table with TableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; Users(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 name = GeneratedColumn( 'name', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: false, defaultValue: const Constant('name')); @override List get $columns => [id, name]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'users'; @override Set get $primaryKey => {id}; @override UsersData map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return UsersData( id: attachedDatabase.typeMapping .read(DriftSqlType.int, data['${effectivePrefix}id'])!, name: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}name'])!, ); } @override Users createAlias(String alias) { return Users(attachedDatabase, alias); } } class UsersData extends DataClass implements Insertable { final int id; final String name; const UsersData({required this.id, required this.name}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['name'] = Variable(name); return map; } UsersCompanion toCompanion(bool nullToAbsent) { return UsersCompanion( id: Value(id), name: Value(name), ); } factory UsersData.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return UsersData( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), }; } UsersData copyWith({int? id, String? name}) => UsersData( id: id ?? this.id, name: name ?? this.name, ); @override String toString() { return (StringBuffer('UsersData(') ..write('id: $id, ') ..write('name: $name') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, name); @override bool operator ==(Object other) => identical(this, other) || (other is UsersData && other.id == this.id && other.name == this.name); } class UsersCompanion extends UpdateCompanion { final Value id; final Value name; const UsersCompanion({ this.id = const Value.absent(), this.name = const Value.absent(), }); UsersCompanion.insert({ this.id = const Value.absent(), this.name = const Value.absent(), }); static Insertable custom({ Expression? id, Expression? name, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (name != null) 'name': name, }); } UsersCompanion copyWith({Value? id, Value? name}) { return UsersCompanion( id: id ?? this.id, name: name ?? this.name, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (name.present) { map['name'] = Variable(name.value); } return map; } @override String toString() { return (StringBuffer('UsersCompanion(') ..write('id: $id, ') ..write('name: $name') ..write(')')) .toString(); } } class Groups extends Table with TableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; Groups(this.attachedDatabase, [this._alias]); late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, type: DriftSqlType.int, requiredDuringInsert: false, $customConstraints: 'NOT NULL'); late final GeneratedColumn title = GeneratedColumn( 'title', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: 'NOT NULL'); late final GeneratedColumn deleted = GeneratedColumn( 'deleted', aliasedName, true, type: DriftSqlType.bool, requiredDuringInsert: false, $customConstraints: 'DEFAULT FALSE', defaultValue: const CustomExpression('FALSE')); 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 Set get $primaryKey => {id}; @override GroupsData map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return GroupsData( 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 GroupsData extends DataClass implements Insertable { final int id; final String title; final bool? deleted; final int owner; const GroupsData( {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 GroupsData.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return GroupsData( 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), }; } GroupsData copyWith( {int? id, String? title, Value deleted = const Value.absent(), int? owner}) => GroupsData( id: id ?? this.id, title: title ?? this.title, deleted: deleted.present ? deleted.value : this.deleted, owner: owner ?? this.owner, ); @override String toString() { return (StringBuffer('GroupsData(') ..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 GroupsData && 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 DatabaseAtV4 extends GeneratedDatabase { DatabaseAtV4(QueryExecutor e) : super(e); late final Users users = Users(this); late final Groups groups = Groups(this); @override Iterable> get allTables => allSchemaEntities.whereType>(); @override List get allSchemaEntities => [users, groups]; @override int get schemaVersion => 4; }