// GENERATED CODE - DO NOT MODIFY BY HAND part of 'database.dart'; // ************************************************************************** // MoorGenerator // ************************************************************************** // ignore_for_file: unnecessary_brace_in_string_interps, unnecessary_this class Entrie extends DataClass implements Insertable { final int id; final String value; Entrie({required this.id, required this.value}); factory Entrie.fromData(Map data, {String? prefix}) { final effectivePrefix = prefix ?? ''; return Entrie( id: const IntType() .mapFromDatabaseResponse(data['${effectivePrefix}id'])!, value: const StringType() .mapFromDatabaseResponse(data['${effectivePrefix}text'])!, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; map['id'] = Variable(id); map['text'] = Variable(value); return map; } EntriesCompanion toCompanion(bool nullToAbsent) { return EntriesCompanion( id: Value(id), value: Value(value), ); } factory Entrie.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return Entrie( id: serializer.fromJson(json['id']), value: serializer.fromJson(json['text']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'text': serializer.toJson(value), }; } Entrie copyWith({int? id, String? value}) => Entrie( id: id ?? this.id, value: value ?? this.value, ); @override String toString() { return (StringBuffer('Entrie(') ..write('id: $id, ') ..write('value: $value') ..write(')')) .toString(); } @override int get hashCode => Object.hash(id, value); @override bool operator ==(Object other) => identical(this, other) || (other is Entrie && other.id == this.id && other.value == this.value); } class EntriesCompanion extends UpdateCompanion { final Value id; final Value value; const EntriesCompanion({ this.id = const Value.absent(), this.value = const Value.absent(), }); EntriesCompanion.insert({ this.id = const Value.absent(), required String value, }) : value = Value(value); static Insertable custom({ Expression? id, Expression? value, }) { return RawValuesInsertable({ if (id != null) 'id': id, if (value != null) 'text': value, }); } EntriesCompanion copyWith({Value? id, Value? value}) { return EntriesCompanion( id: id ?? this.id, value: value ?? this.value, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (value.present) { map['text'] = Variable(value.value); } return map; } @override String toString() { return (StringBuffer('EntriesCompanion(') ..write('id: $id, ') ..write('value: $value') ..write(')')) .toString(); } } class Entries extends Table with TableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; Entries(this.attachedDatabase, [this._alias]); final VerificationMeta _idMeta = const VerificationMeta('id'); late final GeneratedColumn id = GeneratedColumn( 'id', aliasedName, false, type: const IntType(), requiredDuringInsert: false, $customConstraints: 'PRIMARY KEY'); final VerificationMeta _valueMeta = const VerificationMeta('value'); late final GeneratedColumn value = GeneratedColumn( 'text', aliasedName, false, type: const StringType(), requiredDuringInsert: true, $customConstraints: 'NOT NULL'); @override List get $columns => [id, value]; @override String get aliasedName => _alias ?? 'entries'; @override String get actualTableName => 'entries'; @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('text')) { context.handle( _valueMeta, value.isAcceptableOrUnknown(data['text']!, _valueMeta)); } else if (isInserting) { context.missing(_valueMeta); } return context; } @override Set get $primaryKey => {id}; @override Entrie map(Map data, {String? tablePrefix}) { return Entrie.fromData(data, prefix: tablePrefix != null ? '$tablePrefix.' : null); } @override Entries createAlias(String alias) { return Entries(attachedDatabase, alias); } @override bool get dontWriteConstraints => true; } abstract class _$MyDatabase extends GeneratedDatabase { _$MyDatabase(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e); _$MyDatabase.connect(DatabaseConnection c) : super.connect(c); late final Entries entries = Entries(this); Selectable allEntries() { return customSelect('SELECT * FROM entries', variables: [], readsFrom: { entries, }).map(entries.mapFromRow); } Future addEntry(String var1) { return customInsert( 'INSERT INTO entries (text) VALUES (?1)', variables: [Variable(var1)], updates: {entries}, ); } Future clearEntries() { return customUpdate( 'DELETE FROM entries', variables: [], updates: {entries}, updateKind: UpdateKind.delete, ); } @override Iterable get allTables => allSchemaEntities.whereType(); @override List get allSchemaEntities => [entries]; }