// GENERATED CODE - DO NOT MODIFY BY HAND part of 'database.dart'; // ignore_for_file: type=lint class Setting extends Table with TableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; Setting(this.attachedDatabase, [this._alias]); late final GeneratedColumn key = GeneratedColumn( 'key', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: 'PRIMARY KEY NOT NULL'); late final GeneratedColumn partitionKey = GeneratedColumn( 'partition_key', aliasedName, true, type: DriftSqlType.string, requiredDuringInsert: false, $customConstraints: ''); late final GeneratedColumn value = GeneratedColumn( 'value', aliasedName, true, type: DriftSqlType.any, requiredDuringInsert: false, $customConstraints: ''); @override List get $columns => [key, partitionKey, value]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'setting'; @override Set get $primaryKey => {key}; @override SettingData map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return SettingData( key: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}key'])!, partitionKey: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}partition_key']), value: attachedDatabase.typeMapping .read(DriftSqlType.any, data['${effectivePrefix}value']), ); } @override Setting createAlias(String alias) { return Setting(attachedDatabase, alias); } @override bool get isStrict => true; @override bool get dontWriteConstraints => true; } class SettingData extends DataClass implements Insertable { final String key; final String? partitionKey; final DriftAny? value; const SettingData({required this.key, this.partitionKey, this.value}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['key'] = Variable(key); if (!nullToAbsent || partitionKey != null) { map['partition_key'] = Variable(partitionKey); } if (!nullToAbsent || value != null) { map['value'] = Variable(value); } return map; } factory SettingData.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return SettingData( key: serializer.fromJson(json['key']), partitionKey: serializer.fromJson(json['partition_key']), value: serializer.fromJson(json['value']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'key': serializer.toJson(key), 'partition_key': serializer.toJson(partitionKey), 'value': serializer.toJson(value), }; } SettingData copyWith( {String? key, Value partitionKey = const Value.absent(), Value value = const Value.absent()}) => SettingData( key: key ?? this.key, partitionKey: partitionKey.present ? partitionKey.value : this.partitionKey, value: value.present ? value.value : this.value, ); SettingData copyWithCompanion(SettingCompanion data) { return SettingData( key: data.key.present ? data.key.value : this.key, partitionKey: data.partitionKey.present ? data.partitionKey.value : this.partitionKey, value: data.value.present ? data.value.value : this.value, ); } @override String toString() { return (StringBuffer('SettingData(') ..write('key: $key, ') ..write('partitionKey: $partitionKey, ') ..write('value: $value') ..write(')')) .toString(); } @override int get hashCode => Object.hash(key, partitionKey, value); @override bool operator ==(Object other) => identical(this, other) || (other is SettingData && other.key == this.key && other.partitionKey == this.partitionKey && other.value == this.value); } class SettingCompanion extends UpdateCompanion { final Value key; final Value partitionKey; final Value value; final Value rowid; const SettingCompanion({ this.key = const Value.absent(), this.partitionKey = const Value.absent(), this.value = const Value.absent(), this.rowid = const Value.absent(), }); SettingCompanion.insert({ required String key, this.partitionKey = const Value.absent(), this.value = const Value.absent(), this.rowid = const Value.absent(), }) : key = Value(key); static Insertable custom({ Expression? key, Expression? partitionKey, Expression? value, Expression? rowid, }) { return RawValuesInsertable({ if (key != null) 'key': key, if (partitionKey != null) 'partition_key': partitionKey, if (value != null) 'value': value, if (rowid != null) 'rowid': rowid, }); } SettingCompanion copyWith( {Value? key, Value? partitionKey, Value? value, Value? rowid}) { return SettingCompanion( key: key ?? this.key, partitionKey: partitionKey ?? this.partitionKey, value: value ?? this.value, rowid: rowid ?? this.rowid, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (key.present) { map['key'] = Variable(key.value); } if (partitionKey.present) { map['partition_key'] = Variable(partitionKey.value); } if (value.present) { map['value'] = Variable(value.value); } if (rowid.present) { map['rowid'] = Variable(rowid.value); } return map; } @override String toString() { return (StringBuffer('SettingCompanion(') ..write('key: $key, ') ..write('partitionKey: $partitionKey, ') ..write('value: $value, ') ..write('rowid: $rowid') ..write(')')) .toString(); } } class IconCache extends Table with TableInfo { @override final GeneratedDatabase attachedDatabase; final String? _alias; IconCache(this.attachedDatabase, [this._alias]); late final GeneratedColumn origin = GeneratedColumn( 'origin', aliasedName, false, type: DriftSqlType.string, requiredDuringInsert: true, $customConstraints: 'PRIMARY KEY NOT NULL'); late final GeneratedColumn iconData = GeneratedColumn( 'icon_data', aliasedName, false, type: DriftSqlType.blob, requiredDuringInsert: true, $customConstraints: 'NOT NULL'); late final GeneratedColumn fetchDate = GeneratedColumn( 'fetch_date', aliasedName, false, type: DriftSqlType.dateTime, requiredDuringInsert: true, $customConstraints: 'NOT NULL'); @override List get $columns => [origin, iconData, fetchDate]; @override String get aliasedName => _alias ?? actualTableName; @override String get actualTableName => $name; static const String $name = 'icon_cache'; @override Set get $primaryKey => {origin}; @override IconCacheData map(Map data, {String? tablePrefix}) { final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : ''; return IconCacheData( origin: attachedDatabase.typeMapping .read(DriftSqlType.string, data['${effectivePrefix}origin'])!, iconData: attachedDatabase.typeMapping .read(DriftSqlType.blob, data['${effectivePrefix}icon_data'])!, fetchDate: attachedDatabase.typeMapping .read(DriftSqlType.dateTime, data['${effectivePrefix}fetch_date'])!, ); } @override IconCache createAlias(String alias) { return IconCache(attachedDatabase, alias); } @override bool get dontWriteConstraints => true; } class IconCacheData extends DataClass implements Insertable { final String origin; final Uint8List iconData; final DateTime fetchDate; const IconCacheData( {required this.origin, required this.iconData, required this.fetchDate}); @override Map toColumns(bool nullToAbsent) { final map = {}; map['origin'] = Variable(origin); map['icon_data'] = Variable(iconData); map['fetch_date'] = Variable(fetchDate); return map; } factory IconCacheData.fromJson(Map json, {ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return IconCacheData( origin: serializer.fromJson(json['origin']), iconData: serializer.fromJson(json['icon_data']), fetchDate: serializer.fromJson(json['fetch_date']), ); } @override Map toJson({ValueSerializer? serializer}) { serializer ??= driftRuntimeOptions.defaultSerializer; return { 'origin': serializer.toJson(origin), 'icon_data': serializer.toJson(iconData), 'fetch_date': serializer.toJson(fetchDate), }; } IconCacheData copyWith( {String? origin, Uint8List? iconData, DateTime? fetchDate}) => IconCacheData( origin: origin ?? this.origin, iconData: iconData ?? this.iconData, fetchDate: fetchDate ?? this.fetchDate, ); IconCacheData copyWithCompanion(IconCacheCompanion data) { return IconCacheData( origin: data.origin.present ? data.origin.value : this.origin, iconData: data.iconData.present ? data.iconData.value : this.iconData, fetchDate: data.fetchDate.present ? data.fetchDate.value : this.fetchDate, ); } @override String toString() { return (StringBuffer('IconCacheData(') ..write('origin: $origin, ') ..write('iconData: $iconData, ') ..write('fetchDate: $fetchDate') ..write(')')) .toString(); } @override int get hashCode => Object.hash(origin, $driftBlobEquality.hash(iconData), fetchDate); @override bool operator ==(Object other) => identical(this, other) || (other is IconCacheData && other.origin == this.origin && $driftBlobEquality.equals(other.iconData, this.iconData) && other.fetchDate == this.fetchDate); } class IconCacheCompanion extends UpdateCompanion { final Value origin; final Value iconData; final Value fetchDate; final Value rowid; const IconCacheCompanion({ this.origin = const Value.absent(), this.iconData = const Value.absent(), this.fetchDate = const Value.absent(), this.rowid = const Value.absent(), }); IconCacheCompanion.insert({ required String origin, required Uint8List iconData, required DateTime fetchDate, this.rowid = const Value.absent(), }) : origin = Value(origin), iconData = Value(iconData), fetchDate = Value(fetchDate); static Insertable custom({ Expression? origin, Expression? iconData, Expression? fetchDate, Expression? rowid, }) { return RawValuesInsertable({ if (origin != null) 'origin': origin, if (iconData != null) 'icon_data': iconData, if (fetchDate != null) 'fetch_date': fetchDate, if (rowid != null) 'rowid': rowid, }); } IconCacheCompanion copyWith( {Value? origin, Value? iconData, Value? fetchDate, Value? rowid}) { return IconCacheCompanion( origin: origin ?? this.origin, iconData: iconData ?? this.iconData, fetchDate: fetchDate ?? this.fetchDate, rowid: rowid ?? this.rowid, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (origin.present) { map['origin'] = Variable(origin.value); } if (iconData.present) { map['icon_data'] = Variable(iconData.value); } if (fetchDate.present) { map['fetch_date'] = Variable(fetchDate.value); } if (rowid.present) { map['rowid'] = Variable(rowid.value); } return map; } @override String toString() { return (StringBuffer('IconCacheCompanion(') ..write('origin: $origin, ') ..write('iconData: $iconData, ') ..write('fetchDate: $fetchDate, ') ..write('rowid: $rowid') ..write(')')) .toString(); } } abstract class _$UserDatabase extends GeneratedDatabase { _$UserDatabase(QueryExecutor e) : super(e); $UserDatabaseManager get managers => $UserDatabaseManager(this); late final Setting setting = Setting(this); late final IconCache iconCache = IconCache(this); late final SettingDao settingDao = SettingDao(this as UserDatabase); late final CacheDao cacheDao = CacheDao(this as UserDatabase); Future evictCacheEntries({required int limit}) { return customUpdate( 'DELETE FROM icon_cache WHERE "rowid" IN (SELECT "rowid" FROM icon_cache ORDER BY fetch_date DESC LIMIT -1 OFFSET ?1)', variables: [Variable(limit)], updates: {iconCache}, updateKind: UpdateKind.delete, ); } @override Iterable> get allTables => allSchemaEntities.whereType>(); @override List get allSchemaEntities => [setting, iconCache]; } typedef $SettingCreateCompanionBuilder = SettingCompanion Function({ required String key, Value partitionKey, Value value, Value rowid, }); typedef $SettingUpdateCompanionBuilder = SettingCompanion Function({ Value key, Value partitionKey, Value value, Value rowid, }); class $SettingFilterComposer extends Composer<_$UserDatabase, Setting> { $SettingFilterComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get key => $composableBuilder( column: $table.key, builder: (column) => ColumnFilters(column)); ColumnFilters get partitionKey => $composableBuilder( column: $table.partitionKey, builder: (column) => ColumnFilters(column)); ColumnFilters get value => $composableBuilder( column: $table.value, builder: (column) => ColumnFilters(column)); } class $SettingOrderingComposer extends Composer<_$UserDatabase, Setting> { $SettingOrderingComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get key => $composableBuilder( column: $table.key, builder: (column) => ColumnOrderings(column)); ColumnOrderings get partitionKey => $composableBuilder( column: $table.partitionKey, builder: (column) => ColumnOrderings(column)); ColumnOrderings get value => $composableBuilder( column: $table.value, builder: (column) => ColumnOrderings(column)); } class $SettingAnnotationComposer extends Composer<_$UserDatabase, Setting> { $SettingAnnotationComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); GeneratedColumn get key => $composableBuilder(column: $table.key, builder: (column) => column); GeneratedColumn get partitionKey => $composableBuilder( column: $table.partitionKey, builder: (column) => column); GeneratedColumn get value => $composableBuilder(column: $table.value, builder: (column) => column); } class $SettingTableManager extends RootTableManager< _$UserDatabase, Setting, SettingData, $SettingFilterComposer, $SettingOrderingComposer, $SettingAnnotationComposer, $SettingCreateCompanionBuilder, $SettingUpdateCompanionBuilder, (SettingData, BaseReferences<_$UserDatabase, Setting, SettingData>), SettingData, PrefetchHooks Function()> { $SettingTableManager(_$UserDatabase db, Setting table) : super(TableManagerState( db: db, table: table, createFilteringComposer: () => $SettingFilterComposer($db: db, $table: table), createOrderingComposer: () => $SettingOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => $SettingAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value key = const Value.absent(), Value partitionKey = const Value.absent(), Value value = const Value.absent(), Value rowid = const Value.absent(), }) => SettingCompanion( key: key, partitionKey: partitionKey, value: value, rowid: rowid, ), createCompanionCallback: ({ required String key, Value partitionKey = const Value.absent(), Value value = const Value.absent(), Value rowid = const Value.absent(), }) => SettingCompanion.insert( key: key, partitionKey: partitionKey, value: value, rowid: rowid, ), withReferenceMapper: (p0) => p0 .map((e) => (e.readTable(table), BaseReferences(db, table, e))) .toList(), prefetchHooksCallback: null, )); } typedef $SettingProcessedTableManager = ProcessedTableManager< _$UserDatabase, Setting, SettingData, $SettingFilterComposer, $SettingOrderingComposer, $SettingAnnotationComposer, $SettingCreateCompanionBuilder, $SettingUpdateCompanionBuilder, (SettingData, BaseReferences<_$UserDatabase, Setting, SettingData>), SettingData, PrefetchHooks Function()>; typedef $IconCacheCreateCompanionBuilder = IconCacheCompanion Function({ required String origin, required Uint8List iconData, required DateTime fetchDate, Value rowid, }); typedef $IconCacheUpdateCompanionBuilder = IconCacheCompanion Function({ Value origin, Value iconData, Value fetchDate, Value rowid, }); class $IconCacheFilterComposer extends Composer<_$UserDatabase, IconCache> { $IconCacheFilterComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnFilters get origin => $composableBuilder( column: $table.origin, builder: (column) => ColumnFilters(column)); ColumnFilters get iconData => $composableBuilder( column: $table.iconData, builder: (column) => ColumnFilters(column)); ColumnFilters get fetchDate => $composableBuilder( column: $table.fetchDate, builder: (column) => ColumnFilters(column)); } class $IconCacheOrderingComposer extends Composer<_$UserDatabase, IconCache> { $IconCacheOrderingComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); ColumnOrderings get origin => $composableBuilder( column: $table.origin, builder: (column) => ColumnOrderings(column)); ColumnOrderings get iconData => $composableBuilder( column: $table.iconData, builder: (column) => ColumnOrderings(column)); ColumnOrderings get fetchDate => $composableBuilder( column: $table.fetchDate, builder: (column) => ColumnOrderings(column)); } class $IconCacheAnnotationComposer extends Composer<_$UserDatabase, IconCache> { $IconCacheAnnotationComposer({ required super.$db, required super.$table, super.joinBuilder, super.$addJoinBuilderToRootComposer, super.$removeJoinBuilderFromRootComposer, }); GeneratedColumn get origin => $composableBuilder(column: $table.origin, builder: (column) => column); GeneratedColumn get iconData => $composableBuilder(column: $table.iconData, builder: (column) => column); GeneratedColumn get fetchDate => $composableBuilder(column: $table.fetchDate, builder: (column) => column); } class $IconCacheTableManager extends RootTableManager< _$UserDatabase, IconCache, IconCacheData, $IconCacheFilterComposer, $IconCacheOrderingComposer, $IconCacheAnnotationComposer, $IconCacheCreateCompanionBuilder, $IconCacheUpdateCompanionBuilder, (IconCacheData, BaseReferences<_$UserDatabase, IconCache, IconCacheData>), IconCacheData, PrefetchHooks Function()> { $IconCacheTableManager(_$UserDatabase db, IconCache table) : super(TableManagerState( db: db, table: table, createFilteringComposer: () => $IconCacheFilterComposer($db: db, $table: table), createOrderingComposer: () => $IconCacheOrderingComposer($db: db, $table: table), createComputedFieldComposer: () => $IconCacheAnnotationComposer($db: db, $table: table), updateCompanionCallback: ({ Value origin = const Value.absent(), Value iconData = const Value.absent(), Value fetchDate = const Value.absent(), Value rowid = const Value.absent(), }) => IconCacheCompanion( origin: origin, iconData: iconData, fetchDate: fetchDate, rowid: rowid, ), createCompanionCallback: ({ required String origin, required Uint8List iconData, required DateTime fetchDate, Value rowid = const Value.absent(), }) => IconCacheCompanion.insert( origin: origin, iconData: iconData, fetchDate: fetchDate, rowid: rowid, ), withReferenceMapper: (p0) => p0 .map((e) => (e.readTable(table), BaseReferences(db, table, e))) .toList(), prefetchHooksCallback: null, )); } typedef $IconCacheProcessedTableManager = ProcessedTableManager< _$UserDatabase, IconCache, IconCacheData, $IconCacheFilterComposer, $IconCacheOrderingComposer, $IconCacheAnnotationComposer, $IconCacheCreateCompanionBuilder, $IconCacheUpdateCompanionBuilder, (IconCacheData, BaseReferences<_$UserDatabase, IconCache, IconCacheData>), IconCacheData, PrefetchHooks Function()>; class $UserDatabaseManager { final _$UserDatabase _db; $UserDatabaseManager(this._db); $SettingTableManager get setting => $SettingTableManager(_db, _db.setting); $IconCacheTableManager get iconCache => $IconCacheTableManager(_db, _db.iconCache); }