// 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({this.id, required this.value}); factory Entrie.fromData(Map data, GeneratedDatabase db, {String? prefix}) { final effectivePrefix = prefix ?? ''; final intType = db.typeSystem.forDartType(); final stringType = db.typeSystem.forDartType(); return Entrie( id: intType.mapFromDatabaseResponse(data['${effectivePrefix}id']), value: stringType.mapFromDatabaseResponse(data['${effectivePrefix}text'])!, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (!nullToAbsent || id != null) { map['id'] = Variable(id); } map['text'] = Variable(value); return map; } EntriesCompanion toCompanion(bool nullToAbsent) { return EntriesCompanion( id: id == null && nullToAbsent ? const Value.absent() : Value(id), value: Value(value), ); } factory Entrie.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= moorRuntimeOptions.defaultSerializer; return Entrie( id: serializer.fromJson(json['id']), value: serializer.fromJson(json['text']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= moorRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'text': serializer.toJson(value), }; } Entrie copyWith({Value id = const Value.absent(), String? value}) => Entrie( id: id.present ? id.value : this.id, value: value ?? this.value, ); @override String toString() { return (StringBuffer('Entrie(') ..write('id: $id, ') ..write('value: $value') ..write(')')) .toString(); } @override int get hashCode => $mrjf($mrjc(id.hashCode, value.hashCode)); @override bool operator ==(dynamic 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 { final GeneratedDatabase _db; final String? _alias; Entries(this._db, [this._alias]); final VerificationMeta _idMeta = const VerificationMeta('id'); late final GeneratedIntColumn id = _constructId(); GeneratedIntColumn _constructId() { return GeneratedIntColumn('id', $tableName, true, declaredAsPrimaryKey: true, $customConstraints: 'PRIMARY KEY'); } final VerificationMeta _valueMeta = const VerificationMeta('value'); late final GeneratedTextColumn value = _constructValue(); GeneratedTextColumn _constructValue() { return GeneratedTextColumn('text', $tableName, false, $customConstraints: 'NOT NULL'); } @override List get $columns => [id, value]; @override Entries get asDslTable => this; @override String get $tableName => _alias ?? 'entries'; @override final String 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}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : null; return Entrie.fromData(data, _db, prefix: effectivePrefix); } @override Entries createAlias(String alias) { return Entries(_db, 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 (?)', 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]; }