// ignore_for_file: type=lint import 'package:drift/drift.dart' as i0; import 'package:with_built_value/tables.drift.dart' as i1; class Users extends i0.Table with i0.TableInfo { @override final i0.GeneratedDatabase attachedDatabase; final String? _alias; Users(this.attachedDatabase, [this._alias]); static const i0.VerificationMeta _idMeta = const i0.VerificationMeta('id'); late final i0.GeneratedColumn id = i0.GeneratedColumn( 'id', aliasedName, false, hasAutoIncrement: true, type: i0.DriftSqlType.int, requiredDuringInsert: false, $customConstraints: 'NOT NULL PRIMARY KEY AUTOINCREMENT'); static const i0.VerificationMeta _nameMeta = const i0.VerificationMeta('name'); late final i0.GeneratedColumn name = i0.GeneratedColumn( 'name', aliasedName, false, type: i0.DriftSqlType.string, requiredDuringInsert: true, $customConstraints: 'NOT NULL'); @override List get $columns => [id, name]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'users'; @override i0.VerificationContext validateIntegrity(i0.Insertable instance, {bool isInserting = false}) { final context = i0.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)); } else if (isInserting) { context.missing(_nameMeta); } return context; } @override Set get $primaryKey => {id}; @override i1.User map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return i1.User( id: attachedDatabase.typeMapping .read(i0.DriftSqlType.int, data['${effectivePrefix}id'])!, name: attachedDatabase.typeMapping .read(i0.DriftSqlType.string, data['${effectivePrefix}name'])!, ); } @override Users createAlias(String alias) { return Users(attachedDatabase, alias); } @override bool get dontWriteConstraints => true; } class User extends i0.DataClass implements i0.Insertable { final int id; final String name; const User({required this.id, required this.name}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = i0.Variable(id); map['name'] = i0.Variable(name); return map; } i1.UsersCompanion toCompanion(bool nullToAbsent) { return i1.UsersCompanion( id: i0.Value(id), name: i0.Value(name), ); } factory User.fromJson(Map json, {i0.ValueSerializer? serializer}) { serializer ??= i0.driftRuntimeOptions.defaultSerializer; return User( id: serializer.fromJson(json['id']), name: serializer.fromJson(json['name']), ); } @override Map toJson({i0.ValueSerializer? serializer}) { serializer ??= i0.driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'name': serializer.toJson(name), }; } i1.User copyWith({int? id, String? name}) => i1.User( id: id ?? this.id, name: name ?? this.name, ); @override String toString() { return (StringBuffer('User(') ..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 i1.User && other.id == this.id && other.name == this.name); } class UsersCompanion extends i0.UpdateCompanion { final i0.Value id; final i0.Value name; const UsersCompanion({ this.id = const i0.Value.absent(), this.name = const i0.Value.absent(), }); UsersCompanion.insert({ this.id = const i0.Value.absent(), required String name, }) : name = i0.Value(name); static i0.Insertable custom({ i0.Expression? id, i0.Expression? name, }) { return i0.RawValuesInsertable({ if (id != null) 'id': id, if (name != null) 'name': name, }); } i1.UsersCompanion copyWith({i0.Value? id, i0.Value? name}) { return i1.UsersCompanion( id: id ?? this.id, name: name ?? this.name, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = i0.Variable(id.value); } if (name.present) { map['name'] = i0.Variable(name.value); } return map; } @override String toString() { return (StringBuffer('UsersCompanion(') ..write('id: $id, ') ..write('name: $name') ..write(')')) .toString(); } }