2021-01-31 12:50:12 -08:00
|
|
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
|
|
|
|
part of 'database.dart';
|
|
|
|
|
2022-04-01 13:39:28 -07:00
|
|
|
// ignore_for_file: type=lint
|
2023-11-22 04:09:09 -08:00
|
|
|
class Entries extends Table with TableInfo<Entries, Entry> {
|
2022-12-30 19:33:54 -08:00
|
|
|
@override
|
|
|
|
final GeneratedDatabase attachedDatabase;
|
|
|
|
final String? _alias;
|
|
|
|
Entries(this.attachedDatabase, [this._alias]);
|
|
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
|
|
late final GeneratedColumn<int> id = GeneratedColumn<int>(
|
|
|
|
'id', aliasedName, false,
|
|
|
|
type: DriftSqlType.int,
|
|
|
|
requiredDuringInsert: false,
|
|
|
|
$customConstraints: 'PRIMARY KEY');
|
|
|
|
static const VerificationMeta _valueMeta = const VerificationMeta('value');
|
|
|
|
late final GeneratedColumn<String> value = GeneratedColumn<String>(
|
|
|
|
'text', aliasedName, false,
|
|
|
|
type: DriftSqlType.string,
|
|
|
|
requiredDuringInsert: true,
|
|
|
|
$customConstraints: 'NOT NULL');
|
|
|
|
@override
|
|
|
|
List<GeneratedColumn> get $columns => [id, value];
|
|
|
|
@override
|
2023-09-20 20:36:39 -07:00
|
|
|
String get aliasedName => _alias ?? actualTableName;
|
2022-12-30 19:33:54 -08:00
|
|
|
@override
|
2023-09-20 20:36:39 -07:00
|
|
|
String get actualTableName => $name;
|
|
|
|
static const String $name = 'entries';
|
2022-12-30 19:33:54 -08:00
|
|
|
@override
|
2023-11-22 04:09:09 -08:00
|
|
|
VerificationContext validateIntegrity(Insertable<Entry> instance,
|
2022-12-30 19:33:54 -08:00
|
|
|
{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<GeneratedColumn> get $primaryKey => {id};
|
|
|
|
@override
|
2023-11-22 04:09:09 -08:00
|
|
|
Entry map(Map<String, dynamic> data, {String? tablePrefix}) {
|
2022-12-30 19:33:54 -08:00
|
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
2023-11-22 04:09:09 -08:00
|
|
|
return Entry(
|
2022-12-30 19:33:54 -08:00
|
|
|
id: attachedDatabase.typeMapping
|
|
|
|
.read(DriftSqlType.int, data['${effectivePrefix}id'])!,
|
|
|
|
value: attachedDatabase.typeMapping
|
|
|
|
.read(DriftSqlType.string, data['${effectivePrefix}text'])!,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Entries createAlias(String alias) {
|
|
|
|
return Entries(attachedDatabase, alias);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
bool get dontWriteConstraints => true;
|
|
|
|
}
|
|
|
|
|
2023-11-22 04:09:09 -08:00
|
|
|
class Entry extends DataClass implements Insertable<Entry> {
|
2021-05-06 07:37:05 -07:00
|
|
|
final int id;
|
2021-01-31 12:50:12 -08:00
|
|
|
final String value;
|
2023-11-22 04:09:09 -08:00
|
|
|
const Entry({required this.id, required this.value});
|
2021-01-31 12:50:12 -08:00
|
|
|
@override
|
|
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
|
|
final map = <String, Expression>{};
|
2021-05-06 07:37:05 -07:00
|
|
|
map['id'] = Variable<int>(id);
|
2021-01-31 12:50:12 -08:00
|
|
|
map['text'] = Variable<String>(value);
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
EntriesCompanion toCompanion(bool nullToAbsent) {
|
|
|
|
return EntriesCompanion(
|
2021-05-06 07:37:05 -07:00
|
|
|
id: Value(id),
|
2021-01-31 12:50:12 -08:00
|
|
|
value: Value(value),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-11-22 04:09:09 -08:00
|
|
|
factory Entry.fromJson(Map<String, dynamic> json,
|
2021-01-31 12:50:12 -08:00
|
|
|
{ValueSerializer? serializer}) {
|
2021-10-08 14:33:39 -07:00
|
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
2023-11-22 04:09:09 -08:00
|
|
|
return Entry(
|
2021-05-06 07:37:05 -07:00
|
|
|
id: serializer.fromJson<int>(json['id']),
|
2021-01-31 12:50:12 -08:00
|
|
|
value: serializer.fromJson<String>(json['text']),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
@override
|
|
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
2021-10-08 14:33:39 -07:00
|
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
2021-01-31 12:50:12 -08:00
|
|
|
return <String, dynamic>{
|
2021-05-06 07:37:05 -07:00
|
|
|
'id': serializer.toJson<int>(id),
|
2021-01-31 12:50:12 -08:00
|
|
|
'text': serializer.toJson<String>(value),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2023-11-22 04:09:09 -08:00
|
|
|
Entry copyWith({int? id, String? value}) => Entry(
|
2021-05-06 07:37:05 -07:00
|
|
|
id: id ?? this.id,
|
2021-01-31 12:50:12 -08:00
|
|
|
value: value ?? this.value,
|
|
|
|
);
|
|
|
|
@override
|
|
|
|
String toString() {
|
2023-11-22 04:09:09 -08:00
|
|
|
return (StringBuffer('Entry(')
|
2021-01-31 12:50:12 -08:00
|
|
|
..write('id: $id, ')
|
|
|
|
..write('value: $value')
|
|
|
|
..write(')'))
|
|
|
|
.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2021-10-08 14:33:39 -07:00
|
|
|
int get hashCode => Object.hash(id, value);
|
2021-01-31 12:50:12 -08:00
|
|
|
@override
|
2021-05-14 09:50:29 -07:00
|
|
|
bool operator ==(Object other) =>
|
2021-01-31 12:50:12 -08:00
|
|
|
identical(this, other) ||
|
2023-11-22 04:09:09 -08:00
|
|
|
(other is Entry && other.id == this.id && other.value == this.value);
|
2021-01-31 12:50:12 -08:00
|
|
|
}
|
|
|
|
|
2023-11-22 04:09:09 -08:00
|
|
|
class EntriesCompanion extends UpdateCompanion<Entry> {
|
2021-05-06 07:37:05 -07:00
|
|
|
final Value<int> id;
|
2021-01-31 12:50:12 -08:00
|
|
|
final Value<String> 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);
|
2023-11-22 04:09:09 -08:00
|
|
|
static Insertable<Entry> custom({
|
2021-05-06 07:37:05 -07:00
|
|
|
Expression<int>? id,
|
2021-01-31 12:50:12 -08:00
|
|
|
Expression<String>? value,
|
|
|
|
}) {
|
|
|
|
return RawValuesInsertable({
|
|
|
|
if (id != null) 'id': id,
|
|
|
|
if (value != null) 'text': value,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2021-05-06 07:37:05 -07:00
|
|
|
EntriesCompanion copyWith({Value<int>? id, Value<String>? value}) {
|
2021-01-31 12:50:12 -08:00
|
|
|
return EntriesCompanion(
|
|
|
|
id: id ?? this.id,
|
|
|
|
value: value ?? this.value,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
|
|
final map = <String, Expression>{};
|
|
|
|
if (id.present) {
|
2021-05-06 07:37:05 -07:00
|
|
|
map['id'] = Variable<int>(id.value);
|
2021-01-31 12:50:12 -08:00
|
|
|
}
|
|
|
|
if (value.present) {
|
|
|
|
map['text'] = Variable<String>(value.value);
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() {
|
|
|
|
return (StringBuffer('EntriesCompanion(')
|
|
|
|
..write('id: $id, ')
|
|
|
|
..write('value: $value')
|
|
|
|
..write(')'))
|
|
|
|
.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
abstract class _$MyDatabase extends GeneratedDatabase {
|
2022-07-19 13:55:08 -07:00
|
|
|
_$MyDatabase(QueryExecutor e) : super(e);
|
2021-01-31 12:50:12 -08:00
|
|
|
late final Entries entries = Entries(this);
|
2023-11-22 04:09:09 -08:00
|
|
|
Selectable<Entry> allEntries() {
|
2021-10-08 14:33:39 -07:00
|
|
|
return customSelect('SELECT * FROM entries', variables: [], readsFrom: {
|
|
|
|
entries,
|
2022-08-12 13:55:02 -07:00
|
|
|
}).asyncMap(entries.mapFromRow);
|
2021-01-31 12:50:12 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
Future<int> addEntry(String var1) {
|
|
|
|
return customInsert(
|
2022-07-19 13:55:08 -07:00
|
|
|
'INSERT INTO entries (text) VALUES (?1)',
|
2021-01-31 12:50:12 -08:00
|
|
|
variables: [Variable<String>(var1)],
|
|
|
|
updates: {entries},
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
Future<int> clearEntries() {
|
|
|
|
return customUpdate(
|
|
|
|
'DELETE FROM entries',
|
|
|
|
variables: [],
|
|
|
|
updates: {entries},
|
|
|
|
updateKind: UpdateKind.delete,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2022-11-30 18:51:41 -08:00
|
|
|
Iterable<TableInfo<Table, Object?>> get allTables =>
|
2022-08-08 02:30:47 -07:00
|
|
|
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
2021-01-31 12:50:12 -08:00
|
|
|
@override
|
|
|
|
List<DatabaseSchemaEntity> get allSchemaEntities => [entries];
|
|
|
|
}
|