mnemo_cards/mnemo_cards_backend/lib/database/database.g.dart
Dmitry 3d179c95ef
Some checks are pending
Backend CI / test (push) Waiting to run
Backend CI / build (push) Blocked by required conditions
Web App CI / test (push) Waiting to run
Web App CI / build (push) Blocked by required conditions
Deploy Admin Panel / Deploy Admin Panel (push) Waiting to run
Deploy Admin Panel / Admin Panel Verification (push) Blocked by required conditions
Deploy Mnemo Cards / Deploy Backend (push) Waiting to run
Deploy Mnemo Cards / Deploy Web App (push) Blocked by required conditions
Deploy Mnemo Cards / Final Verification (push) Blocked by required conditions
stuff
2025-12-17 03:41:47 +03:00

35310 lines
1.1 MiB

// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'database.dart';
// ignore_for_file: type=lint
class $UsersTable extends Users with TableInfo<$UsersTable, User> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$UsersTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _externalUserIdMeta = const VerificationMeta(
'externalUserId',
);
@override
late final GeneratedColumn<String> externalUserId = GeneratedColumn<String>(
'external_user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
);
static const VerificationMeta _nameMeta = const VerificationMeta('name');
@override
late final GeneratedColumn<String> name = GeneratedColumn<String>(
'name',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _emailMeta = const VerificationMeta('email');
@override
late final GeneratedColumn<String> email = GeneratedColumn<String>(
'email',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _adminMeta = const VerificationMeta('admin');
@override
late final GeneratedColumn<bool> admin = GeneratedColumn<bool>(
'admin',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _userSettingsMeta = const VerificationMeta(
'userSettings',
);
@override
late final GeneratedColumn<String> userSettings = GeneratedColumn<String>(
'user_settings',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
@override
late final GeneratedColumnWithTypeConverter<List<String>, String> purchases =
GeneratedColumn<String>(
'purchases',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
).withConverter<List<String>>($UsersTable.$converterpurchases);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
@override
List<GeneratedColumn> get $columns => [
id,
externalUserId,
name,
email,
admin,
userSettings,
purchases,
createdAt,
updatedAt,
isDeleted,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'users';
@override
VerificationContext validateIntegrity(
Insertable<User> 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('external_user_id')) {
context.handle(
_externalUserIdMeta,
externalUserId.isAcceptableOrUnknown(
data['external_user_id']!,
_externalUserIdMeta,
),
);
} else if (isInserting) {
context.missing(_externalUserIdMeta);
}
if (data.containsKey('name')) {
context.handle(
_nameMeta,
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
);
}
if (data.containsKey('email')) {
context.handle(
_emailMeta,
email.isAcceptableOrUnknown(data['email']!, _emailMeta),
);
}
if (data.containsKey('admin')) {
context.handle(
_adminMeta,
admin.isAcceptableOrUnknown(data['admin']!, _adminMeta),
);
}
if (data.containsKey('user_settings')) {
context.handle(
_userSettingsMeta,
userSettings.isAcceptableOrUnknown(
data['user_settings']!,
_userSettingsMeta,
),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
User map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return User(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
externalUserId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}external_user_id'],
)!,
name: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}name'],
),
email: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}email'],
),
admin: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}admin'],
)!,
userSettings: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_settings'],
),
purchases: $UsersTable.$converterpurchases.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}purchases'],
),
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
);
}
@override
$UsersTable createAlias(String alias) {
return $UsersTable(attachedDatabase, alias);
}
static TypeConverter<List<String>, String?> $converterpurchases =
const StringListConverter();
}
class User extends DataClass implements Insertable<User> {
final String id;
final String externalUserId;
final String? name;
final String? email;
final bool admin;
final String? userSettings;
final List<String> purchases;
final PgDateTime createdAt;
final PgDateTime updatedAt;
final bool isDeleted;
const User({
required this.id,
required this.externalUserId,
this.name,
this.email,
required this.admin,
this.userSettings,
required this.purchases,
required this.createdAt,
required this.updatedAt,
required this.isDeleted,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['external_user_id'] = Variable<String>(externalUserId);
if (!nullToAbsent || name != null) {
map['name'] = Variable<String>(name);
}
if (!nullToAbsent || email != null) {
map['email'] = Variable<String>(email);
}
map['admin'] = Variable<bool>(admin);
if (!nullToAbsent || userSettings != null) {
map['user_settings'] = Variable<String>(userSettings);
}
{
map['purchases'] = Variable<String>(
$UsersTable.$converterpurchases.toSql(purchases),
);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
return map;
}
UsersCompanion toCompanion(bool nullToAbsent) {
return UsersCompanion(
id: Value(id),
externalUserId: Value(externalUserId),
name: name == null && nullToAbsent ? const Value.absent() : Value(name),
email: email == null && nullToAbsent
? const Value.absent()
: Value(email),
admin: Value(admin),
userSettings: userSettings == null && nullToAbsent
? const Value.absent()
: Value(userSettings),
purchases: Value(purchases),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
isDeleted: Value(isDeleted),
);
}
factory User.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return User(
id: serializer.fromJson<String>(json['id']),
externalUserId: serializer.fromJson<String>(json['externalUserId']),
name: serializer.fromJson<String?>(json['name']),
email: serializer.fromJson<String?>(json['email']),
admin: serializer.fromJson<bool>(json['admin']),
userSettings: serializer.fromJson<String?>(json['userSettings']),
purchases: serializer.fromJson<List<String>>(json['purchases']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'externalUserId': serializer.toJson<String>(externalUserId),
'name': serializer.toJson<String?>(name),
'email': serializer.toJson<String?>(email),
'admin': serializer.toJson<bool>(admin),
'userSettings': serializer.toJson<String?>(userSettings),
'purchases': serializer.toJson<List<String>>(purchases),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
};
}
User copyWith({
String? id,
String? externalUserId,
Value<String?> name = const Value.absent(),
Value<String?> email = const Value.absent(),
bool? admin,
Value<String?> userSettings = const Value.absent(),
List<String>? purchases,
PgDateTime? createdAt,
PgDateTime? updatedAt,
bool? isDeleted,
}) => User(
id: id ?? this.id,
externalUserId: externalUserId ?? this.externalUserId,
name: name.present ? name.value : this.name,
email: email.present ? email.value : this.email,
admin: admin ?? this.admin,
userSettings: userSettings.present ? userSettings.value : this.userSettings,
purchases: purchases ?? this.purchases,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
);
User copyWithCompanion(UsersCompanion data) {
return User(
id: data.id.present ? data.id.value : this.id,
externalUserId: data.externalUserId.present
? data.externalUserId.value
: this.externalUserId,
name: data.name.present ? data.name.value : this.name,
email: data.email.present ? data.email.value : this.email,
admin: data.admin.present ? data.admin.value : this.admin,
userSettings: data.userSettings.present
? data.userSettings.value
: this.userSettings,
purchases: data.purchases.present ? data.purchases.value : this.purchases,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
);
}
@override
String toString() {
return (StringBuffer('User(')
..write('id: $id, ')
..write('externalUserId: $externalUserId, ')
..write('name: $name, ')
..write('email: $email, ')
..write('admin: $admin, ')
..write('userSettings: $userSettings, ')
..write('purchases: $purchases, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
externalUserId,
name,
email,
admin,
userSettings,
purchases,
createdAt,
updatedAt,
isDeleted,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is User &&
other.id == this.id &&
other.externalUserId == this.externalUserId &&
other.name == this.name &&
other.email == this.email &&
other.admin == this.admin &&
other.userSettings == this.userSettings &&
other.purchases == this.purchases &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt &&
other.isDeleted == this.isDeleted);
}
class UsersCompanion extends UpdateCompanion<User> {
final Value<String> id;
final Value<String> externalUserId;
final Value<String?> name;
final Value<String?> email;
final Value<bool> admin;
final Value<String?> userSettings;
final Value<List<String>> purchases;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<bool> isDeleted;
final Value<int> rowid;
const UsersCompanion({
this.id = const Value.absent(),
this.externalUserId = const Value.absent(),
this.name = const Value.absent(),
this.email = const Value.absent(),
this.admin = const Value.absent(),
this.userSettings = const Value.absent(),
this.purchases = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.rowid = const Value.absent(),
});
UsersCompanion.insert({
this.id = const Value.absent(),
required String externalUserId,
this.name = const Value.absent(),
this.email = const Value.absent(),
this.admin = const Value.absent(),
this.userSettings = const Value.absent(),
this.purchases = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.rowid = const Value.absent(),
}) : externalUserId = Value(externalUserId);
static Insertable<User> custom({
Expression<String>? id,
Expression<String>? externalUserId,
Expression<String>? name,
Expression<String>? email,
Expression<bool>? admin,
Expression<String>? userSettings,
Expression<String>? purchases,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<bool>? isDeleted,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (externalUserId != null) 'external_user_id': externalUserId,
if (name != null) 'name': name,
if (email != null) 'email': email,
if (admin != null) 'admin': admin,
if (userSettings != null) 'user_settings': userSettings,
if (purchases != null) 'purchases': purchases,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (rowid != null) 'rowid': rowid,
});
}
UsersCompanion copyWith({
Value<String>? id,
Value<String>? externalUserId,
Value<String?>? name,
Value<String?>? email,
Value<bool>? admin,
Value<String?>? userSettings,
Value<List<String>>? purchases,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<bool>? isDeleted,
Value<int>? rowid,
}) {
return UsersCompanion(
id: id ?? this.id,
externalUserId: externalUserId ?? this.externalUserId,
name: name ?? this.name,
email: email ?? this.email,
admin: admin ?? this.admin,
userSettings: userSettings ?? this.userSettings,
purchases: purchases ?? this.purchases,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (externalUserId.present) {
map['external_user_id'] = Variable<String>(externalUserId.value);
}
if (name.present) {
map['name'] = Variable<String>(name.value);
}
if (email.present) {
map['email'] = Variable<String>(email.value);
}
if (admin.present) {
map['admin'] = Variable<bool>(admin.value);
}
if (userSettings.present) {
map['user_settings'] = Variable<String>(userSettings.value);
}
if (purchases.present) {
map['purchases'] = Variable<String>(
$UsersTable.$converterpurchases.toSql(purchases.value),
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('UsersCompanion(')
..write('id: $id, ')
..write('externalUserId: $externalUserId, ')
..write('name: $name, ')
..write('email: $email, ')
..write('admin: $admin, ')
..write('userSettings: $userSettings, ')
..write('purchases: $purchases, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $UserDatasTable extends UserDatas
with TableInfo<$UserDatasTable, UserData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$UserDatasTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'UNIQUE REFERENCES users (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _totalStudyTimeMinutesMeta =
const VerificationMeta('totalStudyTimeMinutes');
@override
late final GeneratedColumn<int> totalStudyTimeMinutes = GeneratedColumn<int>(
'total_study_time_minutes',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _currentStreakMeta = const VerificationMeta(
'currentStreak',
);
@override
late final GeneratedColumn<int> currentStreak = GeneratedColumn<int>(
'current_streak',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _longestStreakMeta = const VerificationMeta(
'longestStreak',
);
@override
late final GeneratedColumn<int> longestStreak = GeneratedColumn<int>(
'longest_streak',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _totalCardsMeta = const VerificationMeta(
'totalCards',
);
@override
late final GeneratedColumn<int> totalCards = GeneratedColumn<int>(
'total_cards',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _totalTestsMeta = const VerificationMeta(
'totalTests',
);
@override
late final GeneratedColumn<int> totalTests = GeneratedColumn<int>(
'total_tests',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _lastTimeOnlineMeta = const VerificationMeta(
'lastTimeOnline',
);
@override
late final GeneratedColumn<PgDateTime> lastTimeOnline =
GeneratedColumn<PgDateTime>(
'last_time_online',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
static const VerificationMeta _registrationDateMeta = const VerificationMeta(
'registrationDate',
);
@override
late final GeneratedColumn<PgDateTime> registrationDate =
GeneratedColumn<PgDateTime>(
'registration_date',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _lastTestSessionTokenMeta =
const VerificationMeta('lastTestSessionToken');
@override
late final GeneratedColumn<String> lastTestSessionToken =
GeneratedColumn<String>(
'last_test_session_token',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
@override
late final GeneratedColumnWithTypeConverter<List<String>, String> tags =
GeneratedColumn<String>(
'tags',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
).withConverter<List<String>>($UserDatasTable.$convertertags);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
@override
List<GeneratedColumn> get $columns => [
id,
userId,
totalStudyTimeMinutes,
currentStreak,
longestStreak,
totalCards,
totalTests,
lastTimeOnline,
registrationDate,
lastTestSessionToken,
tags,
createdAt,
updatedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'user_datas';
@override
VerificationContext validateIntegrity(
Insertable<UserData> 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('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('total_study_time_minutes')) {
context.handle(
_totalStudyTimeMinutesMeta,
totalStudyTimeMinutes.isAcceptableOrUnknown(
data['total_study_time_minutes']!,
_totalStudyTimeMinutesMeta,
),
);
}
if (data.containsKey('current_streak')) {
context.handle(
_currentStreakMeta,
currentStreak.isAcceptableOrUnknown(
data['current_streak']!,
_currentStreakMeta,
),
);
}
if (data.containsKey('longest_streak')) {
context.handle(
_longestStreakMeta,
longestStreak.isAcceptableOrUnknown(
data['longest_streak']!,
_longestStreakMeta,
),
);
}
if (data.containsKey('total_cards')) {
context.handle(
_totalCardsMeta,
totalCards.isAcceptableOrUnknown(data['total_cards']!, _totalCardsMeta),
);
}
if (data.containsKey('total_tests')) {
context.handle(
_totalTestsMeta,
totalTests.isAcceptableOrUnknown(data['total_tests']!, _totalTestsMeta),
);
}
if (data.containsKey('last_time_online')) {
context.handle(
_lastTimeOnlineMeta,
lastTimeOnline.isAcceptableOrUnknown(
data['last_time_online']!,
_lastTimeOnlineMeta,
),
);
}
if (data.containsKey('registration_date')) {
context.handle(
_registrationDateMeta,
registrationDate.isAcceptableOrUnknown(
data['registration_date']!,
_registrationDateMeta,
),
);
}
if (data.containsKey('last_test_session_token')) {
context.handle(
_lastTestSessionTokenMeta,
lastTestSessionToken.isAcceptableOrUnknown(
data['last_test_session_token']!,
_lastTestSessionTokenMeta,
),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
UserData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return UserData(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
)!,
totalStudyTimeMinutes: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}total_study_time_minutes'],
)!,
currentStreak: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}current_streak'],
)!,
longestStreak: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}longest_streak'],
)!,
totalCards: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}total_cards'],
)!,
totalTests: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}total_tests'],
)!,
lastTimeOnline: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}last_time_online'],
),
registrationDate: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}registration_date'],
)!,
lastTestSessionToken: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}last_test_session_token'],
),
tags: $UserDatasTable.$convertertags.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}tags'],
)!,
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
);
}
@override
$UserDatasTable createAlias(String alias) {
return $UserDatasTable(attachedDatabase, alias);
}
static TypeConverter<List<String>, String?> $convertertags =
const StringListConverter();
}
class UserData extends DataClass implements Insertable<UserData> {
final String id;
final String userId;
final int totalStudyTimeMinutes;
final int currentStreak;
final int longestStreak;
final int totalCards;
final int totalTests;
final PgDateTime? lastTimeOnline;
final PgDateTime registrationDate;
final String? lastTestSessionToken;
final List<String> tags;
final PgDateTime createdAt;
final PgDateTime updatedAt;
const UserData({
required this.id,
required this.userId,
required this.totalStudyTimeMinutes,
required this.currentStreak,
required this.longestStreak,
required this.totalCards,
required this.totalTests,
this.lastTimeOnline,
required this.registrationDate,
this.lastTestSessionToken,
required this.tags,
required this.createdAt,
required this.updatedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['user_id'] = Variable<String>(userId);
map['total_study_time_minutes'] = Variable<int>(totalStudyTimeMinutes);
map['current_streak'] = Variable<int>(currentStreak);
map['longest_streak'] = Variable<int>(longestStreak);
map['total_cards'] = Variable<int>(totalCards);
map['total_tests'] = Variable<int>(totalTests);
if (!nullToAbsent || lastTimeOnline != null) {
map['last_time_online'] = Variable<PgDateTime>(
lastTimeOnline,
PgTypes.timestampWithTimezone,
);
}
map['registration_date'] = Variable<PgDateTime>(
registrationDate,
PgTypes.timestampWithTimezone,
);
if (!nullToAbsent || lastTestSessionToken != null) {
map['last_test_session_token'] = Variable<String>(lastTestSessionToken);
}
{
map['tags'] = Variable<String>(
$UserDatasTable.$convertertags.toSql(tags),
);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
return map;
}
UserDatasCompanion toCompanion(bool nullToAbsent) {
return UserDatasCompanion(
id: Value(id),
userId: Value(userId),
totalStudyTimeMinutes: Value(totalStudyTimeMinutes),
currentStreak: Value(currentStreak),
longestStreak: Value(longestStreak),
totalCards: Value(totalCards),
totalTests: Value(totalTests),
lastTimeOnline: lastTimeOnline == null && nullToAbsent
? const Value.absent()
: Value(lastTimeOnline),
registrationDate: Value(registrationDate),
lastTestSessionToken: lastTestSessionToken == null && nullToAbsent
? const Value.absent()
: Value(lastTestSessionToken),
tags: Value(tags),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
);
}
factory UserData.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return UserData(
id: serializer.fromJson<String>(json['id']),
userId: serializer.fromJson<String>(json['userId']),
totalStudyTimeMinutes: serializer.fromJson<int>(
json['totalStudyTimeMinutes'],
),
currentStreak: serializer.fromJson<int>(json['currentStreak']),
longestStreak: serializer.fromJson<int>(json['longestStreak']),
totalCards: serializer.fromJson<int>(json['totalCards']),
totalTests: serializer.fromJson<int>(json['totalTests']),
lastTimeOnline: serializer.fromJson<PgDateTime?>(json['lastTimeOnline']),
registrationDate: serializer.fromJson<PgDateTime>(
json['registrationDate'],
),
lastTestSessionToken: serializer.fromJson<String?>(
json['lastTestSessionToken'],
),
tags: serializer.fromJson<List<String>>(json['tags']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'userId': serializer.toJson<String>(userId),
'totalStudyTimeMinutes': serializer.toJson<int>(totalStudyTimeMinutes),
'currentStreak': serializer.toJson<int>(currentStreak),
'longestStreak': serializer.toJson<int>(longestStreak),
'totalCards': serializer.toJson<int>(totalCards),
'totalTests': serializer.toJson<int>(totalTests),
'lastTimeOnline': serializer.toJson<PgDateTime?>(lastTimeOnline),
'registrationDate': serializer.toJson<PgDateTime>(registrationDate),
'lastTestSessionToken': serializer.toJson<String?>(lastTestSessionToken),
'tags': serializer.toJson<List<String>>(tags),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
};
}
UserData copyWith({
String? id,
String? userId,
int? totalStudyTimeMinutes,
int? currentStreak,
int? longestStreak,
int? totalCards,
int? totalTests,
Value<PgDateTime?> lastTimeOnline = const Value.absent(),
PgDateTime? registrationDate,
Value<String?> lastTestSessionToken = const Value.absent(),
List<String>? tags,
PgDateTime? createdAt,
PgDateTime? updatedAt,
}) => UserData(
id: id ?? this.id,
userId: userId ?? this.userId,
totalStudyTimeMinutes: totalStudyTimeMinutes ?? this.totalStudyTimeMinutes,
currentStreak: currentStreak ?? this.currentStreak,
longestStreak: longestStreak ?? this.longestStreak,
totalCards: totalCards ?? this.totalCards,
totalTests: totalTests ?? this.totalTests,
lastTimeOnline: lastTimeOnline.present
? lastTimeOnline.value
: this.lastTimeOnline,
registrationDate: registrationDate ?? this.registrationDate,
lastTestSessionToken: lastTestSessionToken.present
? lastTestSessionToken.value
: this.lastTestSessionToken,
tags: tags ?? this.tags,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
);
UserData copyWithCompanion(UserDatasCompanion data) {
return UserData(
id: data.id.present ? data.id.value : this.id,
userId: data.userId.present ? data.userId.value : this.userId,
totalStudyTimeMinutes: data.totalStudyTimeMinutes.present
? data.totalStudyTimeMinutes.value
: this.totalStudyTimeMinutes,
currentStreak: data.currentStreak.present
? data.currentStreak.value
: this.currentStreak,
longestStreak: data.longestStreak.present
? data.longestStreak.value
: this.longestStreak,
totalCards: data.totalCards.present
? data.totalCards.value
: this.totalCards,
totalTests: data.totalTests.present
? data.totalTests.value
: this.totalTests,
lastTimeOnline: data.lastTimeOnline.present
? data.lastTimeOnline.value
: this.lastTimeOnline,
registrationDate: data.registrationDate.present
? data.registrationDate.value
: this.registrationDate,
lastTestSessionToken: data.lastTestSessionToken.present
? data.lastTestSessionToken.value
: this.lastTestSessionToken,
tags: data.tags.present ? data.tags.value : this.tags,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
);
}
@override
String toString() {
return (StringBuffer('UserData(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('totalStudyTimeMinutes: $totalStudyTimeMinutes, ')
..write('currentStreak: $currentStreak, ')
..write('longestStreak: $longestStreak, ')
..write('totalCards: $totalCards, ')
..write('totalTests: $totalTests, ')
..write('lastTimeOnline: $lastTimeOnline, ')
..write('registrationDate: $registrationDate, ')
..write('lastTestSessionToken: $lastTestSessionToken, ')
..write('tags: $tags, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
userId,
totalStudyTimeMinutes,
currentStreak,
longestStreak,
totalCards,
totalTests,
lastTimeOnline,
registrationDate,
lastTestSessionToken,
tags,
createdAt,
updatedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is UserData &&
other.id == this.id &&
other.userId == this.userId &&
other.totalStudyTimeMinutes == this.totalStudyTimeMinutes &&
other.currentStreak == this.currentStreak &&
other.longestStreak == this.longestStreak &&
other.totalCards == this.totalCards &&
other.totalTests == this.totalTests &&
other.lastTimeOnline == this.lastTimeOnline &&
other.registrationDate == this.registrationDate &&
other.lastTestSessionToken == this.lastTestSessionToken &&
other.tags == this.tags &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt);
}
class UserDatasCompanion extends UpdateCompanion<UserData> {
final Value<String> id;
final Value<String> userId;
final Value<int> totalStudyTimeMinutes;
final Value<int> currentStreak;
final Value<int> longestStreak;
final Value<int> totalCards;
final Value<int> totalTests;
final Value<PgDateTime?> lastTimeOnline;
final Value<PgDateTime> registrationDate;
final Value<String?> lastTestSessionToken;
final Value<List<String>> tags;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<int> rowid;
const UserDatasCompanion({
this.id = const Value.absent(),
this.userId = const Value.absent(),
this.totalStudyTimeMinutes = const Value.absent(),
this.currentStreak = const Value.absent(),
this.longestStreak = const Value.absent(),
this.totalCards = const Value.absent(),
this.totalTests = const Value.absent(),
this.lastTimeOnline = const Value.absent(),
this.registrationDate = const Value.absent(),
this.lastTestSessionToken = const Value.absent(),
this.tags = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
UserDatasCompanion.insert({
this.id = const Value.absent(),
required String userId,
this.totalStudyTimeMinutes = const Value.absent(),
this.currentStreak = const Value.absent(),
this.longestStreak = const Value.absent(),
this.totalCards = const Value.absent(),
this.totalTests = const Value.absent(),
this.lastTimeOnline = const Value.absent(),
this.registrationDate = const Value.absent(),
this.lastTestSessionToken = const Value.absent(),
this.tags = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : userId = Value(userId);
static Insertable<UserData> custom({
Expression<String>? id,
Expression<String>? userId,
Expression<int>? totalStudyTimeMinutes,
Expression<int>? currentStreak,
Expression<int>? longestStreak,
Expression<int>? totalCards,
Expression<int>? totalTests,
Expression<PgDateTime>? lastTimeOnline,
Expression<PgDateTime>? registrationDate,
Expression<String>? lastTestSessionToken,
Expression<String>? tags,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (userId != null) 'user_id': userId,
if (totalStudyTimeMinutes != null)
'total_study_time_minutes': totalStudyTimeMinutes,
if (currentStreak != null) 'current_streak': currentStreak,
if (longestStreak != null) 'longest_streak': longestStreak,
if (totalCards != null) 'total_cards': totalCards,
if (totalTests != null) 'total_tests': totalTests,
if (lastTimeOnline != null) 'last_time_online': lastTimeOnline,
if (registrationDate != null) 'registration_date': registrationDate,
if (lastTestSessionToken != null)
'last_test_session_token': lastTestSessionToken,
if (tags != null) 'tags': tags,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (rowid != null) 'rowid': rowid,
});
}
UserDatasCompanion copyWith({
Value<String>? id,
Value<String>? userId,
Value<int>? totalStudyTimeMinutes,
Value<int>? currentStreak,
Value<int>? longestStreak,
Value<int>? totalCards,
Value<int>? totalTests,
Value<PgDateTime?>? lastTimeOnline,
Value<PgDateTime>? registrationDate,
Value<String?>? lastTestSessionToken,
Value<List<String>>? tags,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<int>? rowid,
}) {
return UserDatasCompanion(
id: id ?? this.id,
userId: userId ?? this.userId,
totalStudyTimeMinutes:
totalStudyTimeMinutes ?? this.totalStudyTimeMinutes,
currentStreak: currentStreak ?? this.currentStreak,
longestStreak: longestStreak ?? this.longestStreak,
totalCards: totalCards ?? this.totalCards,
totalTests: totalTests ?? this.totalTests,
lastTimeOnline: lastTimeOnline ?? this.lastTimeOnline,
registrationDate: registrationDate ?? this.registrationDate,
lastTestSessionToken: lastTestSessionToken ?? this.lastTestSessionToken,
tags: tags ?? this.tags,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (totalStudyTimeMinutes.present) {
map['total_study_time_minutes'] = Variable<int>(
totalStudyTimeMinutes.value,
);
}
if (currentStreak.present) {
map['current_streak'] = Variable<int>(currentStreak.value);
}
if (longestStreak.present) {
map['longest_streak'] = Variable<int>(longestStreak.value);
}
if (totalCards.present) {
map['total_cards'] = Variable<int>(totalCards.value);
}
if (totalTests.present) {
map['total_tests'] = Variable<int>(totalTests.value);
}
if (lastTimeOnline.present) {
map['last_time_online'] = Variable<PgDateTime>(
lastTimeOnline.value,
PgTypes.timestampWithTimezone,
);
}
if (registrationDate.present) {
map['registration_date'] = Variable<PgDateTime>(
registrationDate.value,
PgTypes.timestampWithTimezone,
);
}
if (lastTestSessionToken.present) {
map['last_test_session_token'] = Variable<String>(
lastTestSessionToken.value,
);
}
if (tags.present) {
map['tags'] = Variable<String>(
$UserDatasTable.$convertertags.toSql(tags.value),
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('UserDatasCompanion(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('totalStudyTimeMinutes: $totalStudyTimeMinutes, ')
..write('currentStreak: $currentStreak, ')
..write('longestStreak: $longestStreak, ')
..write('totalCards: $totalCards, ')
..write('totalTests: $totalTests, ')
..write('lastTimeOnline: $lastTimeOnline, ')
..write('registrationDate: $registrationDate, ')
..write('lastTestSessionToken: $lastTestSessionToken, ')
..write('tags: $tags, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $TokensTable extends Tokens with TableInfo<$TokensTable, Token> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$TokensTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES users (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _tokenMeta = const VerificationMeta('token');
@override
late final GeneratedColumn<String> token = GeneratedColumn<String>(
'token',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
);
static const VerificationMeta _externalUserIdMeta = const VerificationMeta(
'externalUserId',
);
@override
late final GeneratedColumn<String> externalUserId = GeneratedColumn<String>(
'external_user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _createdMeta = const VerificationMeta(
'created',
);
@override
late final GeneratedColumn<PgDateTime> created = GeneratedColumn<PgDateTime>(
'created',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _expiresMeta = const VerificationMeta(
'expires',
);
@override
late final GeneratedColumn<PgDateTime> expires = GeneratedColumn<PgDateTime>(
'expires',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: true,
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
);
@override
late final GeneratedColumn<PgDateTime> deletedAt =
GeneratedColumn<PgDateTime>(
'deleted_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
@override
List<GeneratedColumn> get $columns => [
id,
userId,
token,
externalUserId,
created,
expires,
isDeleted,
deletedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'tokens';
@override
VerificationContext validateIntegrity(
Insertable<Token> 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('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('token')) {
context.handle(
_tokenMeta,
token.isAcceptableOrUnknown(data['token']!, _tokenMeta),
);
} else if (isInserting) {
context.missing(_tokenMeta);
}
if (data.containsKey('external_user_id')) {
context.handle(
_externalUserIdMeta,
externalUserId.isAcceptableOrUnknown(
data['external_user_id']!,
_externalUserIdMeta,
),
);
} else if (isInserting) {
context.missing(_externalUserIdMeta);
}
if (data.containsKey('created')) {
context.handle(
_createdMeta,
created.isAcceptableOrUnknown(data['created']!, _createdMeta),
);
}
if (data.containsKey('expires')) {
context.handle(
_expiresMeta,
expires.isAcceptableOrUnknown(data['expires']!, _expiresMeta),
);
} else if (isInserting) {
context.missing(_expiresMeta);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
if (data.containsKey('deleted_at')) {
context.handle(
_deletedAtMeta,
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
Token map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return Token(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
)!,
token: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}token'],
)!,
externalUserId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}external_user_id'],
)!,
created: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created'],
)!,
expires: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}expires'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
deletedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}deleted_at'],
),
);
}
@override
$TokensTable createAlias(String alias) {
return $TokensTable(attachedDatabase, alias);
}
}
class Token extends DataClass implements Insertable<Token> {
final String id;
final String userId;
final String token;
final String externalUserId;
final PgDateTime created;
final PgDateTime expires;
final bool isDeleted;
final PgDateTime? deletedAt;
const Token({
required this.id,
required this.userId,
required this.token,
required this.externalUserId,
required this.created,
required this.expires,
required this.isDeleted,
this.deletedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['user_id'] = Variable<String>(userId);
map['token'] = Variable<String>(token);
map['external_user_id'] = Variable<String>(externalUserId);
map['created'] = Variable<PgDateTime>(
created,
PgTypes.timestampWithTimezone,
);
map['expires'] = Variable<PgDateTime>(
expires,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
if (!nullToAbsent || deletedAt != null) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt,
PgTypes.timestampWithTimezone,
);
}
return map;
}
TokensCompanion toCompanion(bool nullToAbsent) {
return TokensCompanion(
id: Value(id),
userId: Value(userId),
token: Value(token),
externalUserId: Value(externalUserId),
created: Value(created),
expires: Value(expires),
isDeleted: Value(isDeleted),
deletedAt: deletedAt == null && nullToAbsent
? const Value.absent()
: Value(deletedAt),
);
}
factory Token.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return Token(
id: serializer.fromJson<String>(json['id']),
userId: serializer.fromJson<String>(json['userId']),
token: serializer.fromJson<String>(json['token']),
externalUserId: serializer.fromJson<String>(json['externalUserId']),
created: serializer.fromJson<PgDateTime>(json['created']),
expires: serializer.fromJson<PgDateTime>(json['expires']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
deletedAt: serializer.fromJson<PgDateTime?>(json['deletedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'userId': serializer.toJson<String>(userId),
'token': serializer.toJson<String>(token),
'externalUserId': serializer.toJson<String>(externalUserId),
'created': serializer.toJson<PgDateTime>(created),
'expires': serializer.toJson<PgDateTime>(expires),
'isDeleted': serializer.toJson<bool>(isDeleted),
'deletedAt': serializer.toJson<PgDateTime?>(deletedAt),
};
}
Token copyWith({
String? id,
String? userId,
String? token,
String? externalUserId,
PgDateTime? created,
PgDateTime? expires,
bool? isDeleted,
Value<PgDateTime?> deletedAt = const Value.absent(),
}) => Token(
id: id ?? this.id,
userId: userId ?? this.userId,
token: token ?? this.token,
externalUserId: externalUserId ?? this.externalUserId,
created: created ?? this.created,
expires: expires ?? this.expires,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
);
Token copyWithCompanion(TokensCompanion data) {
return Token(
id: data.id.present ? data.id.value : this.id,
userId: data.userId.present ? data.userId.value : this.userId,
token: data.token.present ? data.token.value : this.token,
externalUserId: data.externalUserId.present
? data.externalUserId.value
: this.externalUserId,
created: data.created.present ? data.created.value : this.created,
expires: data.expires.present ? data.expires.value : this.expires,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
);
}
@override
String toString() {
return (StringBuffer('Token(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('token: $token, ')
..write('externalUserId: $externalUserId, ')
..write('created: $created, ')
..write('expires: $expires, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
userId,
token,
externalUserId,
created,
expires,
isDeleted,
deletedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is Token &&
other.id == this.id &&
other.userId == this.userId &&
other.token == this.token &&
other.externalUserId == this.externalUserId &&
other.created == this.created &&
other.expires == this.expires &&
other.isDeleted == this.isDeleted &&
other.deletedAt == this.deletedAt);
}
class TokensCompanion extends UpdateCompanion<Token> {
final Value<String> id;
final Value<String> userId;
final Value<String> token;
final Value<String> externalUserId;
final Value<PgDateTime> created;
final Value<PgDateTime> expires;
final Value<bool> isDeleted;
final Value<PgDateTime?> deletedAt;
final Value<int> rowid;
const TokensCompanion({
this.id = const Value.absent(),
this.userId = const Value.absent(),
this.token = const Value.absent(),
this.externalUserId = const Value.absent(),
this.created = const Value.absent(),
this.expires = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
TokensCompanion.insert({
this.id = const Value.absent(),
required String userId,
required String token,
required String externalUserId,
this.created = const Value.absent(),
required PgDateTime expires,
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : userId = Value(userId),
token = Value(token),
externalUserId = Value(externalUserId),
expires = Value(expires);
static Insertable<Token> custom({
Expression<String>? id,
Expression<String>? userId,
Expression<String>? token,
Expression<String>? externalUserId,
Expression<PgDateTime>? created,
Expression<PgDateTime>? expires,
Expression<bool>? isDeleted,
Expression<PgDateTime>? deletedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (userId != null) 'user_id': userId,
if (token != null) 'token': token,
if (externalUserId != null) 'external_user_id': externalUserId,
if (created != null) 'created': created,
if (expires != null) 'expires': expires,
if (isDeleted != null) 'is_deleted': isDeleted,
if (deletedAt != null) 'deleted_at': deletedAt,
if (rowid != null) 'rowid': rowid,
});
}
TokensCompanion copyWith({
Value<String>? id,
Value<String>? userId,
Value<String>? token,
Value<String>? externalUserId,
Value<PgDateTime>? created,
Value<PgDateTime>? expires,
Value<bool>? isDeleted,
Value<PgDateTime?>? deletedAt,
Value<int>? rowid,
}) {
return TokensCompanion(
id: id ?? this.id,
userId: userId ?? this.userId,
token: token ?? this.token,
externalUserId: externalUserId ?? this.externalUserId,
created: created ?? this.created,
expires: expires ?? this.expires,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt ?? this.deletedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (token.present) {
map['token'] = Variable<String>(token.value);
}
if (externalUserId.present) {
map['external_user_id'] = Variable<String>(externalUserId.value);
}
if (created.present) {
map['created'] = Variable<PgDateTime>(
created.value,
PgTypes.timestampWithTimezone,
);
}
if (expires.present) {
map['expires'] = Variable<PgDateTime>(
expires.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (deletedAt.present) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('TokensCompanion(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('token: $token, ')
..write('externalUserId: $externalUserId, ')
..write('created: $created, ')
..write('expires: $expires, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $RefreshTokensTable extends RefreshTokens
with TableInfo<$RefreshTokensTable, RefreshToken> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$RefreshTokensTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES users (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _jtiMeta = const VerificationMeta('jti');
@override
late final GeneratedColumn<String> jti = GeneratedColumn<String>(
'jti',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
);
static const VerificationMeta _isBlacklistedMeta = const VerificationMeta(
'isBlacklisted',
);
@override
late final GeneratedColumn<bool> isBlacklisted = GeneratedColumn<bool>(
'is_blacklisted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _expiresAtMeta = const VerificationMeta(
'expiresAt',
);
@override
late final GeneratedColumn<PgDateTime> expiresAt =
GeneratedColumn<PgDateTime>(
'expires_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: true,
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
);
@override
late final GeneratedColumn<PgDateTime> deletedAt =
GeneratedColumn<PgDateTime>(
'deleted_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
@override
List<GeneratedColumn> get $columns => [
id,
userId,
jti,
isBlacklisted,
createdAt,
expiresAt,
isDeleted,
deletedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'refresh_tokens';
@override
VerificationContext validateIntegrity(
Insertable<RefreshToken> 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('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('jti')) {
context.handle(
_jtiMeta,
jti.isAcceptableOrUnknown(data['jti']!, _jtiMeta),
);
} else if (isInserting) {
context.missing(_jtiMeta);
}
if (data.containsKey('is_blacklisted')) {
context.handle(
_isBlacklistedMeta,
isBlacklisted.isAcceptableOrUnknown(
data['is_blacklisted']!,
_isBlacklistedMeta,
),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('expires_at')) {
context.handle(
_expiresAtMeta,
expiresAt.isAcceptableOrUnknown(data['expires_at']!, _expiresAtMeta),
);
} else if (isInserting) {
context.missing(_expiresAtMeta);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
if (data.containsKey('deleted_at')) {
context.handle(
_deletedAtMeta,
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
RefreshToken map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return RefreshToken(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
)!,
jti: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}jti'],
)!,
isBlacklisted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_blacklisted'],
)!,
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
expiresAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}expires_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
deletedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}deleted_at'],
),
);
}
@override
$RefreshTokensTable createAlias(String alias) {
return $RefreshTokensTable(attachedDatabase, alias);
}
}
class RefreshToken extends DataClass implements Insertable<RefreshToken> {
final String id;
final String userId;
final String jti;
final bool isBlacklisted;
final PgDateTime createdAt;
final PgDateTime expiresAt;
final bool isDeleted;
final PgDateTime? deletedAt;
const RefreshToken({
required this.id,
required this.userId,
required this.jti,
required this.isBlacklisted,
required this.createdAt,
required this.expiresAt,
required this.isDeleted,
this.deletedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['user_id'] = Variable<String>(userId);
map['jti'] = Variable<String>(jti);
map['is_blacklisted'] = Variable<bool>(isBlacklisted);
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['expires_at'] = Variable<PgDateTime>(
expiresAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
if (!nullToAbsent || deletedAt != null) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt,
PgTypes.timestampWithTimezone,
);
}
return map;
}
RefreshTokensCompanion toCompanion(bool nullToAbsent) {
return RefreshTokensCompanion(
id: Value(id),
userId: Value(userId),
jti: Value(jti),
isBlacklisted: Value(isBlacklisted),
createdAt: Value(createdAt),
expiresAt: Value(expiresAt),
isDeleted: Value(isDeleted),
deletedAt: deletedAt == null && nullToAbsent
? const Value.absent()
: Value(deletedAt),
);
}
factory RefreshToken.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return RefreshToken(
id: serializer.fromJson<String>(json['id']),
userId: serializer.fromJson<String>(json['userId']),
jti: serializer.fromJson<String>(json['jti']),
isBlacklisted: serializer.fromJson<bool>(json['isBlacklisted']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
expiresAt: serializer.fromJson<PgDateTime>(json['expiresAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
deletedAt: serializer.fromJson<PgDateTime?>(json['deletedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'userId': serializer.toJson<String>(userId),
'jti': serializer.toJson<String>(jti),
'isBlacklisted': serializer.toJson<bool>(isBlacklisted),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'expiresAt': serializer.toJson<PgDateTime>(expiresAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
'deletedAt': serializer.toJson<PgDateTime?>(deletedAt),
};
}
RefreshToken copyWith({
String? id,
String? userId,
String? jti,
bool? isBlacklisted,
PgDateTime? createdAt,
PgDateTime? expiresAt,
bool? isDeleted,
Value<PgDateTime?> deletedAt = const Value.absent(),
}) => RefreshToken(
id: id ?? this.id,
userId: userId ?? this.userId,
jti: jti ?? this.jti,
isBlacklisted: isBlacklisted ?? this.isBlacklisted,
createdAt: createdAt ?? this.createdAt,
expiresAt: expiresAt ?? this.expiresAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
);
RefreshToken copyWithCompanion(RefreshTokensCompanion data) {
return RefreshToken(
id: data.id.present ? data.id.value : this.id,
userId: data.userId.present ? data.userId.value : this.userId,
jti: data.jti.present ? data.jti.value : this.jti,
isBlacklisted: data.isBlacklisted.present
? data.isBlacklisted.value
: this.isBlacklisted,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
expiresAt: data.expiresAt.present ? data.expiresAt.value : this.expiresAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
);
}
@override
String toString() {
return (StringBuffer('RefreshToken(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('jti: $jti, ')
..write('isBlacklisted: $isBlacklisted, ')
..write('createdAt: $createdAt, ')
..write('expiresAt: $expiresAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
userId,
jti,
isBlacklisted,
createdAt,
expiresAt,
isDeleted,
deletedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is RefreshToken &&
other.id == this.id &&
other.userId == this.userId &&
other.jti == this.jti &&
other.isBlacklisted == this.isBlacklisted &&
other.createdAt == this.createdAt &&
other.expiresAt == this.expiresAt &&
other.isDeleted == this.isDeleted &&
other.deletedAt == this.deletedAt);
}
class RefreshTokensCompanion extends UpdateCompanion<RefreshToken> {
final Value<String> id;
final Value<String> userId;
final Value<String> jti;
final Value<bool> isBlacklisted;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> expiresAt;
final Value<bool> isDeleted;
final Value<PgDateTime?> deletedAt;
final Value<int> rowid;
const RefreshTokensCompanion({
this.id = const Value.absent(),
this.userId = const Value.absent(),
this.jti = const Value.absent(),
this.isBlacklisted = const Value.absent(),
this.createdAt = const Value.absent(),
this.expiresAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
RefreshTokensCompanion.insert({
this.id = const Value.absent(),
required String userId,
required String jti,
this.isBlacklisted = const Value.absent(),
this.createdAt = const Value.absent(),
required PgDateTime expiresAt,
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : userId = Value(userId),
jti = Value(jti),
expiresAt = Value(expiresAt);
static Insertable<RefreshToken> custom({
Expression<String>? id,
Expression<String>? userId,
Expression<String>? jti,
Expression<bool>? isBlacklisted,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? expiresAt,
Expression<bool>? isDeleted,
Expression<PgDateTime>? deletedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (userId != null) 'user_id': userId,
if (jti != null) 'jti': jti,
if (isBlacklisted != null) 'is_blacklisted': isBlacklisted,
if (createdAt != null) 'created_at': createdAt,
if (expiresAt != null) 'expires_at': expiresAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (deletedAt != null) 'deleted_at': deletedAt,
if (rowid != null) 'rowid': rowid,
});
}
RefreshTokensCompanion copyWith({
Value<String>? id,
Value<String>? userId,
Value<String>? jti,
Value<bool>? isBlacklisted,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? expiresAt,
Value<bool>? isDeleted,
Value<PgDateTime?>? deletedAt,
Value<int>? rowid,
}) {
return RefreshTokensCompanion(
id: id ?? this.id,
userId: userId ?? this.userId,
jti: jti ?? this.jti,
isBlacklisted: isBlacklisted ?? this.isBlacklisted,
createdAt: createdAt ?? this.createdAt,
expiresAt: expiresAt ?? this.expiresAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt ?? this.deletedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (jti.present) {
map['jti'] = Variable<String>(jti.value);
}
if (isBlacklisted.present) {
map['is_blacklisted'] = Variable<bool>(isBlacklisted.value);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (expiresAt.present) {
map['expires_at'] = Variable<PgDateTime>(
expiresAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (deletedAt.present) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('RefreshTokensCompanion(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('jti: $jti, ')
..write('isBlacklisted: $isBlacklisted, ')
..write('createdAt: $createdAt, ')
..write('expiresAt: $expiresAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $TelegramAuthCodesTable extends TelegramAuthCodes
with TableInfo<$TelegramAuthCodesTable, TelegramAuthCode> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$TelegramAuthCodesTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _codeMeta = const VerificationMeta('code');
@override
late final GeneratedColumn<String> code = GeneratedColumn<String>(
'code',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
);
static const VerificationMeta _telegramUserIdMeta = const VerificationMeta(
'telegramUserId',
);
@override
late final GeneratedColumn<String> telegramUserId = GeneratedColumn<String>(
'telegram_user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _telegramUsernameMeta = const VerificationMeta(
'telegramUsername',
);
@override
late final GeneratedColumn<String> telegramUsername = GeneratedColumn<String>(
'telegram_username',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _firstNameMeta = const VerificationMeta(
'firstName',
);
@override
late final GeneratedColumn<String> firstName = GeneratedColumn<String>(
'first_name',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _lastNameMeta = const VerificationMeta(
'lastName',
);
@override
late final GeneratedColumn<String> lastName = GeneratedColumn<String>(
'last_name',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _isUsedMeta = const VerificationMeta('isUsed');
@override
late final GeneratedColumn<bool> isUsed = GeneratedColumn<bool>(
'is_used',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: '',
defaultValue: const Constant(false),
);
static const VerificationMeta _usedAtMeta = const VerificationMeta('usedAt');
@override
late final GeneratedColumn<PgDateTime> usedAt = GeneratedColumn<PgDateTime>(
'used_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _expiresAtMeta = const VerificationMeta(
'expiresAt',
);
@override
late final GeneratedColumn<PgDateTime> expiresAt =
GeneratedColumn<PgDateTime>(
'expires_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: true,
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
);
@override
late final GeneratedColumn<PgDateTime> deletedAt =
GeneratedColumn<PgDateTime>(
'deleted_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
@override
List<GeneratedColumn> get $columns => [
id,
code,
telegramUserId,
telegramUsername,
firstName,
lastName,
isUsed,
usedAt,
createdAt,
expiresAt,
isDeleted,
deletedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'telegram_auth_codes';
@override
VerificationContext validateIntegrity(
Insertable<TelegramAuthCode> 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('code')) {
context.handle(
_codeMeta,
code.isAcceptableOrUnknown(data['code']!, _codeMeta),
);
} else if (isInserting) {
context.missing(_codeMeta);
}
if (data.containsKey('telegram_user_id')) {
context.handle(
_telegramUserIdMeta,
telegramUserId.isAcceptableOrUnknown(
data['telegram_user_id']!,
_telegramUserIdMeta,
),
);
} else if (isInserting) {
context.missing(_telegramUserIdMeta);
}
if (data.containsKey('telegram_username')) {
context.handle(
_telegramUsernameMeta,
telegramUsername.isAcceptableOrUnknown(
data['telegram_username']!,
_telegramUsernameMeta,
),
);
}
if (data.containsKey('first_name')) {
context.handle(
_firstNameMeta,
firstName.isAcceptableOrUnknown(data['first_name']!, _firstNameMeta),
);
}
if (data.containsKey('last_name')) {
context.handle(
_lastNameMeta,
lastName.isAcceptableOrUnknown(data['last_name']!, _lastNameMeta),
);
}
if (data.containsKey('is_used')) {
context.handle(
_isUsedMeta,
isUsed.isAcceptableOrUnknown(data['is_used']!, _isUsedMeta),
);
}
if (data.containsKey('used_at')) {
context.handle(
_usedAtMeta,
usedAt.isAcceptableOrUnknown(data['used_at']!, _usedAtMeta),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('expires_at')) {
context.handle(
_expiresAtMeta,
expiresAt.isAcceptableOrUnknown(data['expires_at']!, _expiresAtMeta),
);
} else if (isInserting) {
context.missing(_expiresAtMeta);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
if (data.containsKey('deleted_at')) {
context.handle(
_deletedAtMeta,
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
TelegramAuthCode map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return TelegramAuthCode(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
code: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}code'],
)!,
telegramUserId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}telegram_user_id'],
)!,
telegramUsername: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}telegram_username'],
),
firstName: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}first_name'],
),
lastName: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}last_name'],
),
isUsed: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_used'],
)!,
usedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}used_at'],
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
expiresAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}expires_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
deletedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}deleted_at'],
),
);
}
@override
$TelegramAuthCodesTable createAlias(String alias) {
return $TelegramAuthCodesTable(attachedDatabase, alias);
}
}
class TelegramAuthCode extends DataClass
implements Insertable<TelegramAuthCode> {
final String id;
final String code;
final String telegramUserId;
final String? telegramUsername;
final String? firstName;
final String? lastName;
final bool isUsed;
final PgDateTime? usedAt;
final PgDateTime createdAt;
final PgDateTime expiresAt;
final bool isDeleted;
final PgDateTime? deletedAt;
const TelegramAuthCode({
required this.id,
required this.code,
required this.telegramUserId,
this.telegramUsername,
this.firstName,
this.lastName,
required this.isUsed,
this.usedAt,
required this.createdAt,
required this.expiresAt,
required this.isDeleted,
this.deletedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['code'] = Variable<String>(code);
map['telegram_user_id'] = Variable<String>(telegramUserId);
if (!nullToAbsent || telegramUsername != null) {
map['telegram_username'] = Variable<String>(telegramUsername);
}
if (!nullToAbsent || firstName != null) {
map['first_name'] = Variable<String>(firstName);
}
if (!nullToAbsent || lastName != null) {
map['last_name'] = Variable<String>(lastName);
}
map['is_used'] = Variable<bool>(isUsed);
if (!nullToAbsent || usedAt != null) {
map['used_at'] = Variable<PgDateTime>(
usedAt,
PgTypes.timestampWithTimezone,
);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['expires_at'] = Variable<PgDateTime>(
expiresAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
if (!nullToAbsent || deletedAt != null) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt,
PgTypes.timestampWithTimezone,
);
}
return map;
}
TelegramAuthCodesCompanion toCompanion(bool nullToAbsent) {
return TelegramAuthCodesCompanion(
id: Value(id),
code: Value(code),
telegramUserId: Value(telegramUserId),
telegramUsername: telegramUsername == null && nullToAbsent
? const Value.absent()
: Value(telegramUsername),
firstName: firstName == null && nullToAbsent
? const Value.absent()
: Value(firstName),
lastName: lastName == null && nullToAbsent
? const Value.absent()
: Value(lastName),
isUsed: Value(isUsed),
usedAt: usedAt == null && nullToAbsent
? const Value.absent()
: Value(usedAt),
createdAt: Value(createdAt),
expiresAt: Value(expiresAt),
isDeleted: Value(isDeleted),
deletedAt: deletedAt == null && nullToAbsent
? const Value.absent()
: Value(deletedAt),
);
}
factory TelegramAuthCode.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return TelegramAuthCode(
id: serializer.fromJson<String>(json['id']),
code: serializer.fromJson<String>(json['code']),
telegramUserId: serializer.fromJson<String>(json['telegramUserId']),
telegramUsername: serializer.fromJson<String?>(json['telegramUsername']),
firstName: serializer.fromJson<String?>(json['firstName']),
lastName: serializer.fromJson<String?>(json['lastName']),
isUsed: serializer.fromJson<bool>(json['isUsed']),
usedAt: serializer.fromJson<PgDateTime?>(json['usedAt']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
expiresAt: serializer.fromJson<PgDateTime>(json['expiresAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
deletedAt: serializer.fromJson<PgDateTime?>(json['deletedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'code': serializer.toJson<String>(code),
'telegramUserId': serializer.toJson<String>(telegramUserId),
'telegramUsername': serializer.toJson<String?>(telegramUsername),
'firstName': serializer.toJson<String?>(firstName),
'lastName': serializer.toJson<String?>(lastName),
'isUsed': serializer.toJson<bool>(isUsed),
'usedAt': serializer.toJson<PgDateTime?>(usedAt),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'expiresAt': serializer.toJson<PgDateTime>(expiresAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
'deletedAt': serializer.toJson<PgDateTime?>(deletedAt),
};
}
TelegramAuthCode copyWith({
String? id,
String? code,
String? telegramUserId,
Value<String?> telegramUsername = const Value.absent(),
Value<String?> firstName = const Value.absent(),
Value<String?> lastName = const Value.absent(),
bool? isUsed,
Value<PgDateTime?> usedAt = const Value.absent(),
PgDateTime? createdAt,
PgDateTime? expiresAt,
bool? isDeleted,
Value<PgDateTime?> deletedAt = const Value.absent(),
}) => TelegramAuthCode(
id: id ?? this.id,
code: code ?? this.code,
telegramUserId: telegramUserId ?? this.telegramUserId,
telegramUsername: telegramUsername.present
? telegramUsername.value
: this.telegramUsername,
firstName: firstName.present ? firstName.value : this.firstName,
lastName: lastName.present ? lastName.value : this.lastName,
isUsed: isUsed ?? this.isUsed,
usedAt: usedAt.present ? usedAt.value : this.usedAt,
createdAt: createdAt ?? this.createdAt,
expiresAt: expiresAt ?? this.expiresAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
);
TelegramAuthCode copyWithCompanion(TelegramAuthCodesCompanion data) {
return TelegramAuthCode(
id: data.id.present ? data.id.value : this.id,
code: data.code.present ? data.code.value : this.code,
telegramUserId: data.telegramUserId.present
? data.telegramUserId.value
: this.telegramUserId,
telegramUsername: data.telegramUsername.present
? data.telegramUsername.value
: this.telegramUsername,
firstName: data.firstName.present ? data.firstName.value : this.firstName,
lastName: data.lastName.present ? data.lastName.value : this.lastName,
isUsed: data.isUsed.present ? data.isUsed.value : this.isUsed,
usedAt: data.usedAt.present ? data.usedAt.value : this.usedAt,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
expiresAt: data.expiresAt.present ? data.expiresAt.value : this.expiresAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
);
}
@override
String toString() {
return (StringBuffer('TelegramAuthCode(')
..write('id: $id, ')
..write('code: $code, ')
..write('telegramUserId: $telegramUserId, ')
..write('telegramUsername: $telegramUsername, ')
..write('firstName: $firstName, ')
..write('lastName: $lastName, ')
..write('isUsed: $isUsed, ')
..write('usedAt: $usedAt, ')
..write('createdAt: $createdAt, ')
..write('expiresAt: $expiresAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
code,
telegramUserId,
telegramUsername,
firstName,
lastName,
isUsed,
usedAt,
createdAt,
expiresAt,
isDeleted,
deletedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is TelegramAuthCode &&
other.id == this.id &&
other.code == this.code &&
other.telegramUserId == this.telegramUserId &&
other.telegramUsername == this.telegramUsername &&
other.firstName == this.firstName &&
other.lastName == this.lastName &&
other.isUsed == this.isUsed &&
other.usedAt == this.usedAt &&
other.createdAt == this.createdAt &&
other.expiresAt == this.expiresAt &&
other.isDeleted == this.isDeleted &&
other.deletedAt == this.deletedAt);
}
class TelegramAuthCodesCompanion extends UpdateCompanion<TelegramAuthCode> {
final Value<String> id;
final Value<String> code;
final Value<String> telegramUserId;
final Value<String?> telegramUsername;
final Value<String?> firstName;
final Value<String?> lastName;
final Value<bool> isUsed;
final Value<PgDateTime?> usedAt;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> expiresAt;
final Value<bool> isDeleted;
final Value<PgDateTime?> deletedAt;
final Value<int> rowid;
const TelegramAuthCodesCompanion({
this.id = const Value.absent(),
this.code = const Value.absent(),
this.telegramUserId = const Value.absent(),
this.telegramUsername = const Value.absent(),
this.firstName = const Value.absent(),
this.lastName = const Value.absent(),
this.isUsed = const Value.absent(),
this.usedAt = const Value.absent(),
this.createdAt = const Value.absent(),
this.expiresAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
TelegramAuthCodesCompanion.insert({
this.id = const Value.absent(),
required String code,
required String telegramUserId,
this.telegramUsername = const Value.absent(),
this.firstName = const Value.absent(),
this.lastName = const Value.absent(),
this.isUsed = const Value.absent(),
this.usedAt = const Value.absent(),
this.createdAt = const Value.absent(),
required PgDateTime expiresAt,
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : code = Value(code),
telegramUserId = Value(telegramUserId),
expiresAt = Value(expiresAt);
static Insertable<TelegramAuthCode> custom({
Expression<String>? id,
Expression<String>? code,
Expression<String>? telegramUserId,
Expression<String>? telegramUsername,
Expression<String>? firstName,
Expression<String>? lastName,
Expression<bool>? isUsed,
Expression<PgDateTime>? usedAt,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? expiresAt,
Expression<bool>? isDeleted,
Expression<PgDateTime>? deletedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (code != null) 'code': code,
if (telegramUserId != null) 'telegram_user_id': telegramUserId,
if (telegramUsername != null) 'telegram_username': telegramUsername,
if (firstName != null) 'first_name': firstName,
if (lastName != null) 'last_name': lastName,
if (isUsed != null) 'is_used': isUsed,
if (usedAt != null) 'used_at': usedAt,
if (createdAt != null) 'created_at': createdAt,
if (expiresAt != null) 'expires_at': expiresAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (deletedAt != null) 'deleted_at': deletedAt,
if (rowid != null) 'rowid': rowid,
});
}
TelegramAuthCodesCompanion copyWith({
Value<String>? id,
Value<String>? code,
Value<String>? telegramUserId,
Value<String?>? telegramUsername,
Value<String?>? firstName,
Value<String?>? lastName,
Value<bool>? isUsed,
Value<PgDateTime?>? usedAt,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? expiresAt,
Value<bool>? isDeleted,
Value<PgDateTime?>? deletedAt,
Value<int>? rowid,
}) {
return TelegramAuthCodesCompanion(
id: id ?? this.id,
code: code ?? this.code,
telegramUserId: telegramUserId ?? this.telegramUserId,
telegramUsername: telegramUsername ?? this.telegramUsername,
firstName: firstName ?? this.firstName,
lastName: lastName ?? this.lastName,
isUsed: isUsed ?? this.isUsed,
usedAt: usedAt ?? this.usedAt,
createdAt: createdAt ?? this.createdAt,
expiresAt: expiresAt ?? this.expiresAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt ?? this.deletedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (code.present) {
map['code'] = Variable<String>(code.value);
}
if (telegramUserId.present) {
map['telegram_user_id'] = Variable<String>(telegramUserId.value);
}
if (telegramUsername.present) {
map['telegram_username'] = Variable<String>(telegramUsername.value);
}
if (firstName.present) {
map['first_name'] = Variable<String>(firstName.value);
}
if (lastName.present) {
map['last_name'] = Variable<String>(lastName.value);
}
if (isUsed.present) {
map['is_used'] = Variable<bool>(isUsed.value);
}
if (usedAt.present) {
map['used_at'] = Variable<PgDateTime>(
usedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (expiresAt.present) {
map['expires_at'] = Variable<PgDateTime>(
expiresAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (deletedAt.present) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('TelegramAuthCodesCompanion(')
..write('id: $id, ')
..write('code: $code, ')
..write('telegramUserId: $telegramUserId, ')
..write('telegramUsername: $telegramUsername, ')
..write('firstName: $firstName, ')
..write('lastName: $lastName, ')
..write('isUsed: $isUsed, ')
..write('usedAt: $usedAt, ')
..write('createdAt: $createdAt, ')
..write('expiresAt: $expiresAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $CardPacksTable extends CardPacks
with TableInfo<$CardPacksTable, CardPack> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$CardPacksTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _titleMeta = const VerificationMeta('title');
@override
late final GeneratedColumn<String> title = GeneratedColumn<String>(
'title',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _subtitleMeta = const VerificationMeta(
'subtitle',
);
@override
late final GeneratedColumn<String> subtitle = GeneratedColumn<String>(
'subtitle',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _descriptionMeta = const VerificationMeta(
'description',
);
@override
late final GeneratedColumn<String> description = GeneratedColumn<String>(
'description',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _colorMeta = const VerificationMeta('color');
@override
late final GeneratedColumn<String> color = GeneratedColumn<String>(
'color',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _coverMeta = const VerificationMeta('cover');
@override
late final GeneratedColumn<String> cover = GeneratedColumn<String>(
'cover',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _sizeMeta = const VerificationMeta('size');
@override
late final GeneratedColumn<int> size = GeneratedColumn<int>(
'size',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
);
static const VerificationMeta _versionMeta = const VerificationMeta(
'version',
);
@override
late final GeneratedColumn<String> version = GeneratedColumn<String>(
'version',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _orderMeta = const VerificationMeta('order');
@override
late final GeneratedColumn<int> order = GeneratedColumn<int>(
'order',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _enabledMeta = const VerificationMeta(
'enabled',
);
@override
late final GeneratedColumn<bool> enabled = GeneratedColumn<bool>(
'enabled',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT TRUE',
defaultValue: const CustomExpression('TRUE'),
);
@override
late final GeneratedColumnWithTypeConverter<List<String>, String> cardsOrder =
GeneratedColumn<String>(
'cards_order',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
).withConverter<List<String>>($CardPacksTable.$convertercardsOrder);
static const VerificationMeta _googlePlayIdMeta = const VerificationMeta(
'googlePlayId',
);
@override
late final GeneratedColumn<String> googlePlayId = GeneratedColumn<String>(
'google_play_id',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _rustoreIdMeta = const VerificationMeta(
'rustoreId',
);
@override
late final GeneratedColumn<String> rustoreId = GeneratedColumn<String>(
'rustore_id',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _appStoreIdMeta = const VerificationMeta(
'appStoreId',
);
@override
late final GeneratedColumn<String> appStoreId = GeneratedColumn<String>(
'app_store_id',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _priceMeta = const VerificationMeta('price');
@override
late final GeneratedColumn<String> price = GeneratedColumn<String>(
'price',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _currencyMeta = const VerificationMeta(
'currency',
);
@override
late final GeneratedColumn<String> currency = GeneratedColumn<String>(
'currency',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('RUB'),
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
@override
List<GeneratedColumn> get $columns => [
id,
title,
subtitle,
description,
color,
cover,
size,
version,
order,
enabled,
cardsOrder,
googlePlayId,
rustoreId,
appStoreId,
price,
currency,
createdAt,
updatedAt,
isDeleted,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'card_packs';
@override
VerificationContext validateIntegrity(
Insertable<CardPack> 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('title')) {
context.handle(
_titleMeta,
title.isAcceptableOrUnknown(data['title']!, _titleMeta),
);
} else if (isInserting) {
context.missing(_titleMeta);
}
if (data.containsKey('subtitle')) {
context.handle(
_subtitleMeta,
subtitle.isAcceptableOrUnknown(data['subtitle']!, _subtitleMeta),
);
} else if (isInserting) {
context.missing(_subtitleMeta);
}
if (data.containsKey('description')) {
context.handle(
_descriptionMeta,
description.isAcceptableOrUnknown(
data['description']!,
_descriptionMeta,
),
);
}
if (data.containsKey('color')) {
context.handle(
_colorMeta,
color.isAcceptableOrUnknown(data['color']!, _colorMeta),
);
}
if (data.containsKey('cover')) {
context.handle(
_coverMeta,
cover.isAcceptableOrUnknown(data['cover']!, _coverMeta),
);
}
if (data.containsKey('size')) {
context.handle(
_sizeMeta,
size.isAcceptableOrUnknown(data['size']!, _sizeMeta),
);
} else if (isInserting) {
context.missing(_sizeMeta);
}
if (data.containsKey('version')) {
context.handle(
_versionMeta,
version.isAcceptableOrUnknown(data['version']!, _versionMeta),
);
}
if (data.containsKey('order')) {
context.handle(
_orderMeta,
order.isAcceptableOrUnknown(data['order']!, _orderMeta),
);
}
if (data.containsKey('enabled')) {
context.handle(
_enabledMeta,
enabled.isAcceptableOrUnknown(data['enabled']!, _enabledMeta),
);
}
if (data.containsKey('google_play_id')) {
context.handle(
_googlePlayIdMeta,
googlePlayId.isAcceptableOrUnknown(
data['google_play_id']!,
_googlePlayIdMeta,
),
);
}
if (data.containsKey('rustore_id')) {
context.handle(
_rustoreIdMeta,
rustoreId.isAcceptableOrUnknown(data['rustore_id']!, _rustoreIdMeta),
);
}
if (data.containsKey('app_store_id')) {
context.handle(
_appStoreIdMeta,
appStoreId.isAcceptableOrUnknown(
data['app_store_id']!,
_appStoreIdMeta,
),
);
}
if (data.containsKey('price')) {
context.handle(
_priceMeta,
price.isAcceptableOrUnknown(data['price']!, _priceMeta),
);
}
if (data.containsKey('currency')) {
context.handle(
_currencyMeta,
currency.isAcceptableOrUnknown(data['currency']!, _currencyMeta),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
CardPack map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return CardPack(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
title: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}title'],
)!,
subtitle: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}subtitle'],
)!,
description: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}description'],
),
color: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}color'],
),
cover: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}cover'],
),
size: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}size'],
)!,
version: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}version'],
),
order: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}order'],
)!,
enabled: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}enabled'],
)!,
cardsOrder: $CardPacksTable.$convertercardsOrder.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}cards_order'],
)!,
),
googlePlayId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}google_play_id'],
),
rustoreId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}rustore_id'],
),
appStoreId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}app_store_id'],
),
price: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}price'],
),
currency: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}currency'],
)!,
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
);
}
@override
$CardPacksTable createAlias(String alias) {
return $CardPacksTable(attachedDatabase, alias);
}
static TypeConverter<List<String>, String?> $convertercardsOrder =
const StringListConverter();
}
class CardPack extends DataClass implements Insertable<CardPack> {
final String id;
final String title;
final String subtitle;
final String? description;
final String? color;
final String? cover;
final int size;
final String? version;
final int order;
final bool enabled;
final List<String> cardsOrder;
final String? googlePlayId;
final String? rustoreId;
final String? appStoreId;
final String? price;
final String currency;
final PgDateTime createdAt;
final PgDateTime updatedAt;
final bool isDeleted;
const CardPack({
required this.id,
required this.title,
required this.subtitle,
this.description,
this.color,
this.cover,
required this.size,
this.version,
required this.order,
required this.enabled,
required this.cardsOrder,
this.googlePlayId,
this.rustoreId,
this.appStoreId,
this.price,
required this.currency,
required this.createdAt,
required this.updatedAt,
required this.isDeleted,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['title'] = Variable<String>(title);
map['subtitle'] = Variable<String>(subtitle);
if (!nullToAbsent || description != null) {
map['description'] = Variable<String>(description);
}
if (!nullToAbsent || color != null) {
map['color'] = Variable<String>(color);
}
if (!nullToAbsent || cover != null) {
map['cover'] = Variable<String>(cover);
}
map['size'] = Variable<int>(size);
if (!nullToAbsent || version != null) {
map['version'] = Variable<String>(version);
}
map['order'] = Variable<int>(order);
map['enabled'] = Variable<bool>(enabled);
{
map['cards_order'] = Variable<String>(
$CardPacksTable.$convertercardsOrder.toSql(cardsOrder),
);
}
if (!nullToAbsent || googlePlayId != null) {
map['google_play_id'] = Variable<String>(googlePlayId);
}
if (!nullToAbsent || rustoreId != null) {
map['rustore_id'] = Variable<String>(rustoreId);
}
if (!nullToAbsent || appStoreId != null) {
map['app_store_id'] = Variable<String>(appStoreId);
}
if (!nullToAbsent || price != null) {
map['price'] = Variable<String>(price);
}
map['currency'] = Variable<String>(currency);
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
return map;
}
CardPacksCompanion toCompanion(bool nullToAbsent) {
return CardPacksCompanion(
id: Value(id),
title: Value(title),
subtitle: Value(subtitle),
description: description == null && nullToAbsent
? const Value.absent()
: Value(description),
color: color == null && nullToAbsent
? const Value.absent()
: Value(color),
cover: cover == null && nullToAbsent
? const Value.absent()
: Value(cover),
size: Value(size),
version: version == null && nullToAbsent
? const Value.absent()
: Value(version),
order: Value(order),
enabled: Value(enabled),
cardsOrder: Value(cardsOrder),
googlePlayId: googlePlayId == null && nullToAbsent
? const Value.absent()
: Value(googlePlayId),
rustoreId: rustoreId == null && nullToAbsent
? const Value.absent()
: Value(rustoreId),
appStoreId: appStoreId == null && nullToAbsent
? const Value.absent()
: Value(appStoreId),
price: price == null && nullToAbsent
? const Value.absent()
: Value(price),
currency: Value(currency),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
isDeleted: Value(isDeleted),
);
}
factory CardPack.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return CardPack(
id: serializer.fromJson<String>(json['id']),
title: serializer.fromJson<String>(json['title']),
subtitle: serializer.fromJson<String>(json['subtitle']),
description: serializer.fromJson<String?>(json['description']),
color: serializer.fromJson<String?>(json['color']),
cover: serializer.fromJson<String?>(json['cover']),
size: serializer.fromJson<int>(json['size']),
version: serializer.fromJson<String?>(json['version']),
order: serializer.fromJson<int>(json['order']),
enabled: serializer.fromJson<bool>(json['enabled']),
cardsOrder: serializer.fromJson<List<String>>(json['cardsOrder']),
googlePlayId: serializer.fromJson<String?>(json['googlePlayId']),
rustoreId: serializer.fromJson<String?>(json['rustoreId']),
appStoreId: serializer.fromJson<String?>(json['appStoreId']),
price: serializer.fromJson<String?>(json['price']),
currency: serializer.fromJson<String>(json['currency']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'title': serializer.toJson<String>(title),
'subtitle': serializer.toJson<String>(subtitle),
'description': serializer.toJson<String?>(description),
'color': serializer.toJson<String?>(color),
'cover': serializer.toJson<String?>(cover),
'size': serializer.toJson<int>(size),
'version': serializer.toJson<String?>(version),
'order': serializer.toJson<int>(order),
'enabled': serializer.toJson<bool>(enabled),
'cardsOrder': serializer.toJson<List<String>>(cardsOrder),
'googlePlayId': serializer.toJson<String?>(googlePlayId),
'rustoreId': serializer.toJson<String?>(rustoreId),
'appStoreId': serializer.toJson<String?>(appStoreId),
'price': serializer.toJson<String?>(price),
'currency': serializer.toJson<String>(currency),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
};
}
CardPack copyWith({
String? id,
String? title,
String? subtitle,
Value<String?> description = const Value.absent(),
Value<String?> color = const Value.absent(),
Value<String?> cover = const Value.absent(),
int? size,
Value<String?> version = const Value.absent(),
int? order,
bool? enabled,
List<String>? cardsOrder,
Value<String?> googlePlayId = const Value.absent(),
Value<String?> rustoreId = const Value.absent(),
Value<String?> appStoreId = const Value.absent(),
Value<String?> price = const Value.absent(),
String? currency,
PgDateTime? createdAt,
PgDateTime? updatedAt,
bool? isDeleted,
}) => CardPack(
id: id ?? this.id,
title: title ?? this.title,
subtitle: subtitle ?? this.subtitle,
description: description.present ? description.value : this.description,
color: color.present ? color.value : this.color,
cover: cover.present ? cover.value : this.cover,
size: size ?? this.size,
version: version.present ? version.value : this.version,
order: order ?? this.order,
enabled: enabled ?? this.enabled,
cardsOrder: cardsOrder ?? this.cardsOrder,
googlePlayId: googlePlayId.present ? googlePlayId.value : this.googlePlayId,
rustoreId: rustoreId.present ? rustoreId.value : this.rustoreId,
appStoreId: appStoreId.present ? appStoreId.value : this.appStoreId,
price: price.present ? price.value : this.price,
currency: currency ?? this.currency,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
);
CardPack copyWithCompanion(CardPacksCompanion data) {
return CardPack(
id: data.id.present ? data.id.value : this.id,
title: data.title.present ? data.title.value : this.title,
subtitle: data.subtitle.present ? data.subtitle.value : this.subtitle,
description: data.description.present
? data.description.value
: this.description,
color: data.color.present ? data.color.value : this.color,
cover: data.cover.present ? data.cover.value : this.cover,
size: data.size.present ? data.size.value : this.size,
version: data.version.present ? data.version.value : this.version,
order: data.order.present ? data.order.value : this.order,
enabled: data.enabled.present ? data.enabled.value : this.enabled,
cardsOrder: data.cardsOrder.present
? data.cardsOrder.value
: this.cardsOrder,
googlePlayId: data.googlePlayId.present
? data.googlePlayId.value
: this.googlePlayId,
rustoreId: data.rustoreId.present ? data.rustoreId.value : this.rustoreId,
appStoreId: data.appStoreId.present
? data.appStoreId.value
: this.appStoreId,
price: data.price.present ? data.price.value : this.price,
currency: data.currency.present ? data.currency.value : this.currency,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
);
}
@override
String toString() {
return (StringBuffer('CardPack(')
..write('id: $id, ')
..write('title: $title, ')
..write('subtitle: $subtitle, ')
..write('description: $description, ')
..write('color: $color, ')
..write('cover: $cover, ')
..write('size: $size, ')
..write('version: $version, ')
..write('order: $order, ')
..write('enabled: $enabled, ')
..write('cardsOrder: $cardsOrder, ')
..write('googlePlayId: $googlePlayId, ')
..write('rustoreId: $rustoreId, ')
..write('appStoreId: $appStoreId, ')
..write('price: $price, ')
..write('currency: $currency, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
title,
subtitle,
description,
color,
cover,
size,
version,
order,
enabled,
cardsOrder,
googlePlayId,
rustoreId,
appStoreId,
price,
currency,
createdAt,
updatedAt,
isDeleted,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is CardPack &&
other.id == this.id &&
other.title == this.title &&
other.subtitle == this.subtitle &&
other.description == this.description &&
other.color == this.color &&
other.cover == this.cover &&
other.size == this.size &&
other.version == this.version &&
other.order == this.order &&
other.enabled == this.enabled &&
other.cardsOrder == this.cardsOrder &&
other.googlePlayId == this.googlePlayId &&
other.rustoreId == this.rustoreId &&
other.appStoreId == this.appStoreId &&
other.price == this.price &&
other.currency == this.currency &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt &&
other.isDeleted == this.isDeleted);
}
class CardPacksCompanion extends UpdateCompanion<CardPack> {
final Value<String> id;
final Value<String> title;
final Value<String> subtitle;
final Value<String?> description;
final Value<String?> color;
final Value<String?> cover;
final Value<int> size;
final Value<String?> version;
final Value<int> order;
final Value<bool> enabled;
final Value<List<String>> cardsOrder;
final Value<String?> googlePlayId;
final Value<String?> rustoreId;
final Value<String?> appStoreId;
final Value<String?> price;
final Value<String> currency;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<bool> isDeleted;
final Value<int> rowid;
const CardPacksCompanion({
this.id = const Value.absent(),
this.title = const Value.absent(),
this.subtitle = const Value.absent(),
this.description = const Value.absent(),
this.color = const Value.absent(),
this.cover = const Value.absent(),
this.size = const Value.absent(),
this.version = const Value.absent(),
this.order = const Value.absent(),
this.enabled = const Value.absent(),
this.cardsOrder = const Value.absent(),
this.googlePlayId = const Value.absent(),
this.rustoreId = const Value.absent(),
this.appStoreId = const Value.absent(),
this.price = const Value.absent(),
this.currency = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.rowid = const Value.absent(),
});
CardPacksCompanion.insert({
this.id = const Value.absent(),
required String title,
required String subtitle,
this.description = const Value.absent(),
this.color = const Value.absent(),
this.cover = const Value.absent(),
required int size,
this.version = const Value.absent(),
this.order = const Value.absent(),
this.enabled = const Value.absent(),
this.cardsOrder = const Value.absent(),
this.googlePlayId = const Value.absent(),
this.rustoreId = const Value.absent(),
this.appStoreId = const Value.absent(),
this.price = const Value.absent(),
this.currency = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.rowid = const Value.absent(),
}) : title = Value(title),
subtitle = Value(subtitle),
size = Value(size);
static Insertable<CardPack> custom({
Expression<String>? id,
Expression<String>? title,
Expression<String>? subtitle,
Expression<String>? description,
Expression<String>? color,
Expression<String>? cover,
Expression<int>? size,
Expression<String>? version,
Expression<int>? order,
Expression<bool>? enabled,
Expression<String>? cardsOrder,
Expression<String>? googlePlayId,
Expression<String>? rustoreId,
Expression<String>? appStoreId,
Expression<String>? price,
Expression<String>? currency,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<bool>? isDeleted,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (title != null) 'title': title,
if (subtitle != null) 'subtitle': subtitle,
if (description != null) 'description': description,
if (color != null) 'color': color,
if (cover != null) 'cover': cover,
if (size != null) 'size': size,
if (version != null) 'version': version,
if (order != null) 'order': order,
if (enabled != null) 'enabled': enabled,
if (cardsOrder != null) 'cards_order': cardsOrder,
if (googlePlayId != null) 'google_play_id': googlePlayId,
if (rustoreId != null) 'rustore_id': rustoreId,
if (appStoreId != null) 'app_store_id': appStoreId,
if (price != null) 'price': price,
if (currency != null) 'currency': currency,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (rowid != null) 'rowid': rowid,
});
}
CardPacksCompanion copyWith({
Value<String>? id,
Value<String>? title,
Value<String>? subtitle,
Value<String?>? description,
Value<String?>? color,
Value<String?>? cover,
Value<int>? size,
Value<String?>? version,
Value<int>? order,
Value<bool>? enabled,
Value<List<String>>? cardsOrder,
Value<String?>? googlePlayId,
Value<String?>? rustoreId,
Value<String?>? appStoreId,
Value<String?>? price,
Value<String>? currency,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<bool>? isDeleted,
Value<int>? rowid,
}) {
return CardPacksCompanion(
id: id ?? this.id,
title: title ?? this.title,
subtitle: subtitle ?? this.subtitle,
description: description ?? this.description,
color: color ?? this.color,
cover: cover ?? this.cover,
size: size ?? this.size,
version: version ?? this.version,
order: order ?? this.order,
enabled: enabled ?? this.enabled,
cardsOrder: cardsOrder ?? this.cardsOrder,
googlePlayId: googlePlayId ?? this.googlePlayId,
rustoreId: rustoreId ?? this.rustoreId,
appStoreId: appStoreId ?? this.appStoreId,
price: price ?? this.price,
currency: currency ?? this.currency,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (title.present) {
map['title'] = Variable<String>(title.value);
}
if (subtitle.present) {
map['subtitle'] = Variable<String>(subtitle.value);
}
if (description.present) {
map['description'] = Variable<String>(description.value);
}
if (color.present) {
map['color'] = Variable<String>(color.value);
}
if (cover.present) {
map['cover'] = Variable<String>(cover.value);
}
if (size.present) {
map['size'] = Variable<int>(size.value);
}
if (version.present) {
map['version'] = Variable<String>(version.value);
}
if (order.present) {
map['order'] = Variable<int>(order.value);
}
if (enabled.present) {
map['enabled'] = Variable<bool>(enabled.value);
}
if (cardsOrder.present) {
map['cards_order'] = Variable<String>(
$CardPacksTable.$convertercardsOrder.toSql(cardsOrder.value),
);
}
if (googlePlayId.present) {
map['google_play_id'] = Variable<String>(googlePlayId.value);
}
if (rustoreId.present) {
map['rustore_id'] = Variable<String>(rustoreId.value);
}
if (appStoreId.present) {
map['app_store_id'] = Variable<String>(appStoreId.value);
}
if (price.present) {
map['price'] = Variable<String>(price.value);
}
if (currency.present) {
map['currency'] = Variable<String>(currency.value);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('CardPacksCompanion(')
..write('id: $id, ')
..write('title: $title, ')
..write('subtitle: $subtitle, ')
..write('description: $description, ')
..write('color: $color, ')
..write('cover: $cover, ')
..write('size: $size, ')
..write('version: $version, ')
..write('order: $order, ')
..write('enabled: $enabled, ')
..write('cardsOrder: $cardsOrder, ')
..write('googlePlayId: $googlePlayId, ')
..write('rustoreId: $rustoreId, ')
..write('appStoreId: $appStoreId, ')
..write('price: $price, ')
..write('currency: $currency, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $GameCardsTable extends GameCards
with TableInfo<$GameCardsTable, GameCard> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$GameCardsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _originalMeta = const VerificationMeta(
'original',
);
@override
late final GeneratedColumn<String> original = GeneratedColumn<String>(
'original',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _translationMeta = const VerificationMeta(
'translation',
);
@override
late final GeneratedColumn<String> translation = GeneratedColumn<String>(
'translation',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _mnemoMeta = const VerificationMeta('mnemo');
@override
late final GeneratedColumn<String> mnemo = GeneratedColumn<String>(
'mnemo',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _imageMeta = const VerificationMeta('image');
@override
late final GeneratedColumn<String> image = GeneratedColumn<String>(
'image',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _imageBackMeta = const VerificationMeta(
'imageBack',
);
@override
late final GeneratedColumn<String> imageBack = GeneratedColumn<String>(
'image_back',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _transcriptionMeta = const VerificationMeta(
'transcription',
);
@override
late final GeneratedColumn<String> transcription = GeneratedColumn<String>(
'transcription',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _transcriptionMnemoMeta =
const VerificationMeta('transcriptionMnemo');
@override
late final GeneratedColumn<String> transcriptionMnemo =
GeneratedColumn<String>(
'transcription_mnemo',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _backMeta = const VerificationMeta('back');
@override
late final GeneratedColumn<String> back = GeneratedColumn<String>(
'back',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
@override
List<GeneratedColumn> get $columns => [
id,
original,
translation,
mnemo,
image,
imageBack,
transcription,
transcriptionMnemo,
back,
createdAt,
updatedAt,
isDeleted,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'game_cards';
@override
VerificationContext validateIntegrity(
Insertable<GameCard> 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('original')) {
context.handle(
_originalMeta,
original.isAcceptableOrUnknown(data['original']!, _originalMeta),
);
} else if (isInserting) {
context.missing(_originalMeta);
}
if (data.containsKey('translation')) {
context.handle(
_translationMeta,
translation.isAcceptableOrUnknown(
data['translation']!,
_translationMeta,
),
);
} else if (isInserting) {
context.missing(_translationMeta);
}
if (data.containsKey('mnemo')) {
context.handle(
_mnemoMeta,
mnemo.isAcceptableOrUnknown(data['mnemo']!, _mnemoMeta),
);
}
if (data.containsKey('image')) {
context.handle(
_imageMeta,
image.isAcceptableOrUnknown(data['image']!, _imageMeta),
);
} else if (isInserting) {
context.missing(_imageMeta);
}
if (data.containsKey('image_back')) {
context.handle(
_imageBackMeta,
imageBack.isAcceptableOrUnknown(data['image_back']!, _imageBackMeta),
);
}
if (data.containsKey('transcription')) {
context.handle(
_transcriptionMeta,
transcription.isAcceptableOrUnknown(
data['transcription']!,
_transcriptionMeta,
),
);
}
if (data.containsKey('transcription_mnemo')) {
context.handle(
_transcriptionMnemoMeta,
transcriptionMnemo.isAcceptableOrUnknown(
data['transcription_mnemo']!,
_transcriptionMnemoMeta,
),
);
}
if (data.containsKey('back')) {
context.handle(
_backMeta,
back.isAcceptableOrUnknown(data['back']!, _backMeta),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
GameCard map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return GameCard(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
original: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}original'],
)!,
translation: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}translation'],
)!,
mnemo: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}mnemo'],
),
image: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}image'],
)!,
imageBack: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}image_back'],
),
transcription: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}transcription'],
),
transcriptionMnemo: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}transcription_mnemo'],
),
back: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}back'],
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
);
}
@override
$GameCardsTable createAlias(String alias) {
return $GameCardsTable(attachedDatabase, alias);
}
}
class GameCard extends DataClass implements Insertable<GameCard> {
final String id;
final String original;
final String translation;
final String? mnemo;
final String image;
final String? imageBack;
final String? transcription;
final String? transcriptionMnemo;
final String? back;
final PgDateTime createdAt;
final PgDateTime updatedAt;
final bool isDeleted;
const GameCard({
required this.id,
required this.original,
required this.translation,
this.mnemo,
required this.image,
this.imageBack,
this.transcription,
this.transcriptionMnemo,
this.back,
required this.createdAt,
required this.updatedAt,
required this.isDeleted,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['original'] = Variable<String>(original);
map['translation'] = Variable<String>(translation);
if (!nullToAbsent || mnemo != null) {
map['mnemo'] = Variable<String>(mnemo);
}
map['image'] = Variable<String>(image);
if (!nullToAbsent || imageBack != null) {
map['image_back'] = Variable<String>(imageBack);
}
if (!nullToAbsent || transcription != null) {
map['transcription'] = Variable<String>(transcription);
}
if (!nullToAbsent || transcriptionMnemo != null) {
map['transcription_mnemo'] = Variable<String>(transcriptionMnemo);
}
if (!nullToAbsent || back != null) {
map['back'] = Variable<String>(back);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
return map;
}
GameCardsCompanion toCompanion(bool nullToAbsent) {
return GameCardsCompanion(
id: Value(id),
original: Value(original),
translation: Value(translation),
mnemo: mnemo == null && nullToAbsent
? const Value.absent()
: Value(mnemo),
image: Value(image),
imageBack: imageBack == null && nullToAbsent
? const Value.absent()
: Value(imageBack),
transcription: transcription == null && nullToAbsent
? const Value.absent()
: Value(transcription),
transcriptionMnemo: transcriptionMnemo == null && nullToAbsent
? const Value.absent()
: Value(transcriptionMnemo),
back: back == null && nullToAbsent ? const Value.absent() : Value(back),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
isDeleted: Value(isDeleted),
);
}
factory GameCard.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return GameCard(
id: serializer.fromJson<String>(json['id']),
original: serializer.fromJson<String>(json['original']),
translation: serializer.fromJson<String>(json['translation']),
mnemo: serializer.fromJson<String?>(json['mnemo']),
image: serializer.fromJson<String>(json['image']),
imageBack: serializer.fromJson<String?>(json['imageBack']),
transcription: serializer.fromJson<String?>(json['transcription']),
transcriptionMnemo: serializer.fromJson<String?>(
json['transcriptionMnemo'],
),
back: serializer.fromJson<String?>(json['back']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'original': serializer.toJson<String>(original),
'translation': serializer.toJson<String>(translation),
'mnemo': serializer.toJson<String?>(mnemo),
'image': serializer.toJson<String>(image),
'imageBack': serializer.toJson<String?>(imageBack),
'transcription': serializer.toJson<String?>(transcription),
'transcriptionMnemo': serializer.toJson<String?>(transcriptionMnemo),
'back': serializer.toJson<String?>(back),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
};
}
GameCard copyWith({
String? id,
String? original,
String? translation,
Value<String?> mnemo = const Value.absent(),
String? image,
Value<String?> imageBack = const Value.absent(),
Value<String?> transcription = const Value.absent(),
Value<String?> transcriptionMnemo = const Value.absent(),
Value<String?> back = const Value.absent(),
PgDateTime? createdAt,
PgDateTime? updatedAt,
bool? isDeleted,
}) => GameCard(
id: id ?? this.id,
original: original ?? this.original,
translation: translation ?? this.translation,
mnemo: mnemo.present ? mnemo.value : this.mnemo,
image: image ?? this.image,
imageBack: imageBack.present ? imageBack.value : this.imageBack,
transcription: transcription.present
? transcription.value
: this.transcription,
transcriptionMnemo: transcriptionMnemo.present
? transcriptionMnemo.value
: this.transcriptionMnemo,
back: back.present ? back.value : this.back,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
);
GameCard copyWithCompanion(GameCardsCompanion data) {
return GameCard(
id: data.id.present ? data.id.value : this.id,
original: data.original.present ? data.original.value : this.original,
translation: data.translation.present
? data.translation.value
: this.translation,
mnemo: data.mnemo.present ? data.mnemo.value : this.mnemo,
image: data.image.present ? data.image.value : this.image,
imageBack: data.imageBack.present ? data.imageBack.value : this.imageBack,
transcription: data.transcription.present
? data.transcription.value
: this.transcription,
transcriptionMnemo: data.transcriptionMnemo.present
? data.transcriptionMnemo.value
: this.transcriptionMnemo,
back: data.back.present ? data.back.value : this.back,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
);
}
@override
String toString() {
return (StringBuffer('GameCard(')
..write('id: $id, ')
..write('original: $original, ')
..write('translation: $translation, ')
..write('mnemo: $mnemo, ')
..write('image: $image, ')
..write('imageBack: $imageBack, ')
..write('transcription: $transcription, ')
..write('transcriptionMnemo: $transcriptionMnemo, ')
..write('back: $back, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
original,
translation,
mnemo,
image,
imageBack,
transcription,
transcriptionMnemo,
back,
createdAt,
updatedAt,
isDeleted,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is GameCard &&
other.id == this.id &&
other.original == this.original &&
other.translation == this.translation &&
other.mnemo == this.mnemo &&
other.image == this.image &&
other.imageBack == this.imageBack &&
other.transcription == this.transcription &&
other.transcriptionMnemo == this.transcriptionMnemo &&
other.back == this.back &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt &&
other.isDeleted == this.isDeleted);
}
class GameCardsCompanion extends UpdateCompanion<GameCard> {
final Value<String> id;
final Value<String> original;
final Value<String> translation;
final Value<String?> mnemo;
final Value<String> image;
final Value<String?> imageBack;
final Value<String?> transcription;
final Value<String?> transcriptionMnemo;
final Value<String?> back;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<bool> isDeleted;
final Value<int> rowid;
const GameCardsCompanion({
this.id = const Value.absent(),
this.original = const Value.absent(),
this.translation = const Value.absent(),
this.mnemo = const Value.absent(),
this.image = const Value.absent(),
this.imageBack = const Value.absent(),
this.transcription = const Value.absent(),
this.transcriptionMnemo = const Value.absent(),
this.back = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.rowid = const Value.absent(),
});
GameCardsCompanion.insert({
this.id = const Value.absent(),
required String original,
required String translation,
this.mnemo = const Value.absent(),
required String image,
this.imageBack = const Value.absent(),
this.transcription = const Value.absent(),
this.transcriptionMnemo = const Value.absent(),
this.back = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.rowid = const Value.absent(),
}) : original = Value(original),
translation = Value(translation),
image = Value(image);
static Insertable<GameCard> custom({
Expression<String>? id,
Expression<String>? original,
Expression<String>? translation,
Expression<String>? mnemo,
Expression<String>? image,
Expression<String>? imageBack,
Expression<String>? transcription,
Expression<String>? transcriptionMnemo,
Expression<String>? back,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<bool>? isDeleted,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (original != null) 'original': original,
if (translation != null) 'translation': translation,
if (mnemo != null) 'mnemo': mnemo,
if (image != null) 'image': image,
if (imageBack != null) 'image_back': imageBack,
if (transcription != null) 'transcription': transcription,
if (transcriptionMnemo != null) 'transcription_mnemo': transcriptionMnemo,
if (back != null) 'back': back,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (rowid != null) 'rowid': rowid,
});
}
GameCardsCompanion copyWith({
Value<String>? id,
Value<String>? original,
Value<String>? translation,
Value<String?>? mnemo,
Value<String>? image,
Value<String?>? imageBack,
Value<String?>? transcription,
Value<String?>? transcriptionMnemo,
Value<String?>? back,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<bool>? isDeleted,
Value<int>? rowid,
}) {
return GameCardsCompanion(
id: id ?? this.id,
original: original ?? this.original,
translation: translation ?? this.translation,
mnemo: mnemo ?? this.mnemo,
image: image ?? this.image,
imageBack: imageBack ?? this.imageBack,
transcription: transcription ?? this.transcription,
transcriptionMnemo: transcriptionMnemo ?? this.transcriptionMnemo,
back: back ?? this.back,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (original.present) {
map['original'] = Variable<String>(original.value);
}
if (translation.present) {
map['translation'] = Variable<String>(translation.value);
}
if (mnemo.present) {
map['mnemo'] = Variable<String>(mnemo.value);
}
if (image.present) {
map['image'] = Variable<String>(image.value);
}
if (imageBack.present) {
map['image_back'] = Variable<String>(imageBack.value);
}
if (transcription.present) {
map['transcription'] = Variable<String>(transcription.value);
}
if (transcriptionMnemo.present) {
map['transcription_mnemo'] = Variable<String>(transcriptionMnemo.value);
}
if (back.present) {
map['back'] = Variable<String>(back.value);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('GameCardsCompanion(')
..write('id: $id, ')
..write('original: $original, ')
..write('translation: $translation, ')
..write('mnemo: $mnemo, ')
..write('image: $image, ')
..write('imageBack: $imageBack, ')
..write('transcription: $transcription, ')
..write('transcriptionMnemo: $transcriptionMnemo, ')
..write('back: $back, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $VoiceModelsTable extends VoiceModels
with TableInfo<$VoiceModelsTable, VoiceModel> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$VoiceModelsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _cardIdMeta = const VerificationMeta('cardId');
@override
late final GeneratedColumn<String> cardId = GeneratedColumn<String>(
'card_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES game_cards (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _voiceUrlMeta = const VerificationMeta(
'voiceUrl',
);
@override
late final GeneratedColumn<String> voiceUrl = GeneratedColumn<String>(
'voice_url',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _languageMeta = const VerificationMeta(
'language',
);
@override
late final GeneratedColumn<String> language = GeneratedColumn<String>(
'language',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
@override
List<GeneratedColumn> get $columns => [
id,
cardId,
voiceUrl,
language,
createdAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'voice_models';
@override
VerificationContext validateIntegrity(
Insertable<VoiceModel> 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('card_id')) {
context.handle(
_cardIdMeta,
cardId.isAcceptableOrUnknown(data['card_id']!, _cardIdMeta),
);
} else if (isInserting) {
context.missing(_cardIdMeta);
}
if (data.containsKey('voice_url')) {
context.handle(
_voiceUrlMeta,
voiceUrl.isAcceptableOrUnknown(data['voice_url']!, _voiceUrlMeta),
);
} else if (isInserting) {
context.missing(_voiceUrlMeta);
}
if (data.containsKey('language')) {
context.handle(
_languageMeta,
language.isAcceptableOrUnknown(data['language']!, _languageMeta),
);
} else if (isInserting) {
context.missing(_languageMeta);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
VoiceModel map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return VoiceModel(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
cardId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}card_id'],
)!,
voiceUrl: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}voice_url'],
)!,
language: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}language'],
)!,
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
);
}
@override
$VoiceModelsTable createAlias(String alias) {
return $VoiceModelsTable(attachedDatabase, alias);
}
}
class VoiceModel extends DataClass implements Insertable<VoiceModel> {
final String id;
final String cardId;
final String voiceUrl;
final String language;
final PgDateTime createdAt;
const VoiceModel({
required this.id,
required this.cardId,
required this.voiceUrl,
required this.language,
required this.createdAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['card_id'] = Variable<String>(cardId);
map['voice_url'] = Variable<String>(voiceUrl);
map['language'] = Variable<String>(language);
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
return map;
}
VoiceModelsCompanion toCompanion(bool nullToAbsent) {
return VoiceModelsCompanion(
id: Value(id),
cardId: Value(cardId),
voiceUrl: Value(voiceUrl),
language: Value(language),
createdAt: Value(createdAt),
);
}
factory VoiceModel.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return VoiceModel(
id: serializer.fromJson<String>(json['id']),
cardId: serializer.fromJson<String>(json['cardId']),
voiceUrl: serializer.fromJson<String>(json['voiceUrl']),
language: serializer.fromJson<String>(json['language']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'cardId': serializer.toJson<String>(cardId),
'voiceUrl': serializer.toJson<String>(voiceUrl),
'language': serializer.toJson<String>(language),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
};
}
VoiceModel copyWith({
String? id,
String? cardId,
String? voiceUrl,
String? language,
PgDateTime? createdAt,
}) => VoiceModel(
id: id ?? this.id,
cardId: cardId ?? this.cardId,
voiceUrl: voiceUrl ?? this.voiceUrl,
language: language ?? this.language,
createdAt: createdAt ?? this.createdAt,
);
VoiceModel copyWithCompanion(VoiceModelsCompanion data) {
return VoiceModel(
id: data.id.present ? data.id.value : this.id,
cardId: data.cardId.present ? data.cardId.value : this.cardId,
voiceUrl: data.voiceUrl.present ? data.voiceUrl.value : this.voiceUrl,
language: data.language.present ? data.language.value : this.language,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
);
}
@override
String toString() {
return (StringBuffer('VoiceModel(')
..write('id: $id, ')
..write('cardId: $cardId, ')
..write('voiceUrl: $voiceUrl, ')
..write('language: $language, ')
..write('createdAt: $createdAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(id, cardId, voiceUrl, language, createdAt);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is VoiceModel &&
other.id == this.id &&
other.cardId == this.cardId &&
other.voiceUrl == this.voiceUrl &&
other.language == this.language &&
other.createdAt == this.createdAt);
}
class VoiceModelsCompanion extends UpdateCompanion<VoiceModel> {
final Value<String> id;
final Value<String> cardId;
final Value<String> voiceUrl;
final Value<String> language;
final Value<PgDateTime> createdAt;
final Value<int> rowid;
const VoiceModelsCompanion({
this.id = const Value.absent(),
this.cardId = const Value.absent(),
this.voiceUrl = const Value.absent(),
this.language = const Value.absent(),
this.createdAt = const Value.absent(),
this.rowid = const Value.absent(),
});
VoiceModelsCompanion.insert({
this.id = const Value.absent(),
required String cardId,
required String voiceUrl,
required String language,
this.createdAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : cardId = Value(cardId),
voiceUrl = Value(voiceUrl),
language = Value(language);
static Insertable<VoiceModel> custom({
Expression<String>? id,
Expression<String>? cardId,
Expression<String>? voiceUrl,
Expression<String>? language,
Expression<PgDateTime>? createdAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (cardId != null) 'card_id': cardId,
if (voiceUrl != null) 'voice_url': voiceUrl,
if (language != null) 'language': language,
if (createdAt != null) 'created_at': createdAt,
if (rowid != null) 'rowid': rowid,
});
}
VoiceModelsCompanion copyWith({
Value<String>? id,
Value<String>? cardId,
Value<String>? voiceUrl,
Value<String>? language,
Value<PgDateTime>? createdAt,
Value<int>? rowid,
}) {
return VoiceModelsCompanion(
id: id ?? this.id,
cardId: cardId ?? this.cardId,
voiceUrl: voiceUrl ?? this.voiceUrl,
language: language ?? this.language,
createdAt: createdAt ?? this.createdAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (cardId.present) {
map['card_id'] = Variable<String>(cardId.value);
}
if (voiceUrl.present) {
map['voice_url'] = Variable<String>(voiceUrl.value);
}
if (language.present) {
map['language'] = Variable<String>(language.value);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('VoiceModelsCompanion(')
..write('id: $id, ')
..write('cardId: $cardId, ')
..write('voiceUrl: $voiceUrl, ')
..write('language: $language, ')
..write('createdAt: $createdAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $UserPacksTable extends UserPacks
with TableInfo<$UserPacksTable, UserPack> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$UserPacksTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES users (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _packIdMeta = const VerificationMeta('packId');
@override
late final GeneratedColumn<String> packId = GeneratedColumn<String>(
'pack_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES card_packs (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _grantedAtMeta = const VerificationMeta(
'grantedAt',
);
@override
late final GeneratedColumn<PgDateTime> grantedAt =
GeneratedColumn<PgDateTime>(
'granted_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _grantTypeMeta = const VerificationMeta(
'grantType',
);
@override
late final GeneratedColumn<String> grantType = GeneratedColumn<String>(
'grant_type',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('purchase'),
);
@override
List<GeneratedColumn> get $columns => [userId, packId, grantedAt, grantType];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'user_packs';
@override
VerificationContext validateIntegrity(
Insertable<UserPack> instance, {
bool isInserting = false,
}) {
final context = VerificationContext();
final data = instance.toColumns(true);
if (data.containsKey('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('pack_id')) {
context.handle(
_packIdMeta,
packId.isAcceptableOrUnknown(data['pack_id']!, _packIdMeta),
);
} else if (isInserting) {
context.missing(_packIdMeta);
}
if (data.containsKey('granted_at')) {
context.handle(
_grantedAtMeta,
grantedAt.isAcceptableOrUnknown(data['granted_at']!, _grantedAtMeta),
);
}
if (data.containsKey('grant_type')) {
context.handle(
_grantTypeMeta,
grantType.isAcceptableOrUnknown(data['grant_type']!, _grantTypeMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {userId, packId};
@override
UserPack map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return UserPack(
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
)!,
packId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}pack_id'],
)!,
grantedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}granted_at'],
)!,
grantType: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}grant_type'],
)!,
);
}
@override
$UserPacksTable createAlias(String alias) {
return $UserPacksTable(attachedDatabase, alias);
}
}
class UserPack extends DataClass implements Insertable<UserPack> {
final String userId;
final String packId;
final PgDateTime grantedAt;
final String grantType;
const UserPack({
required this.userId,
required this.packId,
required this.grantedAt,
required this.grantType,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['user_id'] = Variable<String>(userId);
map['pack_id'] = Variable<String>(packId);
map['granted_at'] = Variable<PgDateTime>(
grantedAt,
PgTypes.timestampWithTimezone,
);
map['grant_type'] = Variable<String>(grantType);
return map;
}
UserPacksCompanion toCompanion(bool nullToAbsent) {
return UserPacksCompanion(
userId: Value(userId),
packId: Value(packId),
grantedAt: Value(grantedAt),
grantType: Value(grantType),
);
}
factory UserPack.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return UserPack(
userId: serializer.fromJson<String>(json['userId']),
packId: serializer.fromJson<String>(json['packId']),
grantedAt: serializer.fromJson<PgDateTime>(json['grantedAt']),
grantType: serializer.fromJson<String>(json['grantType']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'userId': serializer.toJson<String>(userId),
'packId': serializer.toJson<String>(packId),
'grantedAt': serializer.toJson<PgDateTime>(grantedAt),
'grantType': serializer.toJson<String>(grantType),
};
}
UserPack copyWith({
String? userId,
String? packId,
PgDateTime? grantedAt,
String? grantType,
}) => UserPack(
userId: userId ?? this.userId,
packId: packId ?? this.packId,
grantedAt: grantedAt ?? this.grantedAt,
grantType: grantType ?? this.grantType,
);
UserPack copyWithCompanion(UserPacksCompanion data) {
return UserPack(
userId: data.userId.present ? data.userId.value : this.userId,
packId: data.packId.present ? data.packId.value : this.packId,
grantedAt: data.grantedAt.present ? data.grantedAt.value : this.grantedAt,
grantType: data.grantType.present ? data.grantType.value : this.grantType,
);
}
@override
String toString() {
return (StringBuffer('UserPack(')
..write('userId: $userId, ')
..write('packId: $packId, ')
..write('grantedAt: $grantedAt, ')
..write('grantType: $grantType')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(userId, packId, grantedAt, grantType);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is UserPack &&
other.userId == this.userId &&
other.packId == this.packId &&
other.grantedAt == this.grantedAt &&
other.grantType == this.grantType);
}
class UserPacksCompanion extends UpdateCompanion<UserPack> {
final Value<String> userId;
final Value<String> packId;
final Value<PgDateTime> grantedAt;
final Value<String> grantType;
final Value<int> rowid;
const UserPacksCompanion({
this.userId = const Value.absent(),
this.packId = const Value.absent(),
this.grantedAt = const Value.absent(),
this.grantType = const Value.absent(),
this.rowid = const Value.absent(),
});
UserPacksCompanion.insert({
required String userId,
required String packId,
this.grantedAt = const Value.absent(),
this.grantType = const Value.absent(),
this.rowid = const Value.absent(),
}) : userId = Value(userId),
packId = Value(packId);
static Insertable<UserPack> custom({
Expression<String>? userId,
Expression<String>? packId,
Expression<PgDateTime>? grantedAt,
Expression<String>? grantType,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (userId != null) 'user_id': userId,
if (packId != null) 'pack_id': packId,
if (grantedAt != null) 'granted_at': grantedAt,
if (grantType != null) 'grant_type': grantType,
if (rowid != null) 'rowid': rowid,
});
}
UserPacksCompanion copyWith({
Value<String>? userId,
Value<String>? packId,
Value<PgDateTime>? grantedAt,
Value<String>? grantType,
Value<int>? rowid,
}) {
return UserPacksCompanion(
userId: userId ?? this.userId,
packId: packId ?? this.packId,
grantedAt: grantedAt ?? this.grantedAt,
grantType: grantType ?? this.grantType,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (packId.present) {
map['pack_id'] = Variable<String>(packId.value);
}
if (grantedAt.present) {
map['granted_at'] = Variable<PgDateTime>(
grantedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (grantType.present) {
map['grant_type'] = Variable<String>(grantType.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('UserPacksCompanion(')
..write('userId: $userId, ')
..write('packId: $packId, ')
..write('grantedAt: $grantedAt, ')
..write('grantType: $grantType, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $PreviewCardsTable extends PreviewCards
with TableInfo<$PreviewCardsTable, PreviewCard> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$PreviewCardsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _packIdMeta = const VerificationMeta('packId');
@override
late final GeneratedColumn<String> packId = GeneratedColumn<String>(
'pack_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES card_packs (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _cardIdMeta = const VerificationMeta('cardId');
@override
late final GeneratedColumn<String> cardId = GeneratedColumn<String>(
'card_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES game_cards (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _orderMeta = const VerificationMeta('order');
@override
late final GeneratedColumn<int> order = GeneratedColumn<int>(
'order',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
@override
List<GeneratedColumn> get $columns => [packId, cardId, order];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'preview_cards';
@override
VerificationContext validateIntegrity(
Insertable<PreviewCard> instance, {
bool isInserting = false,
}) {
final context = VerificationContext();
final data = instance.toColumns(true);
if (data.containsKey('pack_id')) {
context.handle(
_packIdMeta,
packId.isAcceptableOrUnknown(data['pack_id']!, _packIdMeta),
);
} else if (isInserting) {
context.missing(_packIdMeta);
}
if (data.containsKey('card_id')) {
context.handle(
_cardIdMeta,
cardId.isAcceptableOrUnknown(data['card_id']!, _cardIdMeta),
);
} else if (isInserting) {
context.missing(_cardIdMeta);
}
if (data.containsKey('order')) {
context.handle(
_orderMeta,
order.isAcceptableOrUnknown(data['order']!, _orderMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {packId, cardId};
@override
PreviewCard map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return PreviewCard(
packId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}pack_id'],
)!,
cardId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}card_id'],
)!,
order: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}order'],
)!,
);
}
@override
$PreviewCardsTable createAlias(String alias) {
return $PreviewCardsTable(attachedDatabase, alias);
}
}
class PreviewCard extends DataClass implements Insertable<PreviewCard> {
final String packId;
final String cardId;
final int order;
const PreviewCard({
required this.packId,
required this.cardId,
required this.order,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['pack_id'] = Variable<String>(packId);
map['card_id'] = Variable<String>(cardId);
map['order'] = Variable<int>(order);
return map;
}
PreviewCardsCompanion toCompanion(bool nullToAbsent) {
return PreviewCardsCompanion(
packId: Value(packId),
cardId: Value(cardId),
order: Value(order),
);
}
factory PreviewCard.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return PreviewCard(
packId: serializer.fromJson<String>(json['packId']),
cardId: serializer.fromJson<String>(json['cardId']),
order: serializer.fromJson<int>(json['order']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'packId': serializer.toJson<String>(packId),
'cardId': serializer.toJson<String>(cardId),
'order': serializer.toJson<int>(order),
};
}
PreviewCard copyWith({String? packId, String? cardId, int? order}) =>
PreviewCard(
packId: packId ?? this.packId,
cardId: cardId ?? this.cardId,
order: order ?? this.order,
);
PreviewCard copyWithCompanion(PreviewCardsCompanion data) {
return PreviewCard(
packId: data.packId.present ? data.packId.value : this.packId,
cardId: data.cardId.present ? data.cardId.value : this.cardId,
order: data.order.present ? data.order.value : this.order,
);
}
@override
String toString() {
return (StringBuffer('PreviewCard(')
..write('packId: $packId, ')
..write('cardId: $cardId, ')
..write('order: $order')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(packId, cardId, order);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is PreviewCard &&
other.packId == this.packId &&
other.cardId == this.cardId &&
other.order == this.order);
}
class PreviewCardsCompanion extends UpdateCompanion<PreviewCard> {
final Value<String> packId;
final Value<String> cardId;
final Value<int> order;
final Value<int> rowid;
const PreviewCardsCompanion({
this.packId = const Value.absent(),
this.cardId = const Value.absent(),
this.order = const Value.absent(),
this.rowid = const Value.absent(),
});
PreviewCardsCompanion.insert({
required String packId,
required String cardId,
this.order = const Value.absent(),
this.rowid = const Value.absent(),
}) : packId = Value(packId),
cardId = Value(cardId);
static Insertable<PreviewCard> custom({
Expression<String>? packId,
Expression<String>? cardId,
Expression<int>? order,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (packId != null) 'pack_id': packId,
if (cardId != null) 'card_id': cardId,
if (order != null) 'order': order,
if (rowid != null) 'rowid': rowid,
});
}
PreviewCardsCompanion copyWith({
Value<String>? packId,
Value<String>? cardId,
Value<int>? order,
Value<int>? rowid,
}) {
return PreviewCardsCompanion(
packId: packId ?? this.packId,
cardId: cardId ?? this.cardId,
order: order ?? this.order,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (packId.present) {
map['pack_id'] = Variable<String>(packId.value);
}
if (cardId.present) {
map['card_id'] = Variable<String>(cardId.value);
}
if (order.present) {
map['order'] = Variable<int>(order.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('PreviewCardsCompanion(')
..write('packId: $packId, ')
..write('cardId: $cardId, ')
..write('order: $order, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $CardPackCardsTable extends CardPackCards
with TableInfo<$CardPackCardsTable, CardPackCard> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$CardPackCardsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _packIdMeta = const VerificationMeta('packId');
@override
late final GeneratedColumn<String> packId = GeneratedColumn<String>(
'pack_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES card_packs (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _cardIdMeta = const VerificationMeta('cardId');
@override
late final GeneratedColumn<String> cardId = GeneratedColumn<String>(
'card_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES game_cards (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _orderMeta = const VerificationMeta('order');
@override
late final GeneratedColumn<int> order = GeneratedColumn<int>(
'order',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
@override
List<GeneratedColumn> get $columns => [packId, cardId, order];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'card_pack_cards';
@override
VerificationContext validateIntegrity(
Insertable<CardPackCard> instance, {
bool isInserting = false,
}) {
final context = VerificationContext();
final data = instance.toColumns(true);
if (data.containsKey('pack_id')) {
context.handle(
_packIdMeta,
packId.isAcceptableOrUnknown(data['pack_id']!, _packIdMeta),
);
} else if (isInserting) {
context.missing(_packIdMeta);
}
if (data.containsKey('card_id')) {
context.handle(
_cardIdMeta,
cardId.isAcceptableOrUnknown(data['card_id']!, _cardIdMeta),
);
} else if (isInserting) {
context.missing(_cardIdMeta);
}
if (data.containsKey('order')) {
context.handle(
_orderMeta,
order.isAcceptableOrUnknown(data['order']!, _orderMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {packId, cardId};
@override
CardPackCard map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return CardPackCard(
packId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}pack_id'],
)!,
cardId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}card_id'],
)!,
order: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}order'],
)!,
);
}
@override
$CardPackCardsTable createAlias(String alias) {
return $CardPackCardsTable(attachedDatabase, alias);
}
}
class CardPackCard extends DataClass implements Insertable<CardPackCard> {
final String packId;
final String cardId;
final int order;
const CardPackCard({
required this.packId,
required this.cardId,
required this.order,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['pack_id'] = Variable<String>(packId);
map['card_id'] = Variable<String>(cardId);
map['order'] = Variable<int>(order);
return map;
}
CardPackCardsCompanion toCompanion(bool nullToAbsent) {
return CardPackCardsCompanion(
packId: Value(packId),
cardId: Value(cardId),
order: Value(order),
);
}
factory CardPackCard.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return CardPackCard(
packId: serializer.fromJson<String>(json['packId']),
cardId: serializer.fromJson<String>(json['cardId']),
order: serializer.fromJson<int>(json['order']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'packId': serializer.toJson<String>(packId),
'cardId': serializer.toJson<String>(cardId),
'order': serializer.toJson<int>(order),
};
}
CardPackCard copyWith({String? packId, String? cardId, int? order}) =>
CardPackCard(
packId: packId ?? this.packId,
cardId: cardId ?? this.cardId,
order: order ?? this.order,
);
CardPackCard copyWithCompanion(CardPackCardsCompanion data) {
return CardPackCard(
packId: data.packId.present ? data.packId.value : this.packId,
cardId: data.cardId.present ? data.cardId.value : this.cardId,
order: data.order.present ? data.order.value : this.order,
);
}
@override
String toString() {
return (StringBuffer('CardPackCard(')
..write('packId: $packId, ')
..write('cardId: $cardId, ')
..write('order: $order')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(packId, cardId, order);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is CardPackCard &&
other.packId == this.packId &&
other.cardId == this.cardId &&
other.order == this.order);
}
class CardPackCardsCompanion extends UpdateCompanion<CardPackCard> {
final Value<String> packId;
final Value<String> cardId;
final Value<int> order;
final Value<int> rowid;
const CardPackCardsCompanion({
this.packId = const Value.absent(),
this.cardId = const Value.absent(),
this.order = const Value.absent(),
this.rowid = const Value.absent(),
});
CardPackCardsCompanion.insert({
required String packId,
required String cardId,
this.order = const Value.absent(),
this.rowid = const Value.absent(),
}) : packId = Value(packId),
cardId = Value(cardId);
static Insertable<CardPackCard> custom({
Expression<String>? packId,
Expression<String>? cardId,
Expression<int>? order,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (packId != null) 'pack_id': packId,
if (cardId != null) 'card_id': cardId,
if (order != null) 'order': order,
if (rowid != null) 'rowid': rowid,
});
}
CardPackCardsCompanion copyWith({
Value<String>? packId,
Value<String>? cardId,
Value<int>? order,
Value<int>? rowid,
}) {
return CardPackCardsCompanion(
packId: packId ?? this.packId,
cardId: cardId ?? this.cardId,
order: order ?? this.order,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (packId.present) {
map['pack_id'] = Variable<String>(packId.value);
}
if (cardId.present) {
map['card_id'] = Variable<String>(cardId.value);
}
if (order.present) {
map['order'] = Variable<int>(order.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('CardPackCardsCompanion(')
..write('packId: $packId, ')
..write('cardId: $cardId, ')
..write('order: $order, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $CardVoicesTable extends CardVoices
with TableInfo<$CardVoicesTable, CardVoice> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$CardVoicesTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _cardIdMeta = const VerificationMeta('cardId');
@override
late final GeneratedColumn<String> cardId = GeneratedColumn<String>(
'card_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES game_cards (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _voiceIdMeta = const VerificationMeta(
'voiceId',
);
@override
late final GeneratedColumn<String> voiceId = GeneratedColumn<String>(
'voice_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES voice_models (id) ON DELETE CASCADE',
),
);
@override
List<GeneratedColumn> get $columns => [cardId, voiceId];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'card_voices';
@override
VerificationContext validateIntegrity(
Insertable<CardVoice> instance, {
bool isInserting = false,
}) {
final context = VerificationContext();
final data = instance.toColumns(true);
if (data.containsKey('card_id')) {
context.handle(
_cardIdMeta,
cardId.isAcceptableOrUnknown(data['card_id']!, _cardIdMeta),
);
} else if (isInserting) {
context.missing(_cardIdMeta);
}
if (data.containsKey('voice_id')) {
context.handle(
_voiceIdMeta,
voiceId.isAcceptableOrUnknown(data['voice_id']!, _voiceIdMeta),
);
} else if (isInserting) {
context.missing(_voiceIdMeta);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {cardId, voiceId};
@override
CardVoice map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return CardVoice(
cardId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}card_id'],
)!,
voiceId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}voice_id'],
)!,
);
}
@override
$CardVoicesTable createAlias(String alias) {
return $CardVoicesTable(attachedDatabase, alias);
}
}
class CardVoice extends DataClass implements Insertable<CardVoice> {
final String cardId;
final String voiceId;
const CardVoice({required this.cardId, required this.voiceId});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['card_id'] = Variable<String>(cardId);
map['voice_id'] = Variable<String>(voiceId);
return map;
}
CardVoicesCompanion toCompanion(bool nullToAbsent) {
return CardVoicesCompanion(cardId: Value(cardId), voiceId: Value(voiceId));
}
factory CardVoice.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return CardVoice(
cardId: serializer.fromJson<String>(json['cardId']),
voiceId: serializer.fromJson<String>(json['voiceId']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'cardId': serializer.toJson<String>(cardId),
'voiceId': serializer.toJson<String>(voiceId),
};
}
CardVoice copyWith({String? cardId, String? voiceId}) => CardVoice(
cardId: cardId ?? this.cardId,
voiceId: voiceId ?? this.voiceId,
);
CardVoice copyWithCompanion(CardVoicesCompanion data) {
return CardVoice(
cardId: data.cardId.present ? data.cardId.value : this.cardId,
voiceId: data.voiceId.present ? data.voiceId.value : this.voiceId,
);
}
@override
String toString() {
return (StringBuffer('CardVoice(')
..write('cardId: $cardId, ')
..write('voiceId: $voiceId')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(cardId, voiceId);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is CardVoice &&
other.cardId == this.cardId &&
other.voiceId == this.voiceId);
}
class CardVoicesCompanion extends UpdateCompanion<CardVoice> {
final Value<String> cardId;
final Value<String> voiceId;
final Value<int> rowid;
const CardVoicesCompanion({
this.cardId = const Value.absent(),
this.voiceId = const Value.absent(),
this.rowid = const Value.absent(),
});
CardVoicesCompanion.insert({
required String cardId,
required String voiceId,
this.rowid = const Value.absent(),
}) : cardId = Value(cardId),
voiceId = Value(voiceId);
static Insertable<CardVoice> custom({
Expression<String>? cardId,
Expression<String>? voiceId,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (cardId != null) 'card_id': cardId,
if (voiceId != null) 'voice_id': voiceId,
if (rowid != null) 'rowid': rowid,
});
}
CardVoicesCompanion copyWith({
Value<String>? cardId,
Value<String>? voiceId,
Value<int>? rowid,
}) {
return CardVoicesCompanion(
cardId: cardId ?? this.cardId,
voiceId: voiceId ?? this.voiceId,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (cardId.present) {
map['card_id'] = Variable<String>(cardId.value);
}
if (voiceId.present) {
map['voice_id'] = Variable<String>(voiceId.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('CardVoicesCompanion(')
..write('cardId: $cardId, ')
..write('voiceId: $voiceId, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $SubscriptionPlansTable extends SubscriptionPlans
with TableInfo<$SubscriptionPlansTable, SubscriptionPlan> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$SubscriptionPlansTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
@override
late final GeneratedColumnWithTypeConverter<Map<String, dynamic>?, String>
ui = GeneratedColumn<String>(
'ui',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
).withConverter<Map<String, dynamic>?>($SubscriptionPlansTable.$converterui);
static const VerificationMeta _priceMeta = const VerificationMeta('price');
@override
late final GeneratedColumn<String> price = GeneratedColumn<String>(
'price',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _currencyMeta = const VerificationMeta(
'currency',
);
@override
late final GeneratedColumn<String> currency = GeneratedColumn<String>(
'currency',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _durationDaysMeta = const VerificationMeta(
'durationDays',
);
@override
late final GeneratedColumn<int> durationDays = GeneratedColumn<int>(
'duration_days',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
);
@override
late final GeneratedColumnWithTypeConverter<List<dynamic>, String> features =
GeneratedColumn<String>(
'features',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
).withConverter<List<dynamic>>(
$SubscriptionPlansTable.$converterfeatures,
);
static const VerificationMeta _paymentIdMeta = const VerificationMeta(
'paymentId',
);
@override
late final GeneratedColumn<String> paymentId = GeneratedColumn<String>(
'payment_id',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _paymentSystemMeta = const VerificationMeta(
'paymentSystem',
);
@override
late final GeneratedColumn<String> paymentSystem = GeneratedColumn<String>(
'payment_system',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
@override
List<GeneratedColumn> get $columns => [
id,
ui,
price,
currency,
durationDays,
features,
paymentId,
paymentSystem,
createdAt,
updatedAt,
isDeleted,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'subscription_plans';
@override
VerificationContext validateIntegrity(
Insertable<SubscriptionPlan> 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('price')) {
context.handle(
_priceMeta,
price.isAcceptableOrUnknown(data['price']!, _priceMeta),
);
} else if (isInserting) {
context.missing(_priceMeta);
}
if (data.containsKey('currency')) {
context.handle(
_currencyMeta,
currency.isAcceptableOrUnknown(data['currency']!, _currencyMeta),
);
} else if (isInserting) {
context.missing(_currencyMeta);
}
if (data.containsKey('duration_days')) {
context.handle(
_durationDaysMeta,
durationDays.isAcceptableOrUnknown(
data['duration_days']!,
_durationDaysMeta,
),
);
} else if (isInserting) {
context.missing(_durationDaysMeta);
}
if (data.containsKey('payment_id')) {
context.handle(
_paymentIdMeta,
paymentId.isAcceptableOrUnknown(data['payment_id']!, _paymentIdMeta),
);
}
if (data.containsKey('payment_system')) {
context.handle(
_paymentSystemMeta,
paymentSystem.isAcceptableOrUnknown(
data['payment_system']!,
_paymentSystemMeta,
),
);
} else if (isInserting) {
context.missing(_paymentSystemMeta);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
SubscriptionPlan map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return SubscriptionPlan(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
ui: $SubscriptionPlansTable.$converterui.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}ui'],
),
),
price: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}price'],
)!,
currency: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}currency'],
)!,
durationDays: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}duration_days'],
)!,
features: $SubscriptionPlansTable.$converterfeatures.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}features'],
)!,
),
paymentId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}payment_id'],
),
paymentSystem: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}payment_system'],
)!,
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
);
}
@override
$SubscriptionPlansTable createAlias(String alias) {
return $SubscriptionPlansTable(attachedDatabase, alias);
}
static TypeConverter<Map<String, dynamic>?, String?> $converterui =
const JsonMapConverter();
static TypeConverter<List<dynamic>, String?> $converterfeatures =
const JsonListConverter();
}
class SubscriptionPlan extends DataClass
implements Insertable<SubscriptionPlan> {
final String id;
final Map<String, dynamic>? ui;
final String price;
final String currency;
final int durationDays;
final List<dynamic> features;
final String? paymentId;
final String paymentSystem;
final PgDateTime createdAt;
final PgDateTime updatedAt;
final bool isDeleted;
const SubscriptionPlan({
required this.id,
this.ui,
required this.price,
required this.currency,
required this.durationDays,
required this.features,
this.paymentId,
required this.paymentSystem,
required this.createdAt,
required this.updatedAt,
required this.isDeleted,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
if (!nullToAbsent || ui != null) {
map['ui'] = Variable<String>(
$SubscriptionPlansTable.$converterui.toSql(ui),
);
}
map['price'] = Variable<String>(price);
map['currency'] = Variable<String>(currency);
map['duration_days'] = Variable<int>(durationDays);
{
map['features'] = Variable<String>(
$SubscriptionPlansTable.$converterfeatures.toSql(features),
);
}
if (!nullToAbsent || paymentId != null) {
map['payment_id'] = Variable<String>(paymentId);
}
map['payment_system'] = Variable<String>(paymentSystem);
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
return map;
}
SubscriptionPlansCompanion toCompanion(bool nullToAbsent) {
return SubscriptionPlansCompanion(
id: Value(id),
ui: ui == null && nullToAbsent ? const Value.absent() : Value(ui),
price: Value(price),
currency: Value(currency),
durationDays: Value(durationDays),
features: Value(features),
paymentId: paymentId == null && nullToAbsent
? const Value.absent()
: Value(paymentId),
paymentSystem: Value(paymentSystem),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
isDeleted: Value(isDeleted),
);
}
factory SubscriptionPlan.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return SubscriptionPlan(
id: serializer.fromJson<String>(json['id']),
ui: serializer.fromJson<Map<String, dynamic>?>(json['ui']),
price: serializer.fromJson<String>(json['price']),
currency: serializer.fromJson<String>(json['currency']),
durationDays: serializer.fromJson<int>(json['durationDays']),
features: serializer.fromJson<List<dynamic>>(json['features']),
paymentId: serializer.fromJson<String?>(json['paymentId']),
paymentSystem: serializer.fromJson<String>(json['paymentSystem']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'ui': serializer.toJson<Map<String, dynamic>?>(ui),
'price': serializer.toJson<String>(price),
'currency': serializer.toJson<String>(currency),
'durationDays': serializer.toJson<int>(durationDays),
'features': serializer.toJson<List<dynamic>>(features),
'paymentId': serializer.toJson<String?>(paymentId),
'paymentSystem': serializer.toJson<String>(paymentSystem),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
};
}
SubscriptionPlan copyWith({
String? id,
Value<Map<String, dynamic>?> ui = const Value.absent(),
String? price,
String? currency,
int? durationDays,
List<dynamic>? features,
Value<String?> paymentId = const Value.absent(),
String? paymentSystem,
PgDateTime? createdAt,
PgDateTime? updatedAt,
bool? isDeleted,
}) => SubscriptionPlan(
id: id ?? this.id,
ui: ui.present ? ui.value : this.ui,
price: price ?? this.price,
currency: currency ?? this.currency,
durationDays: durationDays ?? this.durationDays,
features: features ?? this.features,
paymentId: paymentId.present ? paymentId.value : this.paymentId,
paymentSystem: paymentSystem ?? this.paymentSystem,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
);
SubscriptionPlan copyWithCompanion(SubscriptionPlansCompanion data) {
return SubscriptionPlan(
id: data.id.present ? data.id.value : this.id,
ui: data.ui.present ? data.ui.value : this.ui,
price: data.price.present ? data.price.value : this.price,
currency: data.currency.present ? data.currency.value : this.currency,
durationDays: data.durationDays.present
? data.durationDays.value
: this.durationDays,
features: data.features.present ? data.features.value : this.features,
paymentId: data.paymentId.present ? data.paymentId.value : this.paymentId,
paymentSystem: data.paymentSystem.present
? data.paymentSystem.value
: this.paymentSystem,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
);
}
@override
String toString() {
return (StringBuffer('SubscriptionPlan(')
..write('id: $id, ')
..write('ui: $ui, ')
..write('price: $price, ')
..write('currency: $currency, ')
..write('durationDays: $durationDays, ')
..write('features: $features, ')
..write('paymentId: $paymentId, ')
..write('paymentSystem: $paymentSystem, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
ui,
price,
currency,
durationDays,
features,
paymentId,
paymentSystem,
createdAt,
updatedAt,
isDeleted,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is SubscriptionPlan &&
other.id == this.id &&
other.ui == this.ui &&
other.price == this.price &&
other.currency == this.currency &&
other.durationDays == this.durationDays &&
other.features == this.features &&
other.paymentId == this.paymentId &&
other.paymentSystem == this.paymentSystem &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt &&
other.isDeleted == this.isDeleted);
}
class SubscriptionPlansCompanion extends UpdateCompanion<SubscriptionPlan> {
final Value<String> id;
final Value<Map<String, dynamic>?> ui;
final Value<String> price;
final Value<String> currency;
final Value<int> durationDays;
final Value<List<dynamic>> features;
final Value<String?> paymentId;
final Value<String> paymentSystem;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<bool> isDeleted;
final Value<int> rowid;
const SubscriptionPlansCompanion({
this.id = const Value.absent(),
this.ui = const Value.absent(),
this.price = const Value.absent(),
this.currency = const Value.absent(),
this.durationDays = const Value.absent(),
this.features = const Value.absent(),
this.paymentId = const Value.absent(),
this.paymentSystem = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.rowid = const Value.absent(),
});
SubscriptionPlansCompanion.insert({
this.id = const Value.absent(),
this.ui = const Value.absent(),
required String price,
required String currency,
required int durationDays,
this.features = const Value.absent(),
this.paymentId = const Value.absent(),
required String paymentSystem,
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.rowid = const Value.absent(),
}) : price = Value(price),
currency = Value(currency),
durationDays = Value(durationDays),
paymentSystem = Value(paymentSystem);
static Insertable<SubscriptionPlan> custom({
Expression<String>? id,
Expression<String>? ui,
Expression<String>? price,
Expression<String>? currency,
Expression<int>? durationDays,
Expression<String>? features,
Expression<String>? paymentId,
Expression<String>? paymentSystem,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<bool>? isDeleted,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (ui != null) 'ui': ui,
if (price != null) 'price': price,
if (currency != null) 'currency': currency,
if (durationDays != null) 'duration_days': durationDays,
if (features != null) 'features': features,
if (paymentId != null) 'payment_id': paymentId,
if (paymentSystem != null) 'payment_system': paymentSystem,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (rowid != null) 'rowid': rowid,
});
}
SubscriptionPlansCompanion copyWith({
Value<String>? id,
Value<Map<String, dynamic>?>? ui,
Value<String>? price,
Value<String>? currency,
Value<int>? durationDays,
Value<List<dynamic>>? features,
Value<String?>? paymentId,
Value<String>? paymentSystem,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<bool>? isDeleted,
Value<int>? rowid,
}) {
return SubscriptionPlansCompanion(
id: id ?? this.id,
ui: ui ?? this.ui,
price: price ?? this.price,
currency: currency ?? this.currency,
durationDays: durationDays ?? this.durationDays,
features: features ?? this.features,
paymentId: paymentId ?? this.paymentId,
paymentSystem: paymentSystem ?? this.paymentSystem,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (ui.present) {
map['ui'] = Variable<String>(
$SubscriptionPlansTable.$converterui.toSql(ui.value),
);
}
if (price.present) {
map['price'] = Variable<String>(price.value);
}
if (currency.present) {
map['currency'] = Variable<String>(currency.value);
}
if (durationDays.present) {
map['duration_days'] = Variable<int>(durationDays.value);
}
if (features.present) {
map['features'] = Variable<String>(
$SubscriptionPlansTable.$converterfeatures.toSql(features.value),
);
}
if (paymentId.present) {
map['payment_id'] = Variable<String>(paymentId.value);
}
if (paymentSystem.present) {
map['payment_system'] = Variable<String>(paymentSystem.value);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('SubscriptionPlansCompanion(')
..write('id: $id, ')
..write('ui: $ui, ')
..write('price: $price, ')
..write('currency: $currency, ')
..write('durationDays: $durationDays, ')
..write('features: $features, ')
..write('paymentId: $paymentId, ')
..write('paymentSystem: $paymentSystem, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $UserSubscriptionsTable extends UserSubscriptions
with TableInfo<$UserSubscriptionsTable, UserSubscription> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$UserSubscriptionsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'UNIQUE REFERENCES users (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _startMeta = const VerificationMeta('start');
@override
late final GeneratedColumn<PgDateTime> start = GeneratedColumn<PgDateTime>(
'start',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: true,
);
static const VerificationMeta _finishMeta = const VerificationMeta('finish');
@override
late final GeneratedColumn<PgDateTime> finish = GeneratedColumn<PgDateTime>(
'finish',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: true,
);
@override
late final GeneratedColumnWithTypeConverter<List<dynamic>, String> features =
GeneratedColumn<String>(
'features',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
).withConverter<List<dynamic>>(
$UserSubscriptionsTable.$converterfeatures,
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
@override
List<GeneratedColumn> get $columns => [
id,
userId,
start,
finish,
features,
createdAt,
updatedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'user_subscriptions';
@override
VerificationContext validateIntegrity(
Insertable<UserSubscription> 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('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('start')) {
context.handle(
_startMeta,
start.isAcceptableOrUnknown(data['start']!, _startMeta),
);
} else if (isInserting) {
context.missing(_startMeta);
}
if (data.containsKey('finish')) {
context.handle(
_finishMeta,
finish.isAcceptableOrUnknown(data['finish']!, _finishMeta),
);
} else if (isInserting) {
context.missing(_finishMeta);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
UserSubscription map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return UserSubscription(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
)!,
start: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}start'],
)!,
finish: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}finish'],
)!,
features: $UserSubscriptionsTable.$converterfeatures.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}features'],
)!,
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
);
}
@override
$UserSubscriptionsTable createAlias(String alias) {
return $UserSubscriptionsTable(attachedDatabase, alias);
}
static TypeConverter<List<dynamic>, String?> $converterfeatures =
const JsonListConverter();
}
class UserSubscription extends DataClass
implements Insertable<UserSubscription> {
final String id;
final String userId;
final PgDateTime start;
final PgDateTime finish;
final List<dynamic> features;
final PgDateTime createdAt;
final PgDateTime updatedAt;
const UserSubscription({
required this.id,
required this.userId,
required this.start,
required this.finish,
required this.features,
required this.createdAt,
required this.updatedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['user_id'] = Variable<String>(userId);
map['start'] = Variable<PgDateTime>(start, PgTypes.timestampWithTimezone);
map['finish'] = Variable<PgDateTime>(finish, PgTypes.timestampWithTimezone);
{
map['features'] = Variable<String>(
$UserSubscriptionsTable.$converterfeatures.toSql(features),
);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
return map;
}
UserSubscriptionsCompanion toCompanion(bool nullToAbsent) {
return UserSubscriptionsCompanion(
id: Value(id),
userId: Value(userId),
start: Value(start),
finish: Value(finish),
features: Value(features),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
);
}
factory UserSubscription.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return UserSubscription(
id: serializer.fromJson<String>(json['id']),
userId: serializer.fromJson<String>(json['userId']),
start: serializer.fromJson<PgDateTime>(json['start']),
finish: serializer.fromJson<PgDateTime>(json['finish']),
features: serializer.fromJson<List<dynamic>>(json['features']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'userId': serializer.toJson<String>(userId),
'start': serializer.toJson<PgDateTime>(start),
'finish': serializer.toJson<PgDateTime>(finish),
'features': serializer.toJson<List<dynamic>>(features),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
};
}
UserSubscription copyWith({
String? id,
String? userId,
PgDateTime? start,
PgDateTime? finish,
List<dynamic>? features,
PgDateTime? createdAt,
PgDateTime? updatedAt,
}) => UserSubscription(
id: id ?? this.id,
userId: userId ?? this.userId,
start: start ?? this.start,
finish: finish ?? this.finish,
features: features ?? this.features,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
);
UserSubscription copyWithCompanion(UserSubscriptionsCompanion data) {
return UserSubscription(
id: data.id.present ? data.id.value : this.id,
userId: data.userId.present ? data.userId.value : this.userId,
start: data.start.present ? data.start.value : this.start,
finish: data.finish.present ? data.finish.value : this.finish,
features: data.features.present ? data.features.value : this.features,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
);
}
@override
String toString() {
return (StringBuffer('UserSubscription(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('start: $start, ')
..write('finish: $finish, ')
..write('features: $features, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@override
int get hashCode =>
Object.hash(id, userId, start, finish, features, createdAt, updatedAt);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is UserSubscription &&
other.id == this.id &&
other.userId == this.userId &&
other.start == this.start &&
other.finish == this.finish &&
other.features == this.features &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt);
}
class UserSubscriptionsCompanion extends UpdateCompanion<UserSubscription> {
final Value<String> id;
final Value<String> userId;
final Value<PgDateTime> start;
final Value<PgDateTime> finish;
final Value<List<dynamic>> features;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<int> rowid;
const UserSubscriptionsCompanion({
this.id = const Value.absent(),
this.userId = const Value.absent(),
this.start = const Value.absent(),
this.finish = const Value.absent(),
this.features = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
UserSubscriptionsCompanion.insert({
this.id = const Value.absent(),
required String userId,
required PgDateTime start,
required PgDateTime finish,
this.features = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : userId = Value(userId),
start = Value(start),
finish = Value(finish);
static Insertable<UserSubscription> custom({
Expression<String>? id,
Expression<String>? userId,
Expression<PgDateTime>? start,
Expression<PgDateTime>? finish,
Expression<String>? features,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (userId != null) 'user_id': userId,
if (start != null) 'start': start,
if (finish != null) 'finish': finish,
if (features != null) 'features': features,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (rowid != null) 'rowid': rowid,
});
}
UserSubscriptionsCompanion copyWith({
Value<String>? id,
Value<String>? userId,
Value<PgDateTime>? start,
Value<PgDateTime>? finish,
Value<List<dynamic>>? features,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<int>? rowid,
}) {
return UserSubscriptionsCompanion(
id: id ?? this.id,
userId: userId ?? this.userId,
start: start ?? this.start,
finish: finish ?? this.finish,
features: features ?? this.features,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (start.present) {
map['start'] = Variable<PgDateTime>(
start.value,
PgTypes.timestampWithTimezone,
);
}
if (finish.present) {
map['finish'] = Variable<PgDateTime>(
finish.value,
PgTypes.timestampWithTimezone,
);
}
if (features.present) {
map['features'] = Variable<String>(
$UserSubscriptionsTable.$converterfeatures.toSql(features.value),
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('UserSubscriptionsCompanion(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('start: $start, ')
..write('finish: $finish, ')
..write('features: $features, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $PaymentsTable extends Payments with TableInfo<$PaymentsTable, Payment> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$PaymentsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES users (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _amountMeta = const VerificationMeta('amount');
@override
late final GeneratedColumn<String> amount = GeneratedColumn<String>(
'amount',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _currencyMeta = const VerificationMeta(
'currency',
);
@override
late final GeneratedColumn<String> currency = GeneratedColumn<String>(
'currency',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _statusMeta = const VerificationMeta('status');
@override
late final GeneratedColumn<String> status = GeneratedColumn<String>(
'status',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _paymentSystemMeta = const VerificationMeta(
'paymentSystem',
);
@override
late final GeneratedColumn<String> paymentSystem = GeneratedColumn<String>(
'payment_system',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _externalTokenMeta = const VerificationMeta(
'externalToken',
);
@override
late final GeneratedColumn<String> externalToken = GeneratedColumn<String>(
'external_token',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _metaMeta = const VerificationMeta('meta');
@override
late final GeneratedColumn<String> meta = GeneratedColumn<String>(
'meta',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _dateMeta = const VerificationMeta('date');
@override
late final GeneratedColumn<PgDateTime> date = GeneratedColumn<PgDateTime>(
'date',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
@override
late final GeneratedColumnWithTypeConverter<List<dynamic>, String> products =
GeneratedColumn<String>(
'products',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
).withConverter<List<dynamic>>($PaymentsTable.$converterproducts);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
);
@override
late final GeneratedColumn<PgDateTime> deletedAt =
GeneratedColumn<PgDateTime>(
'deleted_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
@override
List<GeneratedColumn> get $columns => [
id,
userId,
amount,
currency,
status,
paymentSystem,
externalToken,
meta,
date,
products,
createdAt,
updatedAt,
isDeleted,
deletedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'payments';
@override
VerificationContext validateIntegrity(
Insertable<Payment> 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('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('amount')) {
context.handle(
_amountMeta,
amount.isAcceptableOrUnknown(data['amount']!, _amountMeta),
);
} else if (isInserting) {
context.missing(_amountMeta);
}
if (data.containsKey('currency')) {
context.handle(
_currencyMeta,
currency.isAcceptableOrUnknown(data['currency']!, _currencyMeta),
);
} else if (isInserting) {
context.missing(_currencyMeta);
}
if (data.containsKey('status')) {
context.handle(
_statusMeta,
status.isAcceptableOrUnknown(data['status']!, _statusMeta),
);
} else if (isInserting) {
context.missing(_statusMeta);
}
if (data.containsKey('payment_system')) {
context.handle(
_paymentSystemMeta,
paymentSystem.isAcceptableOrUnknown(
data['payment_system']!,
_paymentSystemMeta,
),
);
} else if (isInserting) {
context.missing(_paymentSystemMeta);
}
if (data.containsKey('external_token')) {
context.handle(
_externalTokenMeta,
externalToken.isAcceptableOrUnknown(
data['external_token']!,
_externalTokenMeta,
),
);
}
if (data.containsKey('meta')) {
context.handle(
_metaMeta,
meta.isAcceptableOrUnknown(data['meta']!, _metaMeta),
);
}
if (data.containsKey('date')) {
context.handle(
_dateMeta,
date.isAcceptableOrUnknown(data['date']!, _dateMeta),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
if (data.containsKey('deleted_at')) {
context.handle(
_deletedAtMeta,
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
Payment map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return Payment(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
)!,
amount: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}amount'],
)!,
currency: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}currency'],
)!,
status: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}status'],
)!,
paymentSystem: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}payment_system'],
)!,
externalToken: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}external_token'],
),
meta: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}meta'],
),
date: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}date'],
)!,
products: $PaymentsTable.$converterproducts.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}products'],
)!,
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
deletedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}deleted_at'],
),
);
}
@override
$PaymentsTable createAlias(String alias) {
return $PaymentsTable(attachedDatabase, alias);
}
static TypeConverter<List<dynamic>, String?> $converterproducts =
const JsonListConverter();
}
class Payment extends DataClass implements Insertable<Payment> {
final String id;
final String userId;
final String amount;
final String currency;
final String status;
final String paymentSystem;
final String? externalToken;
final String? meta;
final PgDateTime date;
final List<dynamic> products;
final PgDateTime createdAt;
final PgDateTime updatedAt;
final bool isDeleted;
final PgDateTime? deletedAt;
const Payment({
required this.id,
required this.userId,
required this.amount,
required this.currency,
required this.status,
required this.paymentSystem,
this.externalToken,
this.meta,
required this.date,
required this.products,
required this.createdAt,
required this.updatedAt,
required this.isDeleted,
this.deletedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['user_id'] = Variable<String>(userId);
map['amount'] = Variable<String>(amount);
map['currency'] = Variable<String>(currency);
map['status'] = Variable<String>(status);
map['payment_system'] = Variable<String>(paymentSystem);
if (!nullToAbsent || externalToken != null) {
map['external_token'] = Variable<String>(externalToken);
}
if (!nullToAbsent || meta != null) {
map['meta'] = Variable<String>(meta);
}
map['date'] = Variable<PgDateTime>(date, PgTypes.timestampWithTimezone);
{
map['products'] = Variable<String>(
$PaymentsTable.$converterproducts.toSql(products),
);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
if (!nullToAbsent || deletedAt != null) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt,
PgTypes.timestampWithTimezone,
);
}
return map;
}
PaymentsCompanion toCompanion(bool nullToAbsent) {
return PaymentsCompanion(
id: Value(id),
userId: Value(userId),
amount: Value(amount),
currency: Value(currency),
status: Value(status),
paymentSystem: Value(paymentSystem),
externalToken: externalToken == null && nullToAbsent
? const Value.absent()
: Value(externalToken),
meta: meta == null && nullToAbsent ? const Value.absent() : Value(meta),
date: Value(date),
products: Value(products),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
isDeleted: Value(isDeleted),
deletedAt: deletedAt == null && nullToAbsent
? const Value.absent()
: Value(deletedAt),
);
}
factory Payment.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return Payment(
id: serializer.fromJson<String>(json['id']),
userId: serializer.fromJson<String>(json['userId']),
amount: serializer.fromJson<String>(json['amount']),
currency: serializer.fromJson<String>(json['currency']),
status: serializer.fromJson<String>(json['status']),
paymentSystem: serializer.fromJson<String>(json['paymentSystem']),
externalToken: serializer.fromJson<String?>(json['externalToken']),
meta: serializer.fromJson<String?>(json['meta']),
date: serializer.fromJson<PgDateTime>(json['date']),
products: serializer.fromJson<List<dynamic>>(json['products']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
deletedAt: serializer.fromJson<PgDateTime?>(json['deletedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'userId': serializer.toJson<String>(userId),
'amount': serializer.toJson<String>(amount),
'currency': serializer.toJson<String>(currency),
'status': serializer.toJson<String>(status),
'paymentSystem': serializer.toJson<String>(paymentSystem),
'externalToken': serializer.toJson<String?>(externalToken),
'meta': serializer.toJson<String?>(meta),
'date': serializer.toJson<PgDateTime>(date),
'products': serializer.toJson<List<dynamic>>(products),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
'deletedAt': serializer.toJson<PgDateTime?>(deletedAt),
};
}
Payment copyWith({
String? id,
String? userId,
String? amount,
String? currency,
String? status,
String? paymentSystem,
Value<String?> externalToken = const Value.absent(),
Value<String?> meta = const Value.absent(),
PgDateTime? date,
List<dynamic>? products,
PgDateTime? createdAt,
PgDateTime? updatedAt,
bool? isDeleted,
Value<PgDateTime?> deletedAt = const Value.absent(),
}) => Payment(
id: id ?? this.id,
userId: userId ?? this.userId,
amount: amount ?? this.amount,
currency: currency ?? this.currency,
status: status ?? this.status,
paymentSystem: paymentSystem ?? this.paymentSystem,
externalToken: externalToken.present
? externalToken.value
: this.externalToken,
meta: meta.present ? meta.value : this.meta,
date: date ?? this.date,
products: products ?? this.products,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
);
Payment copyWithCompanion(PaymentsCompanion data) {
return Payment(
id: data.id.present ? data.id.value : this.id,
userId: data.userId.present ? data.userId.value : this.userId,
amount: data.amount.present ? data.amount.value : this.amount,
currency: data.currency.present ? data.currency.value : this.currency,
status: data.status.present ? data.status.value : this.status,
paymentSystem: data.paymentSystem.present
? data.paymentSystem.value
: this.paymentSystem,
externalToken: data.externalToken.present
? data.externalToken.value
: this.externalToken,
meta: data.meta.present ? data.meta.value : this.meta,
date: data.date.present ? data.date.value : this.date,
products: data.products.present ? data.products.value : this.products,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
);
}
@override
String toString() {
return (StringBuffer('Payment(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('amount: $amount, ')
..write('currency: $currency, ')
..write('status: $status, ')
..write('paymentSystem: $paymentSystem, ')
..write('externalToken: $externalToken, ')
..write('meta: $meta, ')
..write('date: $date, ')
..write('products: $products, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
userId,
amount,
currency,
status,
paymentSystem,
externalToken,
meta,
date,
products,
createdAt,
updatedAt,
isDeleted,
deletedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is Payment &&
other.id == this.id &&
other.userId == this.userId &&
other.amount == this.amount &&
other.currency == this.currency &&
other.status == this.status &&
other.paymentSystem == this.paymentSystem &&
other.externalToken == this.externalToken &&
other.meta == this.meta &&
other.date == this.date &&
other.products == this.products &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt &&
other.isDeleted == this.isDeleted &&
other.deletedAt == this.deletedAt);
}
class PaymentsCompanion extends UpdateCompanion<Payment> {
final Value<String> id;
final Value<String> userId;
final Value<String> amount;
final Value<String> currency;
final Value<String> status;
final Value<String> paymentSystem;
final Value<String?> externalToken;
final Value<String?> meta;
final Value<PgDateTime> date;
final Value<List<dynamic>> products;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<bool> isDeleted;
final Value<PgDateTime?> deletedAt;
final Value<int> rowid;
const PaymentsCompanion({
this.id = const Value.absent(),
this.userId = const Value.absent(),
this.amount = const Value.absent(),
this.currency = const Value.absent(),
this.status = const Value.absent(),
this.paymentSystem = const Value.absent(),
this.externalToken = const Value.absent(),
this.meta = const Value.absent(),
this.date = const Value.absent(),
this.products = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
PaymentsCompanion.insert({
this.id = const Value.absent(),
required String userId,
required String amount,
required String currency,
required String status,
required String paymentSystem,
this.externalToken = const Value.absent(),
this.meta = const Value.absent(),
this.date = const Value.absent(),
this.products = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : userId = Value(userId),
amount = Value(amount),
currency = Value(currency),
status = Value(status),
paymentSystem = Value(paymentSystem);
static Insertable<Payment> custom({
Expression<String>? id,
Expression<String>? userId,
Expression<String>? amount,
Expression<String>? currency,
Expression<String>? status,
Expression<String>? paymentSystem,
Expression<String>? externalToken,
Expression<String>? meta,
Expression<PgDateTime>? date,
Expression<String>? products,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<bool>? isDeleted,
Expression<PgDateTime>? deletedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (userId != null) 'user_id': userId,
if (amount != null) 'amount': amount,
if (currency != null) 'currency': currency,
if (status != null) 'status': status,
if (paymentSystem != null) 'payment_system': paymentSystem,
if (externalToken != null) 'external_token': externalToken,
if (meta != null) 'meta': meta,
if (date != null) 'date': date,
if (products != null) 'products': products,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (deletedAt != null) 'deleted_at': deletedAt,
if (rowid != null) 'rowid': rowid,
});
}
PaymentsCompanion copyWith({
Value<String>? id,
Value<String>? userId,
Value<String>? amount,
Value<String>? currency,
Value<String>? status,
Value<String>? paymentSystem,
Value<String?>? externalToken,
Value<String?>? meta,
Value<PgDateTime>? date,
Value<List<dynamic>>? products,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<bool>? isDeleted,
Value<PgDateTime?>? deletedAt,
Value<int>? rowid,
}) {
return PaymentsCompanion(
id: id ?? this.id,
userId: userId ?? this.userId,
amount: amount ?? this.amount,
currency: currency ?? this.currency,
status: status ?? this.status,
paymentSystem: paymentSystem ?? this.paymentSystem,
externalToken: externalToken ?? this.externalToken,
meta: meta ?? this.meta,
date: date ?? this.date,
products: products ?? this.products,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt ?? this.deletedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (amount.present) {
map['amount'] = Variable<String>(amount.value);
}
if (currency.present) {
map['currency'] = Variable<String>(currency.value);
}
if (status.present) {
map['status'] = Variable<String>(status.value);
}
if (paymentSystem.present) {
map['payment_system'] = Variable<String>(paymentSystem.value);
}
if (externalToken.present) {
map['external_token'] = Variable<String>(externalToken.value);
}
if (meta.present) {
map['meta'] = Variable<String>(meta.value);
}
if (date.present) {
map['date'] = Variable<PgDateTime>(
date.value,
PgTypes.timestampWithTimezone,
);
}
if (products.present) {
map['products'] = Variable<String>(
$PaymentsTable.$converterproducts.toSql(products.value),
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (deletedAt.present) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('PaymentsCompanion(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('amount: $amount, ')
..write('currency: $currency, ')
..write('status: $status, ')
..write('paymentSystem: $paymentSystem, ')
..write('externalToken: $externalToken, ')
..write('meta: $meta, ')
..write('date: $date, ')
..write('products: $products, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $TestsTable extends Tests with TableInfo<$TestsTable, Test> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$TestsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _nameMeta = const VerificationMeta('name');
@override
late final GeneratedColumn<String> name = GeneratedColumn<String>(
'name',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _colorMeta = const VerificationMeta('color');
@override
late final GeneratedColumn<String> color = GeneratedColumn<String>(
'color',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _coverMeta = const VerificationMeta('cover');
@override
late final GeneratedColumn<String> cover = GeneratedColumn<String>(
'cover',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _versionMeta = const VerificationMeta(
'version',
);
@override
late final GeneratedColumn<String> version = GeneratedColumn<String>(
'version',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _timeMeta = const VerificationMeta('time');
@override
late final GeneratedColumn<String> time = GeneratedColumn<String>(
'time',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _timeSubtitleMeta = const VerificationMeta(
'timeSubtitle',
);
@override
late final GeneratedColumn<String> timeSubtitle = GeneratedColumn<String>(
'time_subtitle',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
);
@override
late final GeneratedColumn<PgDateTime> deletedAt =
GeneratedColumn<PgDateTime>(
'deleted_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
@override
List<GeneratedColumn> get $columns => [
id,
name,
color,
cover,
version,
time,
timeSubtitle,
createdAt,
updatedAt,
isDeleted,
deletedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'tests';
@override
VerificationContext validateIntegrity(
Insertable<Test> 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('name')) {
context.handle(
_nameMeta,
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
);
} else if (isInserting) {
context.missing(_nameMeta);
}
if (data.containsKey('color')) {
context.handle(
_colorMeta,
color.isAcceptableOrUnknown(data['color']!, _colorMeta),
);
}
if (data.containsKey('cover')) {
context.handle(
_coverMeta,
cover.isAcceptableOrUnknown(data['cover']!, _coverMeta),
);
}
if (data.containsKey('version')) {
context.handle(
_versionMeta,
version.isAcceptableOrUnknown(data['version']!, _versionMeta),
);
}
if (data.containsKey('time')) {
context.handle(
_timeMeta,
time.isAcceptableOrUnknown(data['time']!, _timeMeta),
);
}
if (data.containsKey('time_subtitle')) {
context.handle(
_timeSubtitleMeta,
timeSubtitle.isAcceptableOrUnknown(
data['time_subtitle']!,
_timeSubtitleMeta,
),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
if (data.containsKey('deleted_at')) {
context.handle(
_deletedAtMeta,
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
Test map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return Test(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
name: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}name'],
)!,
color: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}color'],
),
cover: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}cover'],
),
version: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}version'],
),
time: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}time'],
),
timeSubtitle: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}time_subtitle'],
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
deletedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}deleted_at'],
),
);
}
@override
$TestsTable createAlias(String alias) {
return $TestsTable(attachedDatabase, alias);
}
}
class Test extends DataClass implements Insertable<Test> {
final String id;
final String name;
final String? color;
final String? cover;
final String? version;
final String? time;
final String? timeSubtitle;
final PgDateTime createdAt;
final PgDateTime updatedAt;
final bool isDeleted;
final PgDateTime? deletedAt;
const Test({
required this.id,
required this.name,
this.color,
this.cover,
this.version,
this.time,
this.timeSubtitle,
required this.createdAt,
required this.updatedAt,
required this.isDeleted,
this.deletedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['name'] = Variable<String>(name);
if (!nullToAbsent || color != null) {
map['color'] = Variable<String>(color);
}
if (!nullToAbsent || cover != null) {
map['cover'] = Variable<String>(cover);
}
if (!nullToAbsent || version != null) {
map['version'] = Variable<String>(version);
}
if (!nullToAbsent || time != null) {
map['time'] = Variable<String>(time);
}
if (!nullToAbsent || timeSubtitle != null) {
map['time_subtitle'] = Variable<String>(timeSubtitle);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
if (!nullToAbsent || deletedAt != null) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt,
PgTypes.timestampWithTimezone,
);
}
return map;
}
TestsCompanion toCompanion(bool nullToAbsent) {
return TestsCompanion(
id: Value(id),
name: Value(name),
color: color == null && nullToAbsent
? const Value.absent()
: Value(color),
cover: cover == null && nullToAbsent
? const Value.absent()
: Value(cover),
version: version == null && nullToAbsent
? const Value.absent()
: Value(version),
time: time == null && nullToAbsent ? const Value.absent() : Value(time),
timeSubtitle: timeSubtitle == null && nullToAbsent
? const Value.absent()
: Value(timeSubtitle),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
isDeleted: Value(isDeleted),
deletedAt: deletedAt == null && nullToAbsent
? const Value.absent()
: Value(deletedAt),
);
}
factory Test.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return Test(
id: serializer.fromJson<String>(json['id']),
name: serializer.fromJson<String>(json['name']),
color: serializer.fromJson<String?>(json['color']),
cover: serializer.fromJson<String?>(json['cover']),
version: serializer.fromJson<String?>(json['version']),
time: serializer.fromJson<String?>(json['time']),
timeSubtitle: serializer.fromJson<String?>(json['timeSubtitle']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
deletedAt: serializer.fromJson<PgDateTime?>(json['deletedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'name': serializer.toJson<String>(name),
'color': serializer.toJson<String?>(color),
'cover': serializer.toJson<String?>(cover),
'version': serializer.toJson<String?>(version),
'time': serializer.toJson<String?>(time),
'timeSubtitle': serializer.toJson<String?>(timeSubtitle),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
'deletedAt': serializer.toJson<PgDateTime?>(deletedAt),
};
}
Test copyWith({
String? id,
String? name,
Value<String?> color = const Value.absent(),
Value<String?> cover = const Value.absent(),
Value<String?> version = const Value.absent(),
Value<String?> time = const Value.absent(),
Value<String?> timeSubtitle = const Value.absent(),
PgDateTime? createdAt,
PgDateTime? updatedAt,
bool? isDeleted,
Value<PgDateTime?> deletedAt = const Value.absent(),
}) => Test(
id: id ?? this.id,
name: name ?? this.name,
color: color.present ? color.value : this.color,
cover: cover.present ? cover.value : this.cover,
version: version.present ? version.value : this.version,
time: time.present ? time.value : this.time,
timeSubtitle: timeSubtitle.present ? timeSubtitle.value : this.timeSubtitle,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
);
Test copyWithCompanion(TestsCompanion data) {
return Test(
id: data.id.present ? data.id.value : this.id,
name: data.name.present ? data.name.value : this.name,
color: data.color.present ? data.color.value : this.color,
cover: data.cover.present ? data.cover.value : this.cover,
version: data.version.present ? data.version.value : this.version,
time: data.time.present ? data.time.value : this.time,
timeSubtitle: data.timeSubtitle.present
? data.timeSubtitle.value
: this.timeSubtitle,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
);
}
@override
String toString() {
return (StringBuffer('Test(')
..write('id: $id, ')
..write('name: $name, ')
..write('color: $color, ')
..write('cover: $cover, ')
..write('version: $version, ')
..write('time: $time, ')
..write('timeSubtitle: $timeSubtitle, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
name,
color,
cover,
version,
time,
timeSubtitle,
createdAt,
updatedAt,
isDeleted,
deletedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is Test &&
other.id == this.id &&
other.name == this.name &&
other.color == this.color &&
other.cover == this.cover &&
other.version == this.version &&
other.time == this.time &&
other.timeSubtitle == this.timeSubtitle &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt &&
other.isDeleted == this.isDeleted &&
other.deletedAt == this.deletedAt);
}
class TestsCompanion extends UpdateCompanion<Test> {
final Value<String> id;
final Value<String> name;
final Value<String?> color;
final Value<String?> cover;
final Value<String?> version;
final Value<String?> time;
final Value<String?> timeSubtitle;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<bool> isDeleted;
final Value<PgDateTime?> deletedAt;
final Value<int> rowid;
const TestsCompanion({
this.id = const Value.absent(),
this.name = const Value.absent(),
this.color = const Value.absent(),
this.cover = const Value.absent(),
this.version = const Value.absent(),
this.time = const Value.absent(),
this.timeSubtitle = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
TestsCompanion.insert({
this.id = const Value.absent(),
required String name,
this.color = const Value.absent(),
this.cover = const Value.absent(),
this.version = const Value.absent(),
this.time = const Value.absent(),
this.timeSubtitle = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : name = Value(name);
static Insertable<Test> custom({
Expression<String>? id,
Expression<String>? name,
Expression<String>? color,
Expression<String>? cover,
Expression<String>? version,
Expression<String>? time,
Expression<String>? timeSubtitle,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<bool>? isDeleted,
Expression<PgDateTime>? deletedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (name != null) 'name': name,
if (color != null) 'color': color,
if (cover != null) 'cover': cover,
if (version != null) 'version': version,
if (time != null) 'time': time,
if (timeSubtitle != null) 'time_subtitle': timeSubtitle,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (deletedAt != null) 'deleted_at': deletedAt,
if (rowid != null) 'rowid': rowid,
});
}
TestsCompanion copyWith({
Value<String>? id,
Value<String>? name,
Value<String?>? color,
Value<String?>? cover,
Value<String?>? version,
Value<String?>? time,
Value<String?>? timeSubtitle,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<bool>? isDeleted,
Value<PgDateTime?>? deletedAt,
Value<int>? rowid,
}) {
return TestsCompanion(
id: id ?? this.id,
name: name ?? this.name,
color: color ?? this.color,
cover: cover ?? this.cover,
version: version ?? this.version,
time: time ?? this.time,
timeSubtitle: timeSubtitle ?? this.timeSubtitle,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt ?? this.deletedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (name.present) {
map['name'] = Variable<String>(name.value);
}
if (color.present) {
map['color'] = Variable<String>(color.value);
}
if (cover.present) {
map['cover'] = Variable<String>(cover.value);
}
if (version.present) {
map['version'] = Variable<String>(version.value);
}
if (time.present) {
map['time'] = Variable<String>(time.value);
}
if (timeSubtitle.present) {
map['time_subtitle'] = Variable<String>(timeSubtitle.value);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (deletedAt.present) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('TestsCompanion(')
..write('id: $id, ')
..write('name: $name, ')
..write('color: $color, ')
..write('cover: $cover, ')
..write('version: $version, ')
..write('time: $time, ')
..write('timeSubtitle: $timeSubtitle, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $TestQuestionsTable extends TestQuestions
with TableInfo<$TestQuestionsTable, TestQuestion> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$TestQuestionsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _testIdMeta = const VerificationMeta('testId');
@override
late final GeneratedColumn<String> testId = GeneratedColumn<String>(
'test_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES tests (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _orderIndexMeta = const VerificationMeta(
'orderIndex',
);
@override
late final GeneratedColumn<int> orderIndex = GeneratedColumn<int>(
'order_index',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _questionTypeMeta = const VerificationMeta(
'questionType',
);
@override
late final GeneratedColumn<String> questionType = GeneratedColumn<String>(
'question_type',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _wordMeta = const VerificationMeta('word');
@override
late final GeneratedColumn<String> word = GeneratedColumn<String>(
'word',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _answerMeta = const VerificationMeta('answer');
@override
late final GeneratedColumn<String> answer = GeneratedColumn<String>(
'answer',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _optionsMeta = const VerificationMeta(
'options',
);
@override
late final GeneratedColumn<String> options = GeneratedColumn<String>(
'options',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
);
static const VerificationMeta _uiDataMeta = const VerificationMeta('uiData');
@override
late final GeneratedColumn<String> uiData = GeneratedColumn<String>(
'ui_data',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('{}'),
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
);
@override
late final GeneratedColumn<PgDateTime> deletedAt =
GeneratedColumn<PgDateTime>(
'deleted_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
@override
List<GeneratedColumn> get $columns => [
id,
testId,
orderIndex,
questionType,
word,
answer,
options,
uiData,
createdAt,
updatedAt,
isDeleted,
deletedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'test_questions';
@override
VerificationContext validateIntegrity(
Insertable<TestQuestion> 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('test_id')) {
context.handle(
_testIdMeta,
testId.isAcceptableOrUnknown(data['test_id']!, _testIdMeta),
);
} else if (isInserting) {
context.missing(_testIdMeta);
}
if (data.containsKey('order_index')) {
context.handle(
_orderIndexMeta,
orderIndex.isAcceptableOrUnknown(data['order_index']!, _orderIndexMeta),
);
}
if (data.containsKey('question_type')) {
context.handle(
_questionTypeMeta,
questionType.isAcceptableOrUnknown(
data['question_type']!,
_questionTypeMeta,
),
);
} else if (isInserting) {
context.missing(_questionTypeMeta);
}
if (data.containsKey('word')) {
context.handle(
_wordMeta,
word.isAcceptableOrUnknown(data['word']!, _wordMeta),
);
} else if (isInserting) {
context.missing(_wordMeta);
}
if (data.containsKey('answer')) {
context.handle(
_answerMeta,
answer.isAcceptableOrUnknown(data['answer']!, _answerMeta),
);
} else if (isInserting) {
context.missing(_answerMeta);
}
if (data.containsKey('options')) {
context.handle(
_optionsMeta,
options.isAcceptableOrUnknown(data['options']!, _optionsMeta),
);
}
if (data.containsKey('ui_data')) {
context.handle(
_uiDataMeta,
uiData.isAcceptableOrUnknown(data['ui_data']!, _uiDataMeta),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
if (data.containsKey('deleted_at')) {
context.handle(
_deletedAtMeta,
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
TestQuestion map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return TestQuestion(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
testId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}test_id'],
)!,
orderIndex: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}order_index'],
)!,
questionType: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}question_type'],
)!,
word: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}word'],
)!,
answer: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}answer'],
)!,
options: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}options'],
)!,
uiData: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}ui_data'],
)!,
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
deletedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}deleted_at'],
),
);
}
@override
$TestQuestionsTable createAlias(String alias) {
return $TestQuestionsTable(attachedDatabase, alias);
}
}
class TestQuestion extends DataClass implements Insertable<TestQuestion> {
final String id;
final String testId;
final int orderIndex;
final String questionType;
final String word;
final String answer;
final String options;
final String uiData;
final PgDateTime createdAt;
final PgDateTime updatedAt;
final bool isDeleted;
final PgDateTime? deletedAt;
const TestQuestion({
required this.id,
required this.testId,
required this.orderIndex,
required this.questionType,
required this.word,
required this.answer,
required this.options,
required this.uiData,
required this.createdAt,
required this.updatedAt,
required this.isDeleted,
this.deletedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['test_id'] = Variable<String>(testId);
map['order_index'] = Variable<int>(orderIndex);
map['question_type'] = Variable<String>(questionType);
map['word'] = Variable<String>(word);
map['answer'] = Variable<String>(answer);
map['options'] = Variable<String>(options);
map['ui_data'] = Variable<String>(uiData);
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
if (!nullToAbsent || deletedAt != null) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt,
PgTypes.timestampWithTimezone,
);
}
return map;
}
TestQuestionsCompanion toCompanion(bool nullToAbsent) {
return TestQuestionsCompanion(
id: Value(id),
testId: Value(testId),
orderIndex: Value(orderIndex),
questionType: Value(questionType),
word: Value(word),
answer: Value(answer),
options: Value(options),
uiData: Value(uiData),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
isDeleted: Value(isDeleted),
deletedAt: deletedAt == null && nullToAbsent
? const Value.absent()
: Value(deletedAt),
);
}
factory TestQuestion.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return TestQuestion(
id: serializer.fromJson<String>(json['id']),
testId: serializer.fromJson<String>(json['testId']),
orderIndex: serializer.fromJson<int>(json['orderIndex']),
questionType: serializer.fromJson<String>(json['questionType']),
word: serializer.fromJson<String>(json['word']),
answer: serializer.fromJson<String>(json['answer']),
options: serializer.fromJson<String>(json['options']),
uiData: serializer.fromJson<String>(json['uiData']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
deletedAt: serializer.fromJson<PgDateTime?>(json['deletedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'testId': serializer.toJson<String>(testId),
'orderIndex': serializer.toJson<int>(orderIndex),
'questionType': serializer.toJson<String>(questionType),
'word': serializer.toJson<String>(word),
'answer': serializer.toJson<String>(answer),
'options': serializer.toJson<String>(options),
'uiData': serializer.toJson<String>(uiData),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
'deletedAt': serializer.toJson<PgDateTime?>(deletedAt),
};
}
TestQuestion copyWith({
String? id,
String? testId,
int? orderIndex,
String? questionType,
String? word,
String? answer,
String? options,
String? uiData,
PgDateTime? createdAt,
PgDateTime? updatedAt,
bool? isDeleted,
Value<PgDateTime?> deletedAt = const Value.absent(),
}) => TestQuestion(
id: id ?? this.id,
testId: testId ?? this.testId,
orderIndex: orderIndex ?? this.orderIndex,
questionType: questionType ?? this.questionType,
word: word ?? this.word,
answer: answer ?? this.answer,
options: options ?? this.options,
uiData: uiData ?? this.uiData,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
);
TestQuestion copyWithCompanion(TestQuestionsCompanion data) {
return TestQuestion(
id: data.id.present ? data.id.value : this.id,
testId: data.testId.present ? data.testId.value : this.testId,
orderIndex: data.orderIndex.present
? data.orderIndex.value
: this.orderIndex,
questionType: data.questionType.present
? data.questionType.value
: this.questionType,
word: data.word.present ? data.word.value : this.word,
answer: data.answer.present ? data.answer.value : this.answer,
options: data.options.present ? data.options.value : this.options,
uiData: data.uiData.present ? data.uiData.value : this.uiData,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
);
}
@override
String toString() {
return (StringBuffer('TestQuestion(')
..write('id: $id, ')
..write('testId: $testId, ')
..write('orderIndex: $orderIndex, ')
..write('questionType: $questionType, ')
..write('word: $word, ')
..write('answer: $answer, ')
..write('options: $options, ')
..write('uiData: $uiData, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
testId,
orderIndex,
questionType,
word,
answer,
options,
uiData,
createdAt,
updatedAt,
isDeleted,
deletedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is TestQuestion &&
other.id == this.id &&
other.testId == this.testId &&
other.orderIndex == this.orderIndex &&
other.questionType == this.questionType &&
other.word == this.word &&
other.answer == this.answer &&
other.options == this.options &&
other.uiData == this.uiData &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt &&
other.isDeleted == this.isDeleted &&
other.deletedAt == this.deletedAt);
}
class TestQuestionsCompanion extends UpdateCompanion<TestQuestion> {
final Value<String> id;
final Value<String> testId;
final Value<int> orderIndex;
final Value<String> questionType;
final Value<String> word;
final Value<String> answer;
final Value<String> options;
final Value<String> uiData;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<bool> isDeleted;
final Value<PgDateTime?> deletedAt;
final Value<int> rowid;
const TestQuestionsCompanion({
this.id = const Value.absent(),
this.testId = const Value.absent(),
this.orderIndex = const Value.absent(),
this.questionType = const Value.absent(),
this.word = const Value.absent(),
this.answer = const Value.absent(),
this.options = const Value.absent(),
this.uiData = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
TestQuestionsCompanion.insert({
this.id = const Value.absent(),
required String testId,
this.orderIndex = const Value.absent(),
required String questionType,
required String word,
required String answer,
this.options = const Value.absent(),
this.uiData = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : testId = Value(testId),
questionType = Value(questionType),
word = Value(word),
answer = Value(answer);
static Insertable<TestQuestion> custom({
Expression<String>? id,
Expression<String>? testId,
Expression<int>? orderIndex,
Expression<String>? questionType,
Expression<String>? word,
Expression<String>? answer,
Expression<String>? options,
Expression<String>? uiData,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<bool>? isDeleted,
Expression<PgDateTime>? deletedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (testId != null) 'test_id': testId,
if (orderIndex != null) 'order_index': orderIndex,
if (questionType != null) 'question_type': questionType,
if (word != null) 'word': word,
if (answer != null) 'answer': answer,
if (options != null) 'options': options,
if (uiData != null) 'ui_data': uiData,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (deletedAt != null) 'deleted_at': deletedAt,
if (rowid != null) 'rowid': rowid,
});
}
TestQuestionsCompanion copyWith({
Value<String>? id,
Value<String>? testId,
Value<int>? orderIndex,
Value<String>? questionType,
Value<String>? word,
Value<String>? answer,
Value<String>? options,
Value<String>? uiData,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<bool>? isDeleted,
Value<PgDateTime?>? deletedAt,
Value<int>? rowid,
}) {
return TestQuestionsCompanion(
id: id ?? this.id,
testId: testId ?? this.testId,
orderIndex: orderIndex ?? this.orderIndex,
questionType: questionType ?? this.questionType,
word: word ?? this.word,
answer: answer ?? this.answer,
options: options ?? this.options,
uiData: uiData ?? this.uiData,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt ?? this.deletedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (testId.present) {
map['test_id'] = Variable<String>(testId.value);
}
if (orderIndex.present) {
map['order_index'] = Variable<int>(orderIndex.value);
}
if (questionType.present) {
map['question_type'] = Variable<String>(questionType.value);
}
if (word.present) {
map['word'] = Variable<String>(word.value);
}
if (answer.present) {
map['answer'] = Variable<String>(answer.value);
}
if (options.present) {
map['options'] = Variable<String>(options.value);
}
if (uiData.present) {
map['ui_data'] = Variable<String>(uiData.value);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (deletedAt.present) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('TestQuestionsCompanion(')
..write('id: $id, ')
..write('testId: $testId, ')
..write('orderIndex: $orderIndex, ')
..write('questionType: $questionType, ')
..write('word: $word, ')
..write('answer: $answer, ')
..write('options: $options, ')
..write('uiData: $uiData, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $TestPackRelationsTable extends TestPackRelations
with TableInfo<$TestPackRelationsTable, TestPackRelation> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$TestPackRelationsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _testIdMeta = const VerificationMeta('testId');
@override
late final GeneratedColumn<String> testId = GeneratedColumn<String>(
'test_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES tests (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _packIdMeta = const VerificationMeta('packId');
@override
late final GeneratedColumn<String> packId = GeneratedColumn<String>(
'pack_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES card_packs (id) ON DELETE CASCADE',
),
);
@override
List<GeneratedColumn> get $columns => [testId, packId];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'test_pack_relations';
@override
VerificationContext validateIntegrity(
Insertable<TestPackRelation> instance, {
bool isInserting = false,
}) {
final context = VerificationContext();
final data = instance.toColumns(true);
if (data.containsKey('test_id')) {
context.handle(
_testIdMeta,
testId.isAcceptableOrUnknown(data['test_id']!, _testIdMeta),
);
} else if (isInserting) {
context.missing(_testIdMeta);
}
if (data.containsKey('pack_id')) {
context.handle(
_packIdMeta,
packId.isAcceptableOrUnknown(data['pack_id']!, _packIdMeta),
);
} else if (isInserting) {
context.missing(_packIdMeta);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {testId, packId};
@override
TestPackRelation map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return TestPackRelation(
testId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}test_id'],
)!,
packId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}pack_id'],
)!,
);
}
@override
$TestPackRelationsTable createAlias(String alias) {
return $TestPackRelationsTable(attachedDatabase, alias);
}
}
class TestPackRelation extends DataClass
implements Insertable<TestPackRelation> {
final String testId;
final String packId;
const TestPackRelation({required this.testId, required this.packId});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['test_id'] = Variable<String>(testId);
map['pack_id'] = Variable<String>(packId);
return map;
}
TestPackRelationsCompanion toCompanion(bool nullToAbsent) {
return TestPackRelationsCompanion(
testId: Value(testId),
packId: Value(packId),
);
}
factory TestPackRelation.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return TestPackRelation(
testId: serializer.fromJson<String>(json['testId']),
packId: serializer.fromJson<String>(json['packId']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'testId': serializer.toJson<String>(testId),
'packId': serializer.toJson<String>(packId),
};
}
TestPackRelation copyWith({String? testId, String? packId}) =>
TestPackRelation(
testId: testId ?? this.testId,
packId: packId ?? this.packId,
);
TestPackRelation copyWithCompanion(TestPackRelationsCompanion data) {
return TestPackRelation(
testId: data.testId.present ? data.testId.value : this.testId,
packId: data.packId.present ? data.packId.value : this.packId,
);
}
@override
String toString() {
return (StringBuffer('TestPackRelation(')
..write('testId: $testId, ')
..write('packId: $packId')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(testId, packId);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is TestPackRelation &&
other.testId == this.testId &&
other.packId == this.packId);
}
class TestPackRelationsCompanion extends UpdateCompanion<TestPackRelation> {
final Value<String> testId;
final Value<String> packId;
final Value<int> rowid;
const TestPackRelationsCompanion({
this.testId = const Value.absent(),
this.packId = const Value.absent(),
this.rowid = const Value.absent(),
});
TestPackRelationsCompanion.insert({
required String testId,
required String packId,
this.rowid = const Value.absent(),
}) : testId = Value(testId),
packId = Value(packId);
static Insertable<TestPackRelation> custom({
Expression<String>? testId,
Expression<String>? packId,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (testId != null) 'test_id': testId,
if (packId != null) 'pack_id': packId,
if (rowid != null) 'rowid': rowid,
});
}
TestPackRelationsCompanion copyWith({
Value<String>? testId,
Value<String>? packId,
Value<int>? rowid,
}) {
return TestPackRelationsCompanion(
testId: testId ?? this.testId,
packId: packId ?? this.packId,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (testId.present) {
map['test_id'] = Variable<String>(testId.value);
}
if (packId.present) {
map['pack_id'] = Variable<String>(packId.value);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('TestPackRelationsCompanion(')
..write('testId: $testId, ')
..write('packId: $packId, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $TestStatisticsTable extends TestStatistics
with TableInfo<$TestStatisticsTable, TestStatistic> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$TestStatisticsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _testIdMeta = const VerificationMeta('testId');
@override
late final GeneratedColumn<String> testId = GeneratedColumn<String>(
'test_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES tests (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _totalQuestionsMeta = const VerificationMeta(
'totalQuestions',
);
@override
late final GeneratedColumn<int> totalQuestions = GeneratedColumn<int>(
'total_questions',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _correctAnswersMeta = const VerificationMeta(
'correctAnswers',
);
@override
late final GeneratedColumn<int> correctAnswers = GeneratedColumn<int>(
'correct_answers',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _incorrectAnswersMeta = const VerificationMeta(
'incorrectAnswers',
);
@override
late final GeneratedColumn<int> incorrectAnswers = GeneratedColumn<int>(
'incorrect_answers',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _skippedAnswersMeta = const VerificationMeta(
'skippedAnswers',
);
@override
late final GeneratedColumn<int> skippedAnswers = GeneratedColumn<int>(
'skipped_answers',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _scorePercentageMeta = const VerificationMeta(
'scorePercentage',
);
@override
late final GeneratedColumn<double> scorePercentage = GeneratedColumn<double>(
'score_percentage',
aliasedName,
false,
type: DriftSqlType.double,
requiredDuringInsert: false,
defaultValue: const Constant(0.0),
);
static const VerificationMeta _timeSpentSecondsMeta = const VerificationMeta(
'timeSpentSeconds',
);
@override
late final GeneratedColumn<int> timeSpentSeconds = GeneratedColumn<int>(
'time_spent_seconds',
aliasedName,
true,
type: DriftSqlType.int,
requiredDuringInsert: false,
);
static const VerificationMeta _questionResultsMeta = const VerificationMeta(
'questionResults',
);
@override
late final GeneratedColumn<String> questionResults = GeneratedColumn<String>(
'question_results',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
);
static const VerificationMeta _metadataMeta = const VerificationMeta(
'metadata',
);
@override
late final GeneratedColumn<String> metadata = GeneratedColumn<String>(
'metadata',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('{}'),
);
static const VerificationMeta _completedAtMeta = const VerificationMeta(
'completedAt',
);
@override
late final GeneratedColumn<PgDateTime> completedAt =
GeneratedColumn<PgDateTime>(
'completed_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
@override
List<GeneratedColumn> get $columns => [
id,
userId,
testId,
totalQuestions,
correctAnswers,
incorrectAnswers,
skippedAnswers,
scorePercentage,
timeSpentSeconds,
questionResults,
metadata,
completedAt,
createdAt,
updatedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'test_statistics';
@override
VerificationContext validateIntegrity(
Insertable<TestStatistic> 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('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('test_id')) {
context.handle(
_testIdMeta,
testId.isAcceptableOrUnknown(data['test_id']!, _testIdMeta),
);
} else if (isInserting) {
context.missing(_testIdMeta);
}
if (data.containsKey('total_questions')) {
context.handle(
_totalQuestionsMeta,
totalQuestions.isAcceptableOrUnknown(
data['total_questions']!,
_totalQuestionsMeta,
),
);
}
if (data.containsKey('correct_answers')) {
context.handle(
_correctAnswersMeta,
correctAnswers.isAcceptableOrUnknown(
data['correct_answers']!,
_correctAnswersMeta,
),
);
}
if (data.containsKey('incorrect_answers')) {
context.handle(
_incorrectAnswersMeta,
incorrectAnswers.isAcceptableOrUnknown(
data['incorrect_answers']!,
_incorrectAnswersMeta,
),
);
}
if (data.containsKey('skipped_answers')) {
context.handle(
_skippedAnswersMeta,
skippedAnswers.isAcceptableOrUnknown(
data['skipped_answers']!,
_skippedAnswersMeta,
),
);
}
if (data.containsKey('score_percentage')) {
context.handle(
_scorePercentageMeta,
scorePercentage.isAcceptableOrUnknown(
data['score_percentage']!,
_scorePercentageMeta,
),
);
}
if (data.containsKey('time_spent_seconds')) {
context.handle(
_timeSpentSecondsMeta,
timeSpentSeconds.isAcceptableOrUnknown(
data['time_spent_seconds']!,
_timeSpentSecondsMeta,
),
);
}
if (data.containsKey('question_results')) {
context.handle(
_questionResultsMeta,
questionResults.isAcceptableOrUnknown(
data['question_results']!,
_questionResultsMeta,
),
);
}
if (data.containsKey('metadata')) {
context.handle(
_metadataMeta,
metadata.isAcceptableOrUnknown(data['metadata']!, _metadataMeta),
);
}
if (data.containsKey('completed_at')) {
context.handle(
_completedAtMeta,
completedAt.isAcceptableOrUnknown(
data['completed_at']!,
_completedAtMeta,
),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
TestStatistic map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return TestStatistic(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
)!,
testId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}test_id'],
)!,
totalQuestions: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}total_questions'],
)!,
correctAnswers: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}correct_answers'],
)!,
incorrectAnswers: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}incorrect_answers'],
)!,
skippedAnswers: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}skipped_answers'],
)!,
scorePercentage: attachedDatabase.typeMapping.read(
DriftSqlType.double,
data['${effectivePrefix}score_percentage'],
)!,
timeSpentSeconds: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}time_spent_seconds'],
),
questionResults: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}question_results'],
)!,
metadata: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}metadata'],
)!,
completedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}completed_at'],
)!,
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
);
}
@override
$TestStatisticsTable createAlias(String alias) {
return $TestStatisticsTable(attachedDatabase, alias);
}
}
class TestStatistic extends DataClass implements Insertable<TestStatistic> {
final String id;
final String userId;
final String testId;
final int totalQuestions;
final int correctAnswers;
final int incorrectAnswers;
final int skippedAnswers;
final double scorePercentage;
final int? timeSpentSeconds;
final String questionResults;
final String metadata;
final PgDateTime completedAt;
final PgDateTime createdAt;
final PgDateTime updatedAt;
const TestStatistic({
required this.id,
required this.userId,
required this.testId,
required this.totalQuestions,
required this.correctAnswers,
required this.incorrectAnswers,
required this.skippedAnswers,
required this.scorePercentage,
this.timeSpentSeconds,
required this.questionResults,
required this.metadata,
required this.completedAt,
required this.createdAt,
required this.updatedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['user_id'] = Variable<String>(userId);
map['test_id'] = Variable<String>(testId);
map['total_questions'] = Variable<int>(totalQuestions);
map['correct_answers'] = Variable<int>(correctAnswers);
map['incorrect_answers'] = Variable<int>(incorrectAnswers);
map['skipped_answers'] = Variable<int>(skippedAnswers);
map['score_percentage'] = Variable<double>(scorePercentage);
if (!nullToAbsent || timeSpentSeconds != null) {
map['time_spent_seconds'] = Variable<int>(timeSpentSeconds);
}
map['question_results'] = Variable<String>(questionResults);
map['metadata'] = Variable<String>(metadata);
map['completed_at'] = Variable<PgDateTime>(
completedAt,
PgTypes.timestampWithTimezone,
);
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
return map;
}
TestStatisticsCompanion toCompanion(bool nullToAbsent) {
return TestStatisticsCompanion(
id: Value(id),
userId: Value(userId),
testId: Value(testId),
totalQuestions: Value(totalQuestions),
correctAnswers: Value(correctAnswers),
incorrectAnswers: Value(incorrectAnswers),
skippedAnswers: Value(skippedAnswers),
scorePercentage: Value(scorePercentage),
timeSpentSeconds: timeSpentSeconds == null && nullToAbsent
? const Value.absent()
: Value(timeSpentSeconds),
questionResults: Value(questionResults),
metadata: Value(metadata),
completedAt: Value(completedAt),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
);
}
factory TestStatistic.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return TestStatistic(
id: serializer.fromJson<String>(json['id']),
userId: serializer.fromJson<String>(json['userId']),
testId: serializer.fromJson<String>(json['testId']),
totalQuestions: serializer.fromJson<int>(json['totalQuestions']),
correctAnswers: serializer.fromJson<int>(json['correctAnswers']),
incorrectAnswers: serializer.fromJson<int>(json['incorrectAnswers']),
skippedAnswers: serializer.fromJson<int>(json['skippedAnswers']),
scorePercentage: serializer.fromJson<double>(json['scorePercentage']),
timeSpentSeconds: serializer.fromJson<int?>(json['timeSpentSeconds']),
questionResults: serializer.fromJson<String>(json['questionResults']),
metadata: serializer.fromJson<String>(json['metadata']),
completedAt: serializer.fromJson<PgDateTime>(json['completedAt']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'userId': serializer.toJson<String>(userId),
'testId': serializer.toJson<String>(testId),
'totalQuestions': serializer.toJson<int>(totalQuestions),
'correctAnswers': serializer.toJson<int>(correctAnswers),
'incorrectAnswers': serializer.toJson<int>(incorrectAnswers),
'skippedAnswers': serializer.toJson<int>(skippedAnswers),
'scorePercentage': serializer.toJson<double>(scorePercentage),
'timeSpentSeconds': serializer.toJson<int?>(timeSpentSeconds),
'questionResults': serializer.toJson<String>(questionResults),
'metadata': serializer.toJson<String>(metadata),
'completedAt': serializer.toJson<PgDateTime>(completedAt),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
};
}
TestStatistic copyWith({
String? id,
String? userId,
String? testId,
int? totalQuestions,
int? correctAnswers,
int? incorrectAnswers,
int? skippedAnswers,
double? scorePercentage,
Value<int?> timeSpentSeconds = const Value.absent(),
String? questionResults,
String? metadata,
PgDateTime? completedAt,
PgDateTime? createdAt,
PgDateTime? updatedAt,
}) => TestStatistic(
id: id ?? this.id,
userId: userId ?? this.userId,
testId: testId ?? this.testId,
totalQuestions: totalQuestions ?? this.totalQuestions,
correctAnswers: correctAnswers ?? this.correctAnswers,
incorrectAnswers: incorrectAnswers ?? this.incorrectAnswers,
skippedAnswers: skippedAnswers ?? this.skippedAnswers,
scorePercentage: scorePercentage ?? this.scorePercentage,
timeSpentSeconds: timeSpentSeconds.present
? timeSpentSeconds.value
: this.timeSpentSeconds,
questionResults: questionResults ?? this.questionResults,
metadata: metadata ?? this.metadata,
completedAt: completedAt ?? this.completedAt,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
);
TestStatistic copyWithCompanion(TestStatisticsCompanion data) {
return TestStatistic(
id: data.id.present ? data.id.value : this.id,
userId: data.userId.present ? data.userId.value : this.userId,
testId: data.testId.present ? data.testId.value : this.testId,
totalQuestions: data.totalQuestions.present
? data.totalQuestions.value
: this.totalQuestions,
correctAnswers: data.correctAnswers.present
? data.correctAnswers.value
: this.correctAnswers,
incorrectAnswers: data.incorrectAnswers.present
? data.incorrectAnswers.value
: this.incorrectAnswers,
skippedAnswers: data.skippedAnswers.present
? data.skippedAnswers.value
: this.skippedAnswers,
scorePercentage: data.scorePercentage.present
? data.scorePercentage.value
: this.scorePercentage,
timeSpentSeconds: data.timeSpentSeconds.present
? data.timeSpentSeconds.value
: this.timeSpentSeconds,
questionResults: data.questionResults.present
? data.questionResults.value
: this.questionResults,
metadata: data.metadata.present ? data.metadata.value : this.metadata,
completedAt: data.completedAt.present
? data.completedAt.value
: this.completedAt,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
);
}
@override
String toString() {
return (StringBuffer('TestStatistic(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('testId: $testId, ')
..write('totalQuestions: $totalQuestions, ')
..write('correctAnswers: $correctAnswers, ')
..write('incorrectAnswers: $incorrectAnswers, ')
..write('skippedAnswers: $skippedAnswers, ')
..write('scorePercentage: $scorePercentage, ')
..write('timeSpentSeconds: $timeSpentSeconds, ')
..write('questionResults: $questionResults, ')
..write('metadata: $metadata, ')
..write('completedAt: $completedAt, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
userId,
testId,
totalQuestions,
correctAnswers,
incorrectAnswers,
skippedAnswers,
scorePercentage,
timeSpentSeconds,
questionResults,
metadata,
completedAt,
createdAt,
updatedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is TestStatistic &&
other.id == this.id &&
other.userId == this.userId &&
other.testId == this.testId &&
other.totalQuestions == this.totalQuestions &&
other.correctAnswers == this.correctAnswers &&
other.incorrectAnswers == this.incorrectAnswers &&
other.skippedAnswers == this.skippedAnswers &&
other.scorePercentage == this.scorePercentage &&
other.timeSpentSeconds == this.timeSpentSeconds &&
other.questionResults == this.questionResults &&
other.metadata == this.metadata &&
other.completedAt == this.completedAt &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt);
}
class TestStatisticsCompanion extends UpdateCompanion<TestStatistic> {
final Value<String> id;
final Value<String> userId;
final Value<String> testId;
final Value<int> totalQuestions;
final Value<int> correctAnswers;
final Value<int> incorrectAnswers;
final Value<int> skippedAnswers;
final Value<double> scorePercentage;
final Value<int?> timeSpentSeconds;
final Value<String> questionResults;
final Value<String> metadata;
final Value<PgDateTime> completedAt;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<int> rowid;
const TestStatisticsCompanion({
this.id = const Value.absent(),
this.userId = const Value.absent(),
this.testId = const Value.absent(),
this.totalQuestions = const Value.absent(),
this.correctAnswers = const Value.absent(),
this.incorrectAnswers = const Value.absent(),
this.skippedAnswers = const Value.absent(),
this.scorePercentage = const Value.absent(),
this.timeSpentSeconds = const Value.absent(),
this.questionResults = const Value.absent(),
this.metadata = const Value.absent(),
this.completedAt = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
TestStatisticsCompanion.insert({
this.id = const Value.absent(),
required String userId,
required String testId,
this.totalQuestions = const Value.absent(),
this.correctAnswers = const Value.absent(),
this.incorrectAnswers = const Value.absent(),
this.skippedAnswers = const Value.absent(),
this.scorePercentage = const Value.absent(),
this.timeSpentSeconds = const Value.absent(),
this.questionResults = const Value.absent(),
this.metadata = const Value.absent(),
this.completedAt = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : userId = Value(userId),
testId = Value(testId);
static Insertable<TestStatistic> custom({
Expression<String>? id,
Expression<String>? userId,
Expression<String>? testId,
Expression<int>? totalQuestions,
Expression<int>? correctAnswers,
Expression<int>? incorrectAnswers,
Expression<int>? skippedAnswers,
Expression<double>? scorePercentage,
Expression<int>? timeSpentSeconds,
Expression<String>? questionResults,
Expression<String>? metadata,
Expression<PgDateTime>? completedAt,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (userId != null) 'user_id': userId,
if (testId != null) 'test_id': testId,
if (totalQuestions != null) 'total_questions': totalQuestions,
if (correctAnswers != null) 'correct_answers': correctAnswers,
if (incorrectAnswers != null) 'incorrect_answers': incorrectAnswers,
if (skippedAnswers != null) 'skipped_answers': skippedAnswers,
if (scorePercentage != null) 'score_percentage': scorePercentage,
if (timeSpentSeconds != null) 'time_spent_seconds': timeSpentSeconds,
if (questionResults != null) 'question_results': questionResults,
if (metadata != null) 'metadata': metadata,
if (completedAt != null) 'completed_at': completedAt,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (rowid != null) 'rowid': rowid,
});
}
TestStatisticsCompanion copyWith({
Value<String>? id,
Value<String>? userId,
Value<String>? testId,
Value<int>? totalQuestions,
Value<int>? correctAnswers,
Value<int>? incorrectAnswers,
Value<int>? skippedAnswers,
Value<double>? scorePercentage,
Value<int?>? timeSpentSeconds,
Value<String>? questionResults,
Value<String>? metadata,
Value<PgDateTime>? completedAt,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<int>? rowid,
}) {
return TestStatisticsCompanion(
id: id ?? this.id,
userId: userId ?? this.userId,
testId: testId ?? this.testId,
totalQuestions: totalQuestions ?? this.totalQuestions,
correctAnswers: correctAnswers ?? this.correctAnswers,
incorrectAnswers: incorrectAnswers ?? this.incorrectAnswers,
skippedAnswers: skippedAnswers ?? this.skippedAnswers,
scorePercentage: scorePercentage ?? this.scorePercentage,
timeSpentSeconds: timeSpentSeconds ?? this.timeSpentSeconds,
questionResults: questionResults ?? this.questionResults,
metadata: metadata ?? this.metadata,
completedAt: completedAt ?? this.completedAt,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (testId.present) {
map['test_id'] = Variable<String>(testId.value);
}
if (totalQuestions.present) {
map['total_questions'] = Variable<int>(totalQuestions.value);
}
if (correctAnswers.present) {
map['correct_answers'] = Variable<int>(correctAnswers.value);
}
if (incorrectAnswers.present) {
map['incorrect_answers'] = Variable<int>(incorrectAnswers.value);
}
if (skippedAnswers.present) {
map['skipped_answers'] = Variable<int>(skippedAnswers.value);
}
if (scorePercentage.present) {
map['score_percentage'] = Variable<double>(scorePercentage.value);
}
if (timeSpentSeconds.present) {
map['time_spent_seconds'] = Variable<int>(timeSpentSeconds.value);
}
if (questionResults.present) {
map['question_results'] = Variable<String>(questionResults.value);
}
if (metadata.present) {
map['metadata'] = Variable<String>(metadata.value);
}
if (completedAt.present) {
map['completed_at'] = Variable<PgDateTime>(
completedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('TestStatisticsCompanion(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('testId: $testId, ')
..write('totalQuestions: $totalQuestions, ')
..write('correctAnswers: $correctAnswers, ')
..write('incorrectAnswers: $incorrectAnswers, ')
..write('skippedAnswers: $skippedAnswers, ')
..write('scorePercentage: $scorePercentage, ')
..write('timeSpentSeconds: $timeSpentSeconds, ')
..write('questionResults: $questionResults, ')
..write('metadata: $metadata, ')
..write('completedAt: $completedAt, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $TasksTable extends Tasks with TableInfo<$TasksTable, Task> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$TasksTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _nameMeta = const VerificationMeta('name');
@override
late final GeneratedColumn<String> name = GeneratedColumn<String>(
'name',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _minCycleMillisMeta = const VerificationMeta(
'minCycleMillis',
);
@override
late final GeneratedColumn<int> minCycleMillis = GeneratedColumn<int>(
'min_cycle_millis',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
);
static const VerificationMeta _maxCycleMillisMeta = const VerificationMeta(
'maxCycleMillis',
);
@override
late final GeneratedColumn<int> maxCycleMillis = GeneratedColumn<int>(
'max_cycle_millis',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
);
static const VerificationMeta _intervalMillisMeta = const VerificationMeta(
'intervalMillis',
);
@override
late final GeneratedColumn<int> intervalMillis = GeneratedColumn<int>(
'interval_millis',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
);
static const VerificationMeta _timeoutMillisMeta = const VerificationMeta(
'timeoutMillis',
);
@override
late final GeneratedColumn<int> timeoutMillis = GeneratedColumn<int>(
'timeout_millis',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
);
static const VerificationMeta _statusMeta = const VerificationMeta('status');
@override
late final GeneratedColumn<String> status = GeneratedColumn<String>(
'status',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _descriptionMeta = const VerificationMeta(
'description',
);
@override
late final GeneratedColumn<String> description = GeneratedColumn<String>(
'description',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _lastExecutionMeta = const VerificationMeta(
'lastExecution',
);
@override
late final GeneratedColumn<PgDateTime> lastExecution =
GeneratedColumn<PgDateTime>(
'last_execution',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
@override
List<GeneratedColumn> get $columns => [
id,
name,
minCycleMillis,
maxCycleMillis,
intervalMillis,
timeoutMillis,
status,
description,
lastExecution,
createdAt,
updatedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'tasks';
@override
VerificationContext validateIntegrity(
Insertable<Task> 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('name')) {
context.handle(
_nameMeta,
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
);
} else if (isInserting) {
context.missing(_nameMeta);
}
if (data.containsKey('min_cycle_millis')) {
context.handle(
_minCycleMillisMeta,
minCycleMillis.isAcceptableOrUnknown(
data['min_cycle_millis']!,
_minCycleMillisMeta,
),
);
} else if (isInserting) {
context.missing(_minCycleMillisMeta);
}
if (data.containsKey('max_cycle_millis')) {
context.handle(
_maxCycleMillisMeta,
maxCycleMillis.isAcceptableOrUnknown(
data['max_cycle_millis']!,
_maxCycleMillisMeta,
),
);
} else if (isInserting) {
context.missing(_maxCycleMillisMeta);
}
if (data.containsKey('interval_millis')) {
context.handle(
_intervalMillisMeta,
intervalMillis.isAcceptableOrUnknown(
data['interval_millis']!,
_intervalMillisMeta,
),
);
} else if (isInserting) {
context.missing(_intervalMillisMeta);
}
if (data.containsKey('timeout_millis')) {
context.handle(
_timeoutMillisMeta,
timeoutMillis.isAcceptableOrUnknown(
data['timeout_millis']!,
_timeoutMillisMeta,
),
);
} else if (isInserting) {
context.missing(_timeoutMillisMeta);
}
if (data.containsKey('status')) {
context.handle(
_statusMeta,
status.isAcceptableOrUnknown(data['status']!, _statusMeta),
);
}
if (data.containsKey('description')) {
context.handle(
_descriptionMeta,
description.isAcceptableOrUnknown(
data['description']!,
_descriptionMeta,
),
);
}
if (data.containsKey('last_execution')) {
context.handle(
_lastExecutionMeta,
lastExecution.isAcceptableOrUnknown(
data['last_execution']!,
_lastExecutionMeta,
),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
Task map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return Task(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
name: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}name'],
)!,
minCycleMillis: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}min_cycle_millis'],
)!,
maxCycleMillis: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}max_cycle_millis'],
)!,
intervalMillis: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}interval_millis'],
)!,
timeoutMillis: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}timeout_millis'],
)!,
status: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}status'],
),
description: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}description'],
),
lastExecution: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}last_execution'],
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
);
}
@override
$TasksTable createAlias(String alias) {
return $TasksTable(attachedDatabase, alias);
}
}
class Task extends DataClass implements Insertable<Task> {
final String id;
final String name;
final int minCycleMillis;
final int maxCycleMillis;
final int intervalMillis;
final int timeoutMillis;
final String? status;
final String? description;
final PgDateTime? lastExecution;
final PgDateTime createdAt;
final PgDateTime updatedAt;
const Task({
required this.id,
required this.name,
required this.minCycleMillis,
required this.maxCycleMillis,
required this.intervalMillis,
required this.timeoutMillis,
this.status,
this.description,
this.lastExecution,
required this.createdAt,
required this.updatedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['name'] = Variable<String>(name);
map['min_cycle_millis'] = Variable<int>(minCycleMillis);
map['max_cycle_millis'] = Variable<int>(maxCycleMillis);
map['interval_millis'] = Variable<int>(intervalMillis);
map['timeout_millis'] = Variable<int>(timeoutMillis);
if (!nullToAbsent || status != null) {
map['status'] = Variable<String>(status);
}
if (!nullToAbsent || description != null) {
map['description'] = Variable<String>(description);
}
if (!nullToAbsent || lastExecution != null) {
map['last_execution'] = Variable<PgDateTime>(
lastExecution,
PgTypes.timestampWithTimezone,
);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
return map;
}
TasksCompanion toCompanion(bool nullToAbsent) {
return TasksCompanion(
id: Value(id),
name: Value(name),
minCycleMillis: Value(minCycleMillis),
maxCycleMillis: Value(maxCycleMillis),
intervalMillis: Value(intervalMillis),
timeoutMillis: Value(timeoutMillis),
status: status == null && nullToAbsent
? const Value.absent()
: Value(status),
description: description == null && nullToAbsent
? const Value.absent()
: Value(description),
lastExecution: lastExecution == null && nullToAbsent
? const Value.absent()
: Value(lastExecution),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
);
}
factory Task.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return Task(
id: serializer.fromJson<String>(json['id']),
name: serializer.fromJson<String>(json['name']),
minCycleMillis: serializer.fromJson<int>(json['minCycleMillis']),
maxCycleMillis: serializer.fromJson<int>(json['maxCycleMillis']),
intervalMillis: serializer.fromJson<int>(json['intervalMillis']),
timeoutMillis: serializer.fromJson<int>(json['timeoutMillis']),
status: serializer.fromJson<String?>(json['status']),
description: serializer.fromJson<String?>(json['description']),
lastExecution: serializer.fromJson<PgDateTime?>(json['lastExecution']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'name': serializer.toJson<String>(name),
'minCycleMillis': serializer.toJson<int>(minCycleMillis),
'maxCycleMillis': serializer.toJson<int>(maxCycleMillis),
'intervalMillis': serializer.toJson<int>(intervalMillis),
'timeoutMillis': serializer.toJson<int>(timeoutMillis),
'status': serializer.toJson<String?>(status),
'description': serializer.toJson<String?>(description),
'lastExecution': serializer.toJson<PgDateTime?>(lastExecution),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
};
}
Task copyWith({
String? id,
String? name,
int? minCycleMillis,
int? maxCycleMillis,
int? intervalMillis,
int? timeoutMillis,
Value<String?> status = const Value.absent(),
Value<String?> description = const Value.absent(),
Value<PgDateTime?> lastExecution = const Value.absent(),
PgDateTime? createdAt,
PgDateTime? updatedAt,
}) => Task(
id: id ?? this.id,
name: name ?? this.name,
minCycleMillis: minCycleMillis ?? this.minCycleMillis,
maxCycleMillis: maxCycleMillis ?? this.maxCycleMillis,
intervalMillis: intervalMillis ?? this.intervalMillis,
timeoutMillis: timeoutMillis ?? this.timeoutMillis,
status: status.present ? status.value : this.status,
description: description.present ? description.value : this.description,
lastExecution: lastExecution.present
? lastExecution.value
: this.lastExecution,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
);
Task copyWithCompanion(TasksCompanion data) {
return Task(
id: data.id.present ? data.id.value : this.id,
name: data.name.present ? data.name.value : this.name,
minCycleMillis: data.minCycleMillis.present
? data.minCycleMillis.value
: this.minCycleMillis,
maxCycleMillis: data.maxCycleMillis.present
? data.maxCycleMillis.value
: this.maxCycleMillis,
intervalMillis: data.intervalMillis.present
? data.intervalMillis.value
: this.intervalMillis,
timeoutMillis: data.timeoutMillis.present
? data.timeoutMillis.value
: this.timeoutMillis,
status: data.status.present ? data.status.value : this.status,
description: data.description.present
? data.description.value
: this.description,
lastExecution: data.lastExecution.present
? data.lastExecution.value
: this.lastExecution,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
);
}
@override
String toString() {
return (StringBuffer('Task(')
..write('id: $id, ')
..write('name: $name, ')
..write('minCycleMillis: $minCycleMillis, ')
..write('maxCycleMillis: $maxCycleMillis, ')
..write('intervalMillis: $intervalMillis, ')
..write('timeoutMillis: $timeoutMillis, ')
..write('status: $status, ')
..write('description: $description, ')
..write('lastExecution: $lastExecution, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
name,
minCycleMillis,
maxCycleMillis,
intervalMillis,
timeoutMillis,
status,
description,
lastExecution,
createdAt,
updatedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is Task &&
other.id == this.id &&
other.name == this.name &&
other.minCycleMillis == this.minCycleMillis &&
other.maxCycleMillis == this.maxCycleMillis &&
other.intervalMillis == this.intervalMillis &&
other.timeoutMillis == this.timeoutMillis &&
other.status == this.status &&
other.description == this.description &&
other.lastExecution == this.lastExecution &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt);
}
class TasksCompanion extends UpdateCompanion<Task> {
final Value<String> id;
final Value<String> name;
final Value<int> minCycleMillis;
final Value<int> maxCycleMillis;
final Value<int> intervalMillis;
final Value<int> timeoutMillis;
final Value<String?> status;
final Value<String?> description;
final Value<PgDateTime?> lastExecution;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<int> rowid;
const TasksCompanion({
this.id = const Value.absent(),
this.name = const Value.absent(),
this.minCycleMillis = const Value.absent(),
this.maxCycleMillis = const Value.absent(),
this.intervalMillis = const Value.absent(),
this.timeoutMillis = const Value.absent(),
this.status = const Value.absent(),
this.description = const Value.absent(),
this.lastExecution = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
TasksCompanion.insert({
this.id = const Value.absent(),
required String name,
required int minCycleMillis,
required int maxCycleMillis,
required int intervalMillis,
required int timeoutMillis,
this.status = const Value.absent(),
this.description = const Value.absent(),
this.lastExecution = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : name = Value(name),
minCycleMillis = Value(minCycleMillis),
maxCycleMillis = Value(maxCycleMillis),
intervalMillis = Value(intervalMillis),
timeoutMillis = Value(timeoutMillis);
static Insertable<Task> custom({
Expression<String>? id,
Expression<String>? name,
Expression<int>? minCycleMillis,
Expression<int>? maxCycleMillis,
Expression<int>? intervalMillis,
Expression<int>? timeoutMillis,
Expression<String>? status,
Expression<String>? description,
Expression<PgDateTime>? lastExecution,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (name != null) 'name': name,
if (minCycleMillis != null) 'min_cycle_millis': minCycleMillis,
if (maxCycleMillis != null) 'max_cycle_millis': maxCycleMillis,
if (intervalMillis != null) 'interval_millis': intervalMillis,
if (timeoutMillis != null) 'timeout_millis': timeoutMillis,
if (status != null) 'status': status,
if (description != null) 'description': description,
if (lastExecution != null) 'last_execution': lastExecution,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (rowid != null) 'rowid': rowid,
});
}
TasksCompanion copyWith({
Value<String>? id,
Value<String>? name,
Value<int>? minCycleMillis,
Value<int>? maxCycleMillis,
Value<int>? intervalMillis,
Value<int>? timeoutMillis,
Value<String?>? status,
Value<String?>? description,
Value<PgDateTime?>? lastExecution,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<int>? rowid,
}) {
return TasksCompanion(
id: id ?? this.id,
name: name ?? this.name,
minCycleMillis: minCycleMillis ?? this.minCycleMillis,
maxCycleMillis: maxCycleMillis ?? this.maxCycleMillis,
intervalMillis: intervalMillis ?? this.intervalMillis,
timeoutMillis: timeoutMillis ?? this.timeoutMillis,
status: status ?? this.status,
description: description ?? this.description,
lastExecution: lastExecution ?? this.lastExecution,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (name.present) {
map['name'] = Variable<String>(name.value);
}
if (minCycleMillis.present) {
map['min_cycle_millis'] = Variable<int>(minCycleMillis.value);
}
if (maxCycleMillis.present) {
map['max_cycle_millis'] = Variable<int>(maxCycleMillis.value);
}
if (intervalMillis.present) {
map['interval_millis'] = Variable<int>(intervalMillis.value);
}
if (timeoutMillis.present) {
map['timeout_millis'] = Variable<int>(timeoutMillis.value);
}
if (status.present) {
map['status'] = Variable<String>(status.value);
}
if (description.present) {
map['description'] = Variable<String>(description.value);
}
if (lastExecution.present) {
map['last_execution'] = Variable<PgDateTime>(
lastExecution.value,
PgTypes.timestampWithTimezone,
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('TasksCompanion(')
..write('id: $id, ')
..write('name: $name, ')
..write('minCycleMillis: $minCycleMillis, ')
..write('maxCycleMillis: $maxCycleMillis, ')
..write('intervalMillis: $intervalMillis, ')
..write('timeoutMillis: $timeoutMillis, ')
..write('status: $status, ')
..write('description: $description, ')
..write('lastExecution: $lastExecution, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $UserTasksTable extends UserTasks
with TableInfo<$UserTasksTable, UserTask> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$UserTasksTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _titleMeta = const VerificationMeta('title');
@override
late final GeneratedColumn<String> title = GeneratedColumn<String>(
'title',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _descriptionMeta = const VerificationMeta(
'description',
);
@override
late final GeneratedColumn<String> description = GeneratedColumn<String>(
'description',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _typeMeta = const VerificationMeta('type');
@override
late final GeneratedColumn<String> type = GeneratedColumn<String>(
'type',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _difficultyMeta = const VerificationMeta(
'difficulty',
);
@override
late final GeneratedColumn<String> difficulty = GeneratedColumn<String>(
'difficulty',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _statusMeta = const VerificationMeta('status');
@override
late final GeneratedColumn<String> status = GeneratedColumn<String>(
'status',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
@override
late final GeneratedColumnWithTypeConverter<List<dynamic>, String> rewards =
GeneratedColumn<String>(
'rewards',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
).withConverter<List<dynamic>>($UserTasksTable.$converterrewards);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _expiresAtMeta = const VerificationMeta(
'expiresAt',
);
@override
late final GeneratedColumn<PgDateTime> expiresAt =
GeneratedColumn<PgDateTime>(
'expires_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: true,
);
static const VerificationMeta _completedAtMeta = const VerificationMeta(
'completedAt',
);
@override
late final GeneratedColumn<PgDateTime> completedAt =
GeneratedColumn<PgDateTime>(
'completed_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
static const VerificationMeta _proofUrlMeta = const VerificationMeta(
'proofUrl',
);
@override
late final GeneratedColumn<String> proofUrl = GeneratedColumn<String>(
'proof_url',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _instructionsMeta = const VerificationMeta(
'instructions',
);
@override
late final GeneratedColumn<String> instructions = GeneratedColumn<String>(
'instructions',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
@override
late final GeneratedColumnWithTypeConverter<List<String>, String> tags =
GeneratedColumn<String>(
'tags',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
).withConverter<List<String>>($UserTasksTable.$convertertags);
static const VerificationMeta _imageUrlMeta = const VerificationMeta(
'imageUrl',
);
@override
late final GeneratedColumn<String> imageUrl = GeneratedColumn<String>(
'image_url',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
@override
List<GeneratedColumn> get $columns => [
id,
title,
description,
type,
difficulty,
status,
rewards,
createdAt,
expiresAt,
completedAt,
proofUrl,
instructions,
tags,
imageUrl,
updatedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'user_tasks';
@override
VerificationContext validateIntegrity(
Insertable<UserTask> 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('title')) {
context.handle(
_titleMeta,
title.isAcceptableOrUnknown(data['title']!, _titleMeta),
);
} else if (isInserting) {
context.missing(_titleMeta);
}
if (data.containsKey('description')) {
context.handle(
_descriptionMeta,
description.isAcceptableOrUnknown(
data['description']!,
_descriptionMeta,
),
);
} else if (isInserting) {
context.missing(_descriptionMeta);
}
if (data.containsKey('type')) {
context.handle(
_typeMeta,
type.isAcceptableOrUnknown(data['type']!, _typeMeta),
);
} else if (isInserting) {
context.missing(_typeMeta);
}
if (data.containsKey('difficulty')) {
context.handle(
_difficultyMeta,
difficulty.isAcceptableOrUnknown(data['difficulty']!, _difficultyMeta),
);
} else if (isInserting) {
context.missing(_difficultyMeta);
}
if (data.containsKey('status')) {
context.handle(
_statusMeta,
status.isAcceptableOrUnknown(data['status']!, _statusMeta),
);
} else if (isInserting) {
context.missing(_statusMeta);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('expires_at')) {
context.handle(
_expiresAtMeta,
expiresAt.isAcceptableOrUnknown(data['expires_at']!, _expiresAtMeta),
);
} else if (isInserting) {
context.missing(_expiresAtMeta);
}
if (data.containsKey('completed_at')) {
context.handle(
_completedAtMeta,
completedAt.isAcceptableOrUnknown(
data['completed_at']!,
_completedAtMeta,
),
);
}
if (data.containsKey('proof_url')) {
context.handle(
_proofUrlMeta,
proofUrl.isAcceptableOrUnknown(data['proof_url']!, _proofUrlMeta),
);
}
if (data.containsKey('instructions')) {
context.handle(
_instructionsMeta,
instructions.isAcceptableOrUnknown(
data['instructions']!,
_instructionsMeta,
),
);
}
if (data.containsKey('image_url')) {
context.handle(
_imageUrlMeta,
imageUrl.isAcceptableOrUnknown(data['image_url']!, _imageUrlMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
UserTask map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return UserTask(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
title: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}title'],
)!,
description: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}description'],
)!,
type: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}type'],
)!,
difficulty: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}difficulty'],
)!,
status: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}status'],
)!,
rewards: $UserTasksTable.$converterrewards.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}rewards'],
)!,
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
expiresAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}expires_at'],
)!,
completedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}completed_at'],
),
proofUrl: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}proof_url'],
),
instructions: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}instructions'],
),
tags: $UserTasksTable.$convertertags.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}tags'],
)!,
),
imageUrl: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}image_url'],
),
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
);
}
@override
$UserTasksTable createAlias(String alias) {
return $UserTasksTable(attachedDatabase, alias);
}
static TypeConverter<List<dynamic>, String?> $converterrewards =
const JsonListConverter();
static TypeConverter<List<String>, String?> $convertertags =
const StringListConverter();
}
class UserTask extends DataClass implements Insertable<UserTask> {
final String id;
final String title;
final String description;
final String type;
final String difficulty;
final String status;
final List<dynamic> rewards;
final PgDateTime createdAt;
final PgDateTime expiresAt;
final PgDateTime? completedAt;
final String? proofUrl;
final String? instructions;
final List<String> tags;
final String? imageUrl;
final PgDateTime updatedAt;
const UserTask({
required this.id,
required this.title,
required this.description,
required this.type,
required this.difficulty,
required this.status,
required this.rewards,
required this.createdAt,
required this.expiresAt,
this.completedAt,
this.proofUrl,
this.instructions,
required this.tags,
this.imageUrl,
required this.updatedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['title'] = Variable<String>(title);
map['description'] = Variable<String>(description);
map['type'] = Variable<String>(type);
map['difficulty'] = Variable<String>(difficulty);
map['status'] = Variable<String>(status);
{
map['rewards'] = Variable<String>(
$UserTasksTable.$converterrewards.toSql(rewards),
);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['expires_at'] = Variable<PgDateTime>(
expiresAt,
PgTypes.timestampWithTimezone,
);
if (!nullToAbsent || completedAt != null) {
map['completed_at'] = Variable<PgDateTime>(
completedAt,
PgTypes.timestampWithTimezone,
);
}
if (!nullToAbsent || proofUrl != null) {
map['proof_url'] = Variable<String>(proofUrl);
}
if (!nullToAbsent || instructions != null) {
map['instructions'] = Variable<String>(instructions);
}
{
map['tags'] = Variable<String>(
$UserTasksTable.$convertertags.toSql(tags),
);
}
if (!nullToAbsent || imageUrl != null) {
map['image_url'] = Variable<String>(imageUrl);
}
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
return map;
}
UserTasksCompanion toCompanion(bool nullToAbsent) {
return UserTasksCompanion(
id: Value(id),
title: Value(title),
description: Value(description),
type: Value(type),
difficulty: Value(difficulty),
status: Value(status),
rewards: Value(rewards),
createdAt: Value(createdAt),
expiresAt: Value(expiresAt),
completedAt: completedAt == null && nullToAbsent
? const Value.absent()
: Value(completedAt),
proofUrl: proofUrl == null && nullToAbsent
? const Value.absent()
: Value(proofUrl),
instructions: instructions == null && nullToAbsent
? const Value.absent()
: Value(instructions),
tags: Value(tags),
imageUrl: imageUrl == null && nullToAbsent
? const Value.absent()
: Value(imageUrl),
updatedAt: Value(updatedAt),
);
}
factory UserTask.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return UserTask(
id: serializer.fromJson<String>(json['id']),
title: serializer.fromJson<String>(json['title']),
description: serializer.fromJson<String>(json['description']),
type: serializer.fromJson<String>(json['type']),
difficulty: serializer.fromJson<String>(json['difficulty']),
status: serializer.fromJson<String>(json['status']),
rewards: serializer.fromJson<List<dynamic>>(json['rewards']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
expiresAt: serializer.fromJson<PgDateTime>(json['expiresAt']),
completedAt: serializer.fromJson<PgDateTime?>(json['completedAt']),
proofUrl: serializer.fromJson<String?>(json['proofUrl']),
instructions: serializer.fromJson<String?>(json['instructions']),
tags: serializer.fromJson<List<String>>(json['tags']),
imageUrl: serializer.fromJson<String?>(json['imageUrl']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'title': serializer.toJson<String>(title),
'description': serializer.toJson<String>(description),
'type': serializer.toJson<String>(type),
'difficulty': serializer.toJson<String>(difficulty),
'status': serializer.toJson<String>(status),
'rewards': serializer.toJson<List<dynamic>>(rewards),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'expiresAt': serializer.toJson<PgDateTime>(expiresAt),
'completedAt': serializer.toJson<PgDateTime?>(completedAt),
'proofUrl': serializer.toJson<String?>(proofUrl),
'instructions': serializer.toJson<String?>(instructions),
'tags': serializer.toJson<List<String>>(tags),
'imageUrl': serializer.toJson<String?>(imageUrl),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
};
}
UserTask copyWith({
String? id,
String? title,
String? description,
String? type,
String? difficulty,
String? status,
List<dynamic>? rewards,
PgDateTime? createdAt,
PgDateTime? expiresAt,
Value<PgDateTime?> completedAt = const Value.absent(),
Value<String?> proofUrl = const Value.absent(),
Value<String?> instructions = const Value.absent(),
List<String>? tags,
Value<String?> imageUrl = const Value.absent(),
PgDateTime? updatedAt,
}) => UserTask(
id: id ?? this.id,
title: title ?? this.title,
description: description ?? this.description,
type: type ?? this.type,
difficulty: difficulty ?? this.difficulty,
status: status ?? this.status,
rewards: rewards ?? this.rewards,
createdAt: createdAt ?? this.createdAt,
expiresAt: expiresAt ?? this.expiresAt,
completedAt: completedAt.present ? completedAt.value : this.completedAt,
proofUrl: proofUrl.present ? proofUrl.value : this.proofUrl,
instructions: instructions.present ? instructions.value : this.instructions,
tags: tags ?? this.tags,
imageUrl: imageUrl.present ? imageUrl.value : this.imageUrl,
updatedAt: updatedAt ?? this.updatedAt,
);
UserTask copyWithCompanion(UserTasksCompanion data) {
return UserTask(
id: data.id.present ? data.id.value : this.id,
title: data.title.present ? data.title.value : this.title,
description: data.description.present
? data.description.value
: this.description,
type: data.type.present ? data.type.value : this.type,
difficulty: data.difficulty.present
? data.difficulty.value
: this.difficulty,
status: data.status.present ? data.status.value : this.status,
rewards: data.rewards.present ? data.rewards.value : this.rewards,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
expiresAt: data.expiresAt.present ? data.expiresAt.value : this.expiresAt,
completedAt: data.completedAt.present
? data.completedAt.value
: this.completedAt,
proofUrl: data.proofUrl.present ? data.proofUrl.value : this.proofUrl,
instructions: data.instructions.present
? data.instructions.value
: this.instructions,
tags: data.tags.present ? data.tags.value : this.tags,
imageUrl: data.imageUrl.present ? data.imageUrl.value : this.imageUrl,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
);
}
@override
String toString() {
return (StringBuffer('UserTask(')
..write('id: $id, ')
..write('title: $title, ')
..write('description: $description, ')
..write('type: $type, ')
..write('difficulty: $difficulty, ')
..write('status: $status, ')
..write('rewards: $rewards, ')
..write('createdAt: $createdAt, ')
..write('expiresAt: $expiresAt, ')
..write('completedAt: $completedAt, ')
..write('proofUrl: $proofUrl, ')
..write('instructions: $instructions, ')
..write('tags: $tags, ')
..write('imageUrl: $imageUrl, ')
..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
title,
description,
type,
difficulty,
status,
rewards,
createdAt,
expiresAt,
completedAt,
proofUrl,
instructions,
tags,
imageUrl,
updatedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is UserTask &&
other.id == this.id &&
other.title == this.title &&
other.description == this.description &&
other.type == this.type &&
other.difficulty == this.difficulty &&
other.status == this.status &&
other.rewards == this.rewards &&
other.createdAt == this.createdAt &&
other.expiresAt == this.expiresAt &&
other.completedAt == this.completedAt &&
other.proofUrl == this.proofUrl &&
other.instructions == this.instructions &&
other.tags == this.tags &&
other.imageUrl == this.imageUrl &&
other.updatedAt == this.updatedAt);
}
class UserTasksCompanion extends UpdateCompanion<UserTask> {
final Value<String> id;
final Value<String> title;
final Value<String> description;
final Value<String> type;
final Value<String> difficulty;
final Value<String> status;
final Value<List<dynamic>> rewards;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> expiresAt;
final Value<PgDateTime?> completedAt;
final Value<String?> proofUrl;
final Value<String?> instructions;
final Value<List<String>> tags;
final Value<String?> imageUrl;
final Value<PgDateTime> updatedAt;
final Value<int> rowid;
const UserTasksCompanion({
this.id = const Value.absent(),
this.title = const Value.absent(),
this.description = const Value.absent(),
this.type = const Value.absent(),
this.difficulty = const Value.absent(),
this.status = const Value.absent(),
this.rewards = const Value.absent(),
this.createdAt = const Value.absent(),
this.expiresAt = const Value.absent(),
this.completedAt = const Value.absent(),
this.proofUrl = const Value.absent(),
this.instructions = const Value.absent(),
this.tags = const Value.absent(),
this.imageUrl = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
UserTasksCompanion.insert({
this.id = const Value.absent(),
required String title,
required String description,
required String type,
required String difficulty,
required String status,
this.rewards = const Value.absent(),
this.createdAt = const Value.absent(),
required PgDateTime expiresAt,
this.completedAt = const Value.absent(),
this.proofUrl = const Value.absent(),
this.instructions = const Value.absent(),
this.tags = const Value.absent(),
this.imageUrl = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : title = Value(title),
description = Value(description),
type = Value(type),
difficulty = Value(difficulty),
status = Value(status),
expiresAt = Value(expiresAt);
static Insertable<UserTask> custom({
Expression<String>? id,
Expression<String>? title,
Expression<String>? description,
Expression<String>? type,
Expression<String>? difficulty,
Expression<String>? status,
Expression<String>? rewards,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? expiresAt,
Expression<PgDateTime>? completedAt,
Expression<String>? proofUrl,
Expression<String>? instructions,
Expression<String>? tags,
Expression<String>? imageUrl,
Expression<PgDateTime>? updatedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (title != null) 'title': title,
if (description != null) 'description': description,
if (type != null) 'type': type,
if (difficulty != null) 'difficulty': difficulty,
if (status != null) 'status': status,
if (rewards != null) 'rewards': rewards,
if (createdAt != null) 'created_at': createdAt,
if (expiresAt != null) 'expires_at': expiresAt,
if (completedAt != null) 'completed_at': completedAt,
if (proofUrl != null) 'proof_url': proofUrl,
if (instructions != null) 'instructions': instructions,
if (tags != null) 'tags': tags,
if (imageUrl != null) 'image_url': imageUrl,
if (updatedAt != null) 'updated_at': updatedAt,
if (rowid != null) 'rowid': rowid,
});
}
UserTasksCompanion copyWith({
Value<String>? id,
Value<String>? title,
Value<String>? description,
Value<String>? type,
Value<String>? difficulty,
Value<String>? status,
Value<List<dynamic>>? rewards,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? expiresAt,
Value<PgDateTime?>? completedAt,
Value<String?>? proofUrl,
Value<String?>? instructions,
Value<List<String>>? tags,
Value<String?>? imageUrl,
Value<PgDateTime>? updatedAt,
Value<int>? rowid,
}) {
return UserTasksCompanion(
id: id ?? this.id,
title: title ?? this.title,
description: description ?? this.description,
type: type ?? this.type,
difficulty: difficulty ?? this.difficulty,
status: status ?? this.status,
rewards: rewards ?? this.rewards,
createdAt: createdAt ?? this.createdAt,
expiresAt: expiresAt ?? this.expiresAt,
completedAt: completedAt ?? this.completedAt,
proofUrl: proofUrl ?? this.proofUrl,
instructions: instructions ?? this.instructions,
tags: tags ?? this.tags,
imageUrl: imageUrl ?? this.imageUrl,
updatedAt: updatedAt ?? this.updatedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (title.present) {
map['title'] = Variable<String>(title.value);
}
if (description.present) {
map['description'] = Variable<String>(description.value);
}
if (type.present) {
map['type'] = Variable<String>(type.value);
}
if (difficulty.present) {
map['difficulty'] = Variable<String>(difficulty.value);
}
if (status.present) {
map['status'] = Variable<String>(status.value);
}
if (rewards.present) {
map['rewards'] = Variable<String>(
$UserTasksTable.$converterrewards.toSql(rewards.value),
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (expiresAt.present) {
map['expires_at'] = Variable<PgDateTime>(
expiresAt.value,
PgTypes.timestampWithTimezone,
);
}
if (completedAt.present) {
map['completed_at'] = Variable<PgDateTime>(
completedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (proofUrl.present) {
map['proof_url'] = Variable<String>(proofUrl.value);
}
if (instructions.present) {
map['instructions'] = Variable<String>(instructions.value);
}
if (tags.present) {
map['tags'] = Variable<String>(
$UserTasksTable.$convertertags.toSql(tags.value),
);
}
if (imageUrl.present) {
map['image_url'] = Variable<String>(imageUrl.value);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('UserTasksCompanion(')
..write('id: $id, ')
..write('title: $title, ')
..write('description: $description, ')
..write('type: $type, ')
..write('difficulty: $difficulty, ')
..write('status: $status, ')
..write('rewards: $rewards, ')
..write('createdAt: $createdAt, ')
..write('expiresAt: $expiresAt, ')
..write('completedAt: $completedAt, ')
..write('proofUrl: $proofUrl, ')
..write('instructions: $instructions, ')
..write('tags: $tags, ')
..write('imageUrl: $imageUrl, ')
..write('updatedAt: $updatedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $UserTaskProgressesTable extends UserTaskProgresses
with TableInfo<$UserTaskProgressesTable, UserTaskProgressesData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$UserTaskProgressesTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES users (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _taskIdMeta = const VerificationMeta('taskId');
@override
late final GeneratedColumn<String> taskId = GeneratedColumn<String>(
'task_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
@override
late final GeneratedColumnWithTypeConverter<Map<String, dynamic>?, String>
progress =
GeneratedColumn<String>(
'progress',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('{}'),
).withConverter<Map<String, dynamic>?>(
$UserTaskProgressesTable.$converterprogress,
);
static const VerificationMeta _startedAtMeta = const VerificationMeta(
'startedAt',
);
@override
late final GeneratedColumn<PgDateTime> startedAt =
GeneratedColumn<PgDateTime>(
'started_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
@override
List<GeneratedColumn> get $columns => [
id,
userId,
taskId,
progress,
startedAt,
updatedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'user_task_progresses';
@override
VerificationContext validateIntegrity(
Insertable<UserTaskProgressesData> 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('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('task_id')) {
context.handle(
_taskIdMeta,
taskId.isAcceptableOrUnknown(data['task_id']!, _taskIdMeta),
);
} else if (isInserting) {
context.missing(_taskIdMeta);
}
if (data.containsKey('started_at')) {
context.handle(
_startedAtMeta,
startedAt.isAcceptableOrUnknown(data['started_at']!, _startedAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
UserTaskProgressesData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return UserTaskProgressesData(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
)!,
taskId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}task_id'],
)!,
progress: $UserTaskProgressesTable.$converterprogress.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}progress'],
)!,
),
startedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}started_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
);
}
@override
$UserTaskProgressesTable createAlias(String alias) {
return $UserTaskProgressesTable(attachedDatabase, alias);
}
static TypeConverter<Map<String, dynamic>?, String?> $converterprogress =
const JsonMapConverter();
}
class UserTaskProgressesData extends DataClass
implements Insertable<UserTaskProgressesData> {
final String id;
final String userId;
final String taskId;
final Map<String, dynamic>? progress;
final PgDateTime startedAt;
final PgDateTime updatedAt;
const UserTaskProgressesData({
required this.id,
required this.userId,
required this.taskId,
this.progress,
required this.startedAt,
required this.updatedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['user_id'] = Variable<String>(userId);
map['task_id'] = Variable<String>(taskId);
if (!nullToAbsent || progress != null) {
map['progress'] = Variable<String>(
$UserTaskProgressesTable.$converterprogress.toSql(progress),
);
}
map['started_at'] = Variable<PgDateTime>(
startedAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
return map;
}
UserTaskProgressesCompanion toCompanion(bool nullToAbsent) {
return UserTaskProgressesCompanion(
id: Value(id),
userId: Value(userId),
taskId: Value(taskId),
progress: progress == null && nullToAbsent
? const Value.absent()
: Value(progress),
startedAt: Value(startedAt),
updatedAt: Value(updatedAt),
);
}
factory UserTaskProgressesData.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return UserTaskProgressesData(
id: serializer.fromJson<String>(json['id']),
userId: serializer.fromJson<String>(json['userId']),
taskId: serializer.fromJson<String>(json['taskId']),
progress: serializer.fromJson<Map<String, dynamic>?>(json['progress']),
startedAt: serializer.fromJson<PgDateTime>(json['startedAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'userId': serializer.toJson<String>(userId),
'taskId': serializer.toJson<String>(taskId),
'progress': serializer.toJson<Map<String, dynamic>?>(progress),
'startedAt': serializer.toJson<PgDateTime>(startedAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
};
}
UserTaskProgressesData copyWith({
String? id,
String? userId,
String? taskId,
Value<Map<String, dynamic>?> progress = const Value.absent(),
PgDateTime? startedAt,
PgDateTime? updatedAt,
}) => UserTaskProgressesData(
id: id ?? this.id,
userId: userId ?? this.userId,
taskId: taskId ?? this.taskId,
progress: progress.present ? progress.value : this.progress,
startedAt: startedAt ?? this.startedAt,
updatedAt: updatedAt ?? this.updatedAt,
);
UserTaskProgressesData copyWithCompanion(UserTaskProgressesCompanion data) {
return UserTaskProgressesData(
id: data.id.present ? data.id.value : this.id,
userId: data.userId.present ? data.userId.value : this.userId,
taskId: data.taskId.present ? data.taskId.value : this.taskId,
progress: data.progress.present ? data.progress.value : this.progress,
startedAt: data.startedAt.present ? data.startedAt.value : this.startedAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
);
}
@override
String toString() {
return (StringBuffer('UserTaskProgressesData(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('taskId: $taskId, ')
..write('progress: $progress, ')
..write('startedAt: $startedAt, ')
..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@override
int get hashCode =>
Object.hash(id, userId, taskId, progress, startedAt, updatedAt);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is UserTaskProgressesData &&
other.id == this.id &&
other.userId == this.userId &&
other.taskId == this.taskId &&
other.progress == this.progress &&
other.startedAt == this.startedAt &&
other.updatedAt == this.updatedAt);
}
class UserTaskProgressesCompanion
extends UpdateCompanion<UserTaskProgressesData> {
final Value<String> id;
final Value<String> userId;
final Value<String> taskId;
final Value<Map<String, dynamic>?> progress;
final Value<PgDateTime> startedAt;
final Value<PgDateTime> updatedAt;
final Value<int> rowid;
const UserTaskProgressesCompanion({
this.id = const Value.absent(),
this.userId = const Value.absent(),
this.taskId = const Value.absent(),
this.progress = const Value.absent(),
this.startedAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
UserTaskProgressesCompanion.insert({
this.id = const Value.absent(),
required String userId,
required String taskId,
this.progress = const Value.absent(),
this.startedAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : userId = Value(userId),
taskId = Value(taskId);
static Insertable<UserTaskProgressesData> custom({
Expression<String>? id,
Expression<String>? userId,
Expression<String>? taskId,
Expression<String>? progress,
Expression<PgDateTime>? startedAt,
Expression<PgDateTime>? updatedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (userId != null) 'user_id': userId,
if (taskId != null) 'task_id': taskId,
if (progress != null) 'progress': progress,
if (startedAt != null) 'started_at': startedAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (rowid != null) 'rowid': rowid,
});
}
UserTaskProgressesCompanion copyWith({
Value<String>? id,
Value<String>? userId,
Value<String>? taskId,
Value<Map<String, dynamic>?>? progress,
Value<PgDateTime>? startedAt,
Value<PgDateTime>? updatedAt,
Value<int>? rowid,
}) {
return UserTaskProgressesCompanion(
id: id ?? this.id,
userId: userId ?? this.userId,
taskId: taskId ?? this.taskId,
progress: progress ?? this.progress,
startedAt: startedAt ?? this.startedAt,
updatedAt: updatedAt ?? this.updatedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (taskId.present) {
map['task_id'] = Variable<String>(taskId.value);
}
if (progress.present) {
map['progress'] = Variable<String>(
$UserTaskProgressesTable.$converterprogress.toSql(progress.value),
);
}
if (startedAt.present) {
map['started_at'] = Variable<PgDateTime>(
startedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('UserTaskProgressesCompanion(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('taskId: $taskId, ')
..write('progress: $progress, ')
..write('startedAt: $startedAt, ')
..write('updatedAt: $updatedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $UserTaskResultsTable extends UserTaskResults
with TableInfo<$UserTaskResultsTable, UserTaskResult> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$UserTaskResultsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES users (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _taskIdMeta = const VerificationMeta('taskId');
@override
late final GeneratedColumn<String> taskId = GeneratedColumn<String>(
'task_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
@override
late final GeneratedColumnWithTypeConverter<Map<String, dynamic>?, String>
results =
GeneratedColumn<String>(
'results',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('{}'),
).withConverter<Map<String, dynamic>?>(
$UserTaskResultsTable.$converterresults,
);
static const VerificationMeta _completedAtMeta = const VerificationMeta(
'completedAt',
);
@override
late final GeneratedColumn<PgDateTime> completedAt =
GeneratedColumn<PgDateTime>(
'completed_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
@override
List<GeneratedColumn> get $columns => [
id,
userId,
taskId,
results,
completedAt,
createdAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'user_task_results';
@override
VerificationContext validateIntegrity(
Insertable<UserTaskResult> 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('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('task_id')) {
context.handle(
_taskIdMeta,
taskId.isAcceptableOrUnknown(data['task_id']!, _taskIdMeta),
);
} else if (isInserting) {
context.missing(_taskIdMeta);
}
if (data.containsKey('completed_at')) {
context.handle(
_completedAtMeta,
completedAt.isAcceptableOrUnknown(
data['completed_at']!,
_completedAtMeta,
),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
UserTaskResult map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return UserTaskResult(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
)!,
taskId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}task_id'],
)!,
results: $UserTaskResultsTable.$converterresults.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}results'],
)!,
),
completedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}completed_at'],
)!,
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
);
}
@override
$UserTaskResultsTable createAlias(String alias) {
return $UserTaskResultsTable(attachedDatabase, alias);
}
static TypeConverter<Map<String, dynamic>?, String?> $converterresults =
const JsonMapConverter();
}
class UserTaskResult extends DataClass implements Insertable<UserTaskResult> {
final String id;
final String userId;
final String taskId;
final Map<String, dynamic>? results;
final PgDateTime completedAt;
final PgDateTime createdAt;
const UserTaskResult({
required this.id,
required this.userId,
required this.taskId,
this.results,
required this.completedAt,
required this.createdAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['user_id'] = Variable<String>(userId);
map['task_id'] = Variable<String>(taskId);
if (!nullToAbsent || results != null) {
map['results'] = Variable<String>(
$UserTaskResultsTable.$converterresults.toSql(results),
);
}
map['completed_at'] = Variable<PgDateTime>(
completedAt,
PgTypes.timestampWithTimezone,
);
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
return map;
}
UserTaskResultsCompanion toCompanion(bool nullToAbsent) {
return UserTaskResultsCompanion(
id: Value(id),
userId: Value(userId),
taskId: Value(taskId),
results: results == null && nullToAbsent
? const Value.absent()
: Value(results),
completedAt: Value(completedAt),
createdAt: Value(createdAt),
);
}
factory UserTaskResult.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return UserTaskResult(
id: serializer.fromJson<String>(json['id']),
userId: serializer.fromJson<String>(json['userId']),
taskId: serializer.fromJson<String>(json['taskId']),
results: serializer.fromJson<Map<String, dynamic>?>(json['results']),
completedAt: serializer.fromJson<PgDateTime>(json['completedAt']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'userId': serializer.toJson<String>(userId),
'taskId': serializer.toJson<String>(taskId),
'results': serializer.toJson<Map<String, dynamic>?>(results),
'completedAt': serializer.toJson<PgDateTime>(completedAt),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
};
}
UserTaskResult copyWith({
String? id,
String? userId,
String? taskId,
Value<Map<String, dynamic>?> results = const Value.absent(),
PgDateTime? completedAt,
PgDateTime? createdAt,
}) => UserTaskResult(
id: id ?? this.id,
userId: userId ?? this.userId,
taskId: taskId ?? this.taskId,
results: results.present ? results.value : this.results,
completedAt: completedAt ?? this.completedAt,
createdAt: createdAt ?? this.createdAt,
);
UserTaskResult copyWithCompanion(UserTaskResultsCompanion data) {
return UserTaskResult(
id: data.id.present ? data.id.value : this.id,
userId: data.userId.present ? data.userId.value : this.userId,
taskId: data.taskId.present ? data.taskId.value : this.taskId,
results: data.results.present ? data.results.value : this.results,
completedAt: data.completedAt.present
? data.completedAt.value
: this.completedAt,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
);
}
@override
String toString() {
return (StringBuffer('UserTaskResult(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('taskId: $taskId, ')
..write('results: $results, ')
..write('completedAt: $completedAt, ')
..write('createdAt: $createdAt')
..write(')'))
.toString();
}
@override
int get hashCode =>
Object.hash(id, userId, taskId, results, completedAt, createdAt);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is UserTaskResult &&
other.id == this.id &&
other.userId == this.userId &&
other.taskId == this.taskId &&
other.results == this.results &&
other.completedAt == this.completedAt &&
other.createdAt == this.createdAt);
}
class UserTaskResultsCompanion extends UpdateCompanion<UserTaskResult> {
final Value<String> id;
final Value<String> userId;
final Value<String> taskId;
final Value<Map<String, dynamic>?> results;
final Value<PgDateTime> completedAt;
final Value<PgDateTime> createdAt;
final Value<int> rowid;
const UserTaskResultsCompanion({
this.id = const Value.absent(),
this.userId = const Value.absent(),
this.taskId = const Value.absent(),
this.results = const Value.absent(),
this.completedAt = const Value.absent(),
this.createdAt = const Value.absent(),
this.rowid = const Value.absent(),
});
UserTaskResultsCompanion.insert({
this.id = const Value.absent(),
required String userId,
required String taskId,
this.results = const Value.absent(),
this.completedAt = const Value.absent(),
this.createdAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : userId = Value(userId),
taskId = Value(taskId);
static Insertable<UserTaskResult> custom({
Expression<String>? id,
Expression<String>? userId,
Expression<String>? taskId,
Expression<String>? results,
Expression<PgDateTime>? completedAt,
Expression<PgDateTime>? createdAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (userId != null) 'user_id': userId,
if (taskId != null) 'task_id': taskId,
if (results != null) 'results': results,
if (completedAt != null) 'completed_at': completedAt,
if (createdAt != null) 'created_at': createdAt,
if (rowid != null) 'rowid': rowid,
});
}
UserTaskResultsCompanion copyWith({
Value<String>? id,
Value<String>? userId,
Value<String>? taskId,
Value<Map<String, dynamic>?>? results,
Value<PgDateTime>? completedAt,
Value<PgDateTime>? createdAt,
Value<int>? rowid,
}) {
return UserTaskResultsCompanion(
id: id ?? this.id,
userId: userId ?? this.userId,
taskId: taskId ?? this.taskId,
results: results ?? this.results,
completedAt: completedAt ?? this.completedAt,
createdAt: createdAt ?? this.createdAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (taskId.present) {
map['task_id'] = Variable<String>(taskId.value);
}
if (results.present) {
map['results'] = Variable<String>(
$UserTaskResultsTable.$converterresults.toSql(results.value),
);
}
if (completedAt.present) {
map['completed_at'] = Variable<PgDateTime>(
completedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('UserTaskResultsCompanion(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('taskId: $taskId, ')
..write('results: $results, ')
..write('completedAt: $completedAt, ')
..write('createdAt: $createdAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $PromoCodesCampaignsTable extends PromoCodesCampaigns
with TableInfo<$PromoCodesCampaignsTable, PromoCodesCampaign> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$PromoCodesCampaignsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _templateMeta = const VerificationMeta(
'template',
);
@override
late final GeneratedColumn<String> template = GeneratedColumn<String>(
'template',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _nameMeta = const VerificationMeta('name');
@override
late final GeneratedColumn<String> name = GeneratedColumn<String>(
'name',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
@override
late final GeneratedColumnWithTypeConverter<List<dynamic>, String> products =
GeneratedColumn<String>(
'products',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
).withConverter<List<dynamic>>(
$PromoCodesCampaignsTable.$converterproducts,
);
static const VerificationMeta _activationsPerCodeMeta =
const VerificationMeta('activationsPerCode');
@override
late final GeneratedColumn<int> activationsPerCode = GeneratedColumn<int>(
'activations_per_code',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
);
static const VerificationMeta _activationsPerUserMeta =
const VerificationMeta('activationsPerUser');
@override
late final GeneratedColumn<int> activationsPerUser = GeneratedColumn<int>(
'activations_per_user',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
);
static const VerificationMeta _generationSizeMeta = const VerificationMeta(
'generationSize',
);
@override
late final GeneratedColumn<int> generationSize = GeneratedColumn<int>(
'generation_size',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: true,
);
static const VerificationMeta _startMeta = const VerificationMeta('start');
@override
late final GeneratedColumn<PgDateTime> start = GeneratedColumn<PgDateTime>(
'start',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: true,
);
static const VerificationMeta _finishMeta = const VerificationMeta('finish');
@override
late final GeneratedColumn<PgDateTime> finish = GeneratedColumn<PgDateTime>(
'finish',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: true,
);
static const VerificationMeta _statusMeta = const VerificationMeta('status');
@override
late final GeneratedColumn<String> status = GeneratedColumn<String>(
'status',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
@override
late final GeneratedColumnWithTypeConverter<List<String>, String> tags =
GeneratedColumn<String>(
'tags',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
).withConverter<List<String>>($PromoCodesCampaignsTable.$convertertags);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
);
@override
late final GeneratedColumn<PgDateTime> deletedAt =
GeneratedColumn<PgDateTime>(
'deleted_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
@override
List<GeneratedColumn> get $columns => [
id,
template,
name,
products,
activationsPerCode,
activationsPerUser,
generationSize,
start,
finish,
status,
tags,
createdAt,
updatedAt,
isDeleted,
deletedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'promo_codes_campaigns';
@override
VerificationContext validateIntegrity(
Insertable<PromoCodesCampaign> 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('template')) {
context.handle(
_templateMeta,
template.isAcceptableOrUnknown(data['template']!, _templateMeta),
);
} else if (isInserting) {
context.missing(_templateMeta);
}
if (data.containsKey('name')) {
context.handle(
_nameMeta,
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
);
}
if (data.containsKey('activations_per_code')) {
context.handle(
_activationsPerCodeMeta,
activationsPerCode.isAcceptableOrUnknown(
data['activations_per_code']!,
_activationsPerCodeMeta,
),
);
} else if (isInserting) {
context.missing(_activationsPerCodeMeta);
}
if (data.containsKey('activations_per_user')) {
context.handle(
_activationsPerUserMeta,
activationsPerUser.isAcceptableOrUnknown(
data['activations_per_user']!,
_activationsPerUserMeta,
),
);
} else if (isInserting) {
context.missing(_activationsPerUserMeta);
}
if (data.containsKey('generation_size')) {
context.handle(
_generationSizeMeta,
generationSize.isAcceptableOrUnknown(
data['generation_size']!,
_generationSizeMeta,
),
);
} else if (isInserting) {
context.missing(_generationSizeMeta);
}
if (data.containsKey('start')) {
context.handle(
_startMeta,
start.isAcceptableOrUnknown(data['start']!, _startMeta),
);
} else if (isInserting) {
context.missing(_startMeta);
}
if (data.containsKey('finish')) {
context.handle(
_finishMeta,
finish.isAcceptableOrUnknown(data['finish']!, _finishMeta),
);
} else if (isInserting) {
context.missing(_finishMeta);
}
if (data.containsKey('status')) {
context.handle(
_statusMeta,
status.isAcceptableOrUnknown(data['status']!, _statusMeta),
);
} else if (isInserting) {
context.missing(_statusMeta);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
if (data.containsKey('deleted_at')) {
context.handle(
_deletedAtMeta,
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
PromoCodesCampaign map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return PromoCodesCampaign(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
template: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}template'],
)!,
name: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}name'],
),
products: $PromoCodesCampaignsTable.$converterproducts.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}products'],
)!,
),
activationsPerCode: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}activations_per_code'],
)!,
activationsPerUser: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}activations_per_user'],
)!,
generationSize: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}generation_size'],
)!,
start: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}start'],
)!,
finish: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}finish'],
)!,
status: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}status'],
)!,
tags: $PromoCodesCampaignsTable.$convertertags.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}tags'],
)!,
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
deletedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}deleted_at'],
),
);
}
@override
$PromoCodesCampaignsTable createAlias(String alias) {
return $PromoCodesCampaignsTable(attachedDatabase, alias);
}
static TypeConverter<List<dynamic>, String?> $converterproducts =
const JsonListConverter();
static TypeConverter<List<String>, String?> $convertertags =
const StringListConverter();
}
class PromoCodesCampaign extends DataClass
implements Insertable<PromoCodesCampaign> {
final String id;
final String template;
final String? name;
final List<dynamic> products;
final int activationsPerCode;
final int activationsPerUser;
final int generationSize;
final PgDateTime start;
final PgDateTime finish;
final String status;
final List<String> tags;
final PgDateTime createdAt;
final PgDateTime updatedAt;
final bool isDeleted;
final PgDateTime? deletedAt;
const PromoCodesCampaign({
required this.id,
required this.template,
this.name,
required this.products,
required this.activationsPerCode,
required this.activationsPerUser,
required this.generationSize,
required this.start,
required this.finish,
required this.status,
required this.tags,
required this.createdAt,
required this.updatedAt,
required this.isDeleted,
this.deletedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['template'] = Variable<String>(template);
if (!nullToAbsent || name != null) {
map['name'] = Variable<String>(name);
}
{
map['products'] = Variable<String>(
$PromoCodesCampaignsTable.$converterproducts.toSql(products),
);
}
map['activations_per_code'] = Variable<int>(activationsPerCode);
map['activations_per_user'] = Variable<int>(activationsPerUser);
map['generation_size'] = Variable<int>(generationSize);
map['start'] = Variable<PgDateTime>(start, PgTypes.timestampWithTimezone);
map['finish'] = Variable<PgDateTime>(finish, PgTypes.timestampWithTimezone);
map['status'] = Variable<String>(status);
{
map['tags'] = Variable<String>(
$PromoCodesCampaignsTable.$convertertags.toSql(tags),
);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
if (!nullToAbsent || deletedAt != null) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt,
PgTypes.timestampWithTimezone,
);
}
return map;
}
PromoCodesCampaignsCompanion toCompanion(bool nullToAbsent) {
return PromoCodesCampaignsCompanion(
id: Value(id),
template: Value(template),
name: name == null && nullToAbsent ? const Value.absent() : Value(name),
products: Value(products),
activationsPerCode: Value(activationsPerCode),
activationsPerUser: Value(activationsPerUser),
generationSize: Value(generationSize),
start: Value(start),
finish: Value(finish),
status: Value(status),
tags: Value(tags),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
isDeleted: Value(isDeleted),
deletedAt: deletedAt == null && nullToAbsent
? const Value.absent()
: Value(deletedAt),
);
}
factory PromoCodesCampaign.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return PromoCodesCampaign(
id: serializer.fromJson<String>(json['id']),
template: serializer.fromJson<String>(json['template']),
name: serializer.fromJson<String?>(json['name']),
products: serializer.fromJson<List<dynamic>>(json['products']),
activationsPerCode: serializer.fromJson<int>(json['activationsPerCode']),
activationsPerUser: serializer.fromJson<int>(json['activationsPerUser']),
generationSize: serializer.fromJson<int>(json['generationSize']),
start: serializer.fromJson<PgDateTime>(json['start']),
finish: serializer.fromJson<PgDateTime>(json['finish']),
status: serializer.fromJson<String>(json['status']),
tags: serializer.fromJson<List<String>>(json['tags']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
deletedAt: serializer.fromJson<PgDateTime?>(json['deletedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'template': serializer.toJson<String>(template),
'name': serializer.toJson<String?>(name),
'products': serializer.toJson<List<dynamic>>(products),
'activationsPerCode': serializer.toJson<int>(activationsPerCode),
'activationsPerUser': serializer.toJson<int>(activationsPerUser),
'generationSize': serializer.toJson<int>(generationSize),
'start': serializer.toJson<PgDateTime>(start),
'finish': serializer.toJson<PgDateTime>(finish),
'status': serializer.toJson<String>(status),
'tags': serializer.toJson<List<String>>(tags),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
'deletedAt': serializer.toJson<PgDateTime?>(deletedAt),
};
}
PromoCodesCampaign copyWith({
String? id,
String? template,
Value<String?> name = const Value.absent(),
List<dynamic>? products,
int? activationsPerCode,
int? activationsPerUser,
int? generationSize,
PgDateTime? start,
PgDateTime? finish,
String? status,
List<String>? tags,
PgDateTime? createdAt,
PgDateTime? updatedAt,
bool? isDeleted,
Value<PgDateTime?> deletedAt = const Value.absent(),
}) => PromoCodesCampaign(
id: id ?? this.id,
template: template ?? this.template,
name: name.present ? name.value : this.name,
products: products ?? this.products,
activationsPerCode: activationsPerCode ?? this.activationsPerCode,
activationsPerUser: activationsPerUser ?? this.activationsPerUser,
generationSize: generationSize ?? this.generationSize,
start: start ?? this.start,
finish: finish ?? this.finish,
status: status ?? this.status,
tags: tags ?? this.tags,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
);
PromoCodesCampaign copyWithCompanion(PromoCodesCampaignsCompanion data) {
return PromoCodesCampaign(
id: data.id.present ? data.id.value : this.id,
template: data.template.present ? data.template.value : this.template,
name: data.name.present ? data.name.value : this.name,
products: data.products.present ? data.products.value : this.products,
activationsPerCode: data.activationsPerCode.present
? data.activationsPerCode.value
: this.activationsPerCode,
activationsPerUser: data.activationsPerUser.present
? data.activationsPerUser.value
: this.activationsPerUser,
generationSize: data.generationSize.present
? data.generationSize.value
: this.generationSize,
start: data.start.present ? data.start.value : this.start,
finish: data.finish.present ? data.finish.value : this.finish,
status: data.status.present ? data.status.value : this.status,
tags: data.tags.present ? data.tags.value : this.tags,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
);
}
@override
String toString() {
return (StringBuffer('PromoCodesCampaign(')
..write('id: $id, ')
..write('template: $template, ')
..write('name: $name, ')
..write('products: $products, ')
..write('activationsPerCode: $activationsPerCode, ')
..write('activationsPerUser: $activationsPerUser, ')
..write('generationSize: $generationSize, ')
..write('start: $start, ')
..write('finish: $finish, ')
..write('status: $status, ')
..write('tags: $tags, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
template,
name,
products,
activationsPerCode,
activationsPerUser,
generationSize,
start,
finish,
status,
tags,
createdAt,
updatedAt,
isDeleted,
deletedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is PromoCodesCampaign &&
other.id == this.id &&
other.template == this.template &&
other.name == this.name &&
other.products == this.products &&
other.activationsPerCode == this.activationsPerCode &&
other.activationsPerUser == this.activationsPerUser &&
other.generationSize == this.generationSize &&
other.start == this.start &&
other.finish == this.finish &&
other.status == this.status &&
other.tags == this.tags &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt &&
other.isDeleted == this.isDeleted &&
other.deletedAt == this.deletedAt);
}
class PromoCodesCampaignsCompanion extends UpdateCompanion<PromoCodesCampaign> {
final Value<String> id;
final Value<String> template;
final Value<String?> name;
final Value<List<dynamic>> products;
final Value<int> activationsPerCode;
final Value<int> activationsPerUser;
final Value<int> generationSize;
final Value<PgDateTime> start;
final Value<PgDateTime> finish;
final Value<String> status;
final Value<List<String>> tags;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<bool> isDeleted;
final Value<PgDateTime?> deletedAt;
final Value<int> rowid;
const PromoCodesCampaignsCompanion({
this.id = const Value.absent(),
this.template = const Value.absent(),
this.name = const Value.absent(),
this.products = const Value.absent(),
this.activationsPerCode = const Value.absent(),
this.activationsPerUser = const Value.absent(),
this.generationSize = const Value.absent(),
this.start = const Value.absent(),
this.finish = const Value.absent(),
this.status = const Value.absent(),
this.tags = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
PromoCodesCampaignsCompanion.insert({
this.id = const Value.absent(),
required String template,
this.name = const Value.absent(),
this.products = const Value.absent(),
required int activationsPerCode,
required int activationsPerUser,
required int generationSize,
required PgDateTime start,
required PgDateTime finish,
required String status,
this.tags = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : template = Value(template),
activationsPerCode = Value(activationsPerCode),
activationsPerUser = Value(activationsPerUser),
generationSize = Value(generationSize),
start = Value(start),
finish = Value(finish),
status = Value(status);
static Insertable<PromoCodesCampaign> custom({
Expression<String>? id,
Expression<String>? template,
Expression<String>? name,
Expression<String>? products,
Expression<int>? activationsPerCode,
Expression<int>? activationsPerUser,
Expression<int>? generationSize,
Expression<PgDateTime>? start,
Expression<PgDateTime>? finish,
Expression<String>? status,
Expression<String>? tags,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<bool>? isDeleted,
Expression<PgDateTime>? deletedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (template != null) 'template': template,
if (name != null) 'name': name,
if (products != null) 'products': products,
if (activationsPerCode != null)
'activations_per_code': activationsPerCode,
if (activationsPerUser != null)
'activations_per_user': activationsPerUser,
if (generationSize != null) 'generation_size': generationSize,
if (start != null) 'start': start,
if (finish != null) 'finish': finish,
if (status != null) 'status': status,
if (tags != null) 'tags': tags,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (deletedAt != null) 'deleted_at': deletedAt,
if (rowid != null) 'rowid': rowid,
});
}
PromoCodesCampaignsCompanion copyWith({
Value<String>? id,
Value<String>? template,
Value<String?>? name,
Value<List<dynamic>>? products,
Value<int>? activationsPerCode,
Value<int>? activationsPerUser,
Value<int>? generationSize,
Value<PgDateTime>? start,
Value<PgDateTime>? finish,
Value<String>? status,
Value<List<String>>? tags,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<bool>? isDeleted,
Value<PgDateTime?>? deletedAt,
Value<int>? rowid,
}) {
return PromoCodesCampaignsCompanion(
id: id ?? this.id,
template: template ?? this.template,
name: name ?? this.name,
products: products ?? this.products,
activationsPerCode: activationsPerCode ?? this.activationsPerCode,
activationsPerUser: activationsPerUser ?? this.activationsPerUser,
generationSize: generationSize ?? this.generationSize,
start: start ?? this.start,
finish: finish ?? this.finish,
status: status ?? this.status,
tags: tags ?? this.tags,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt ?? this.deletedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (template.present) {
map['template'] = Variable<String>(template.value);
}
if (name.present) {
map['name'] = Variable<String>(name.value);
}
if (products.present) {
map['products'] = Variable<String>(
$PromoCodesCampaignsTable.$converterproducts.toSql(products.value),
);
}
if (activationsPerCode.present) {
map['activations_per_code'] = Variable<int>(activationsPerCode.value);
}
if (activationsPerUser.present) {
map['activations_per_user'] = Variable<int>(activationsPerUser.value);
}
if (generationSize.present) {
map['generation_size'] = Variable<int>(generationSize.value);
}
if (start.present) {
map['start'] = Variable<PgDateTime>(
start.value,
PgTypes.timestampWithTimezone,
);
}
if (finish.present) {
map['finish'] = Variable<PgDateTime>(
finish.value,
PgTypes.timestampWithTimezone,
);
}
if (status.present) {
map['status'] = Variable<String>(status.value);
}
if (tags.present) {
map['tags'] = Variable<String>(
$PromoCodesCampaignsTable.$convertertags.toSql(tags.value),
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (deletedAt.present) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('PromoCodesCampaignsCompanion(')
..write('id: $id, ')
..write('template: $template, ')
..write('name: $name, ')
..write('products: $products, ')
..write('activationsPerCode: $activationsPerCode, ')
..write('activationsPerUser: $activationsPerUser, ')
..write('generationSize: $generationSize, ')
..write('start: $start, ')
..write('finish: $finish, ')
..write('status: $status, ')
..write('tags: $tags, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $PromoCodesTable extends PromoCodes
with TableInfo<$PromoCodesTable, PromoCode> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$PromoCodesTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _campaignIdMeta = const VerificationMeta(
'campaignId',
);
@override
late final GeneratedColumn<String> campaignId = GeneratedColumn<String>(
'campaign_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES promo_codes_campaigns (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _codeMeta = const VerificationMeta('code');
@override
late final GeneratedColumn<String> code = GeneratedColumn<String>(
'code',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
);
static const VerificationMeta _activationsMeta = const VerificationMeta(
'activations',
);
@override
late final GeneratedColumn<int> activations = GeneratedColumn<int>(
'activations',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES users (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
);
@override
late final GeneratedColumn<PgDateTime> deletedAt =
GeneratedColumn<PgDateTime>(
'deleted_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
@override
List<GeneratedColumn> get $columns => [
id,
campaignId,
code,
activations,
userId,
createdAt,
updatedAt,
isDeleted,
deletedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'promo_codes';
@override
VerificationContext validateIntegrity(
Insertable<PromoCode> 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('campaign_id')) {
context.handle(
_campaignIdMeta,
campaignId.isAcceptableOrUnknown(data['campaign_id']!, _campaignIdMeta),
);
} else if (isInserting) {
context.missing(_campaignIdMeta);
}
if (data.containsKey('code')) {
context.handle(
_codeMeta,
code.isAcceptableOrUnknown(data['code']!, _codeMeta),
);
} else if (isInserting) {
context.missing(_codeMeta);
}
if (data.containsKey('activations')) {
context.handle(
_activationsMeta,
activations.isAcceptableOrUnknown(
data['activations']!,
_activationsMeta,
),
);
}
if (data.containsKey('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
if (data.containsKey('deleted_at')) {
context.handle(
_deletedAtMeta,
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
PromoCode map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return PromoCode(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
campaignId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}campaign_id'],
)!,
code: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}code'],
)!,
activations: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}activations'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
deletedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}deleted_at'],
),
);
}
@override
$PromoCodesTable createAlias(String alias) {
return $PromoCodesTable(attachedDatabase, alias);
}
}
class PromoCode extends DataClass implements Insertable<PromoCode> {
final String id;
final String campaignId;
final String code;
final int activations;
final String? userId;
final PgDateTime createdAt;
final PgDateTime updatedAt;
final bool isDeleted;
final PgDateTime? deletedAt;
const PromoCode({
required this.id,
required this.campaignId,
required this.code,
required this.activations,
this.userId,
required this.createdAt,
required this.updatedAt,
required this.isDeleted,
this.deletedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['campaign_id'] = Variable<String>(campaignId);
map['code'] = Variable<String>(code);
map['activations'] = Variable<int>(activations);
if (!nullToAbsent || userId != null) {
map['user_id'] = Variable<String>(userId);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
if (!nullToAbsent || deletedAt != null) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt,
PgTypes.timestampWithTimezone,
);
}
return map;
}
PromoCodesCompanion toCompanion(bool nullToAbsent) {
return PromoCodesCompanion(
id: Value(id),
campaignId: Value(campaignId),
code: Value(code),
activations: Value(activations),
userId: userId == null && nullToAbsent
? const Value.absent()
: Value(userId),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
isDeleted: Value(isDeleted),
deletedAt: deletedAt == null && nullToAbsent
? const Value.absent()
: Value(deletedAt),
);
}
factory PromoCode.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return PromoCode(
id: serializer.fromJson<String>(json['id']),
campaignId: serializer.fromJson<String>(json['campaignId']),
code: serializer.fromJson<String>(json['code']),
activations: serializer.fromJson<int>(json['activations']),
userId: serializer.fromJson<String?>(json['userId']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
deletedAt: serializer.fromJson<PgDateTime?>(json['deletedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'campaignId': serializer.toJson<String>(campaignId),
'code': serializer.toJson<String>(code),
'activations': serializer.toJson<int>(activations),
'userId': serializer.toJson<String?>(userId),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
'deletedAt': serializer.toJson<PgDateTime?>(deletedAt),
};
}
PromoCode copyWith({
String? id,
String? campaignId,
String? code,
int? activations,
Value<String?> userId = const Value.absent(),
PgDateTime? createdAt,
PgDateTime? updatedAt,
bool? isDeleted,
Value<PgDateTime?> deletedAt = const Value.absent(),
}) => PromoCode(
id: id ?? this.id,
campaignId: campaignId ?? this.campaignId,
code: code ?? this.code,
activations: activations ?? this.activations,
userId: userId.present ? userId.value : this.userId,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
);
PromoCode copyWithCompanion(PromoCodesCompanion data) {
return PromoCode(
id: data.id.present ? data.id.value : this.id,
campaignId: data.campaignId.present
? data.campaignId.value
: this.campaignId,
code: data.code.present ? data.code.value : this.code,
activations: data.activations.present
? data.activations.value
: this.activations,
userId: data.userId.present ? data.userId.value : this.userId,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
);
}
@override
String toString() {
return (StringBuffer('PromoCode(')
..write('id: $id, ')
..write('campaignId: $campaignId, ')
..write('code: $code, ')
..write('activations: $activations, ')
..write('userId: $userId, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
campaignId,
code,
activations,
userId,
createdAt,
updatedAt,
isDeleted,
deletedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is PromoCode &&
other.id == this.id &&
other.campaignId == this.campaignId &&
other.code == this.code &&
other.activations == this.activations &&
other.userId == this.userId &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt &&
other.isDeleted == this.isDeleted &&
other.deletedAt == this.deletedAt);
}
class PromoCodesCompanion extends UpdateCompanion<PromoCode> {
final Value<String> id;
final Value<String> campaignId;
final Value<String> code;
final Value<int> activations;
final Value<String?> userId;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<bool> isDeleted;
final Value<PgDateTime?> deletedAt;
final Value<int> rowid;
const PromoCodesCompanion({
this.id = const Value.absent(),
this.campaignId = const Value.absent(),
this.code = const Value.absent(),
this.activations = const Value.absent(),
this.userId = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
PromoCodesCompanion.insert({
this.id = const Value.absent(),
required String campaignId,
required String code,
this.activations = const Value.absent(),
this.userId = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : campaignId = Value(campaignId),
code = Value(code);
static Insertable<PromoCode> custom({
Expression<String>? id,
Expression<String>? campaignId,
Expression<String>? code,
Expression<int>? activations,
Expression<String>? userId,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<bool>? isDeleted,
Expression<PgDateTime>? deletedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (campaignId != null) 'campaign_id': campaignId,
if (code != null) 'code': code,
if (activations != null) 'activations': activations,
if (userId != null) 'user_id': userId,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (deletedAt != null) 'deleted_at': deletedAt,
if (rowid != null) 'rowid': rowid,
});
}
PromoCodesCompanion copyWith({
Value<String>? id,
Value<String>? campaignId,
Value<String>? code,
Value<int>? activations,
Value<String?>? userId,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<bool>? isDeleted,
Value<PgDateTime?>? deletedAt,
Value<int>? rowid,
}) {
return PromoCodesCompanion(
id: id ?? this.id,
campaignId: campaignId ?? this.campaignId,
code: code ?? this.code,
activations: activations ?? this.activations,
userId: userId ?? this.userId,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt ?? this.deletedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (campaignId.present) {
map['campaign_id'] = Variable<String>(campaignId.value);
}
if (code.present) {
map['code'] = Variable<String>(code.value);
}
if (activations.present) {
map['activations'] = Variable<int>(activations.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (deletedAt.present) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('PromoCodesCompanion(')
..write('id: $id, ')
..write('campaignId: $campaignId, ')
..write('code: $code, ')
..write('activations: $activations, ')
..write('userId: $userId, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $DiscountCampaignsTable extends DiscountCampaigns
with TableInfo<$DiscountCampaignsTable, DiscountCampaign> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$DiscountCampaignsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _nameMeta = const VerificationMeta('name');
@override
late final GeneratedColumn<String> name = GeneratedColumn<String>(
'name',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _startMeta = const VerificationMeta('start');
@override
late final GeneratedColumn<PgDateTime> start = GeneratedColumn<PgDateTime>(
'start',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: true,
);
static const VerificationMeta _finishMeta = const VerificationMeta('finish');
@override
late final GeneratedColumn<PgDateTime> finish = GeneratedColumn<PgDateTime>(
'finish',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: true,
);
static const VerificationMeta _statusMeta = const VerificationMeta('status');
@override
late final GeneratedColumn<String> status = GeneratedColumn<String>(
'status',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
@override
late final GeneratedColumnWithTypeConverter<List<String>, String> tags =
GeneratedColumn<String>(
'tags',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
).withConverter<List<String>>($DiscountCampaignsTable.$convertertags);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
);
@override
late final GeneratedColumn<PgDateTime> deletedAt =
GeneratedColumn<PgDateTime>(
'deleted_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
@override
List<GeneratedColumn> get $columns => [
id,
name,
start,
finish,
status,
tags,
createdAt,
updatedAt,
isDeleted,
deletedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'discount_campaigns';
@override
VerificationContext validateIntegrity(
Insertable<DiscountCampaign> 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('name')) {
context.handle(
_nameMeta,
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
);
}
if (data.containsKey('start')) {
context.handle(
_startMeta,
start.isAcceptableOrUnknown(data['start']!, _startMeta),
);
} else if (isInserting) {
context.missing(_startMeta);
}
if (data.containsKey('finish')) {
context.handle(
_finishMeta,
finish.isAcceptableOrUnknown(data['finish']!, _finishMeta),
);
} else if (isInserting) {
context.missing(_finishMeta);
}
if (data.containsKey('status')) {
context.handle(
_statusMeta,
status.isAcceptableOrUnknown(data['status']!, _statusMeta),
);
} else if (isInserting) {
context.missing(_statusMeta);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
if (data.containsKey('deleted_at')) {
context.handle(
_deletedAtMeta,
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
DiscountCampaign map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return DiscountCampaign(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
name: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}name'],
),
start: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}start'],
)!,
finish: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}finish'],
)!,
status: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}status'],
)!,
tags: $DiscountCampaignsTable.$convertertags.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}tags'],
)!,
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
deletedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}deleted_at'],
),
);
}
@override
$DiscountCampaignsTable createAlias(String alias) {
return $DiscountCampaignsTable(attachedDatabase, alias);
}
static TypeConverter<List<String>, String?> $convertertags =
const StringListConverter();
}
class DiscountCampaign extends DataClass
implements Insertable<DiscountCampaign> {
final String id;
final String? name;
final PgDateTime start;
final PgDateTime finish;
final String status;
final List<String> tags;
final PgDateTime createdAt;
final PgDateTime updatedAt;
final bool isDeleted;
final PgDateTime? deletedAt;
const DiscountCampaign({
required this.id,
this.name,
required this.start,
required this.finish,
required this.status,
required this.tags,
required this.createdAt,
required this.updatedAt,
required this.isDeleted,
this.deletedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
if (!nullToAbsent || name != null) {
map['name'] = Variable<String>(name);
}
map['start'] = Variable<PgDateTime>(start, PgTypes.timestampWithTimezone);
map['finish'] = Variable<PgDateTime>(finish, PgTypes.timestampWithTimezone);
map['status'] = Variable<String>(status);
{
map['tags'] = Variable<String>(
$DiscountCampaignsTable.$convertertags.toSql(tags),
);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
if (!nullToAbsent || deletedAt != null) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt,
PgTypes.timestampWithTimezone,
);
}
return map;
}
DiscountCampaignsCompanion toCompanion(bool nullToAbsent) {
return DiscountCampaignsCompanion(
id: Value(id),
name: name == null && nullToAbsent ? const Value.absent() : Value(name),
start: Value(start),
finish: Value(finish),
status: Value(status),
tags: Value(tags),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
isDeleted: Value(isDeleted),
deletedAt: deletedAt == null && nullToAbsent
? const Value.absent()
: Value(deletedAt),
);
}
factory DiscountCampaign.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return DiscountCampaign(
id: serializer.fromJson<String>(json['id']),
name: serializer.fromJson<String?>(json['name']),
start: serializer.fromJson<PgDateTime>(json['start']),
finish: serializer.fromJson<PgDateTime>(json['finish']),
status: serializer.fromJson<String>(json['status']),
tags: serializer.fromJson<List<String>>(json['tags']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
deletedAt: serializer.fromJson<PgDateTime?>(json['deletedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'name': serializer.toJson<String?>(name),
'start': serializer.toJson<PgDateTime>(start),
'finish': serializer.toJson<PgDateTime>(finish),
'status': serializer.toJson<String>(status),
'tags': serializer.toJson<List<String>>(tags),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
'deletedAt': serializer.toJson<PgDateTime?>(deletedAt),
};
}
DiscountCampaign copyWith({
String? id,
Value<String?> name = const Value.absent(),
PgDateTime? start,
PgDateTime? finish,
String? status,
List<String>? tags,
PgDateTime? createdAt,
PgDateTime? updatedAt,
bool? isDeleted,
Value<PgDateTime?> deletedAt = const Value.absent(),
}) => DiscountCampaign(
id: id ?? this.id,
name: name.present ? name.value : this.name,
start: start ?? this.start,
finish: finish ?? this.finish,
status: status ?? this.status,
tags: tags ?? this.tags,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
);
DiscountCampaign copyWithCompanion(DiscountCampaignsCompanion data) {
return DiscountCampaign(
id: data.id.present ? data.id.value : this.id,
name: data.name.present ? data.name.value : this.name,
start: data.start.present ? data.start.value : this.start,
finish: data.finish.present ? data.finish.value : this.finish,
status: data.status.present ? data.status.value : this.status,
tags: data.tags.present ? data.tags.value : this.tags,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
);
}
@override
String toString() {
return (StringBuffer('DiscountCampaign(')
..write('id: $id, ')
..write('name: $name, ')
..write('start: $start, ')
..write('finish: $finish, ')
..write('status: $status, ')
..write('tags: $tags, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
name,
start,
finish,
status,
tags,
createdAt,
updatedAt,
isDeleted,
deletedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is DiscountCampaign &&
other.id == this.id &&
other.name == this.name &&
other.start == this.start &&
other.finish == this.finish &&
other.status == this.status &&
other.tags == this.tags &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt &&
other.isDeleted == this.isDeleted &&
other.deletedAt == this.deletedAt);
}
class DiscountCampaignsCompanion extends UpdateCompanion<DiscountCampaign> {
final Value<String> id;
final Value<String?> name;
final Value<PgDateTime> start;
final Value<PgDateTime> finish;
final Value<String> status;
final Value<List<String>> tags;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<bool> isDeleted;
final Value<PgDateTime?> deletedAt;
final Value<int> rowid;
const DiscountCampaignsCompanion({
this.id = const Value.absent(),
this.name = const Value.absent(),
this.start = const Value.absent(),
this.finish = const Value.absent(),
this.status = const Value.absent(),
this.tags = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
DiscountCampaignsCompanion.insert({
this.id = const Value.absent(),
this.name = const Value.absent(),
required PgDateTime start,
required PgDateTime finish,
required String status,
this.tags = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : start = Value(start),
finish = Value(finish),
status = Value(status);
static Insertable<DiscountCampaign> custom({
Expression<String>? id,
Expression<String>? name,
Expression<PgDateTime>? start,
Expression<PgDateTime>? finish,
Expression<String>? status,
Expression<String>? tags,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<bool>? isDeleted,
Expression<PgDateTime>? deletedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (name != null) 'name': name,
if (start != null) 'start': start,
if (finish != null) 'finish': finish,
if (status != null) 'status': status,
if (tags != null) 'tags': tags,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (deletedAt != null) 'deleted_at': deletedAt,
if (rowid != null) 'rowid': rowid,
});
}
DiscountCampaignsCompanion copyWith({
Value<String>? id,
Value<String?>? name,
Value<PgDateTime>? start,
Value<PgDateTime>? finish,
Value<String>? status,
Value<List<String>>? tags,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<bool>? isDeleted,
Value<PgDateTime?>? deletedAt,
Value<int>? rowid,
}) {
return DiscountCampaignsCompanion(
id: id ?? this.id,
name: name ?? this.name,
start: start ?? this.start,
finish: finish ?? this.finish,
status: status ?? this.status,
tags: tags ?? this.tags,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt ?? this.deletedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (name.present) {
map['name'] = Variable<String>(name.value);
}
if (start.present) {
map['start'] = Variable<PgDateTime>(
start.value,
PgTypes.timestampWithTimezone,
);
}
if (finish.present) {
map['finish'] = Variable<PgDateTime>(
finish.value,
PgTypes.timestampWithTimezone,
);
}
if (status.present) {
map['status'] = Variable<String>(status.value);
}
if (tags.present) {
map['tags'] = Variable<String>(
$DiscountCampaignsTable.$convertertags.toSql(tags.value),
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (deletedAt.present) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('DiscountCampaignsCompanion(')
..write('id: $id, ')
..write('name: $name, ')
..write('start: $start, ')
..write('finish: $finish, ')
..write('status: $status, ')
..write('tags: $tags, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $DiscountsTable extends Discounts
with TableInfo<$DiscountsTable, Discount> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$DiscountsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _campaignIdMeta = const VerificationMeta(
'campaignId',
);
@override
late final GeneratedColumn<String> campaignId = GeneratedColumn<String>(
'campaign_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES discount_campaigns (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _discountPercentMeta = const VerificationMeta(
'discountPercent',
);
@override
late final GeneratedColumn<double> discountPercent = GeneratedColumn<double>(
'discount_percent',
aliasedName,
false,
type: DriftSqlType.double,
requiredDuringInsert: true,
);
@override
late final GeneratedColumnWithTypeConverter<List<dynamic>, String> products =
GeneratedColumn<String>(
'products',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const Constant('[]'),
).withConverter<List<dynamic>>($DiscountsTable.$converterproducts);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
);
@override
late final GeneratedColumn<PgDateTime> deletedAt =
GeneratedColumn<PgDateTime>(
'deleted_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
@override
List<GeneratedColumn> get $columns => [
id,
campaignId,
discountPercent,
products,
createdAt,
updatedAt,
isDeleted,
deletedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'discounts';
@override
VerificationContext validateIntegrity(
Insertable<Discount> 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('campaign_id')) {
context.handle(
_campaignIdMeta,
campaignId.isAcceptableOrUnknown(data['campaign_id']!, _campaignIdMeta),
);
} else if (isInserting) {
context.missing(_campaignIdMeta);
}
if (data.containsKey('discount_percent')) {
context.handle(
_discountPercentMeta,
discountPercent.isAcceptableOrUnknown(
data['discount_percent']!,
_discountPercentMeta,
),
);
} else if (isInserting) {
context.missing(_discountPercentMeta);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
if (data.containsKey('deleted_at')) {
context.handle(
_deletedAtMeta,
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
Discount map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return Discount(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
campaignId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}campaign_id'],
)!,
discountPercent: attachedDatabase.typeMapping.read(
DriftSqlType.double,
data['${effectivePrefix}discount_percent'],
)!,
products: $DiscountsTable.$converterproducts.fromSql(
attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}products'],
)!,
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
deletedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}deleted_at'],
),
);
}
@override
$DiscountsTable createAlias(String alias) {
return $DiscountsTable(attachedDatabase, alias);
}
static TypeConverter<List<dynamic>, String?> $converterproducts =
const JsonListConverter();
}
class Discount extends DataClass implements Insertable<Discount> {
final String id;
final String campaignId;
final double discountPercent;
final List<dynamic> products;
final PgDateTime createdAt;
final PgDateTime updatedAt;
final bool isDeleted;
final PgDateTime? deletedAt;
const Discount({
required this.id,
required this.campaignId,
required this.discountPercent,
required this.products,
required this.createdAt,
required this.updatedAt,
required this.isDeleted,
this.deletedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['campaign_id'] = Variable<String>(campaignId);
map['discount_percent'] = Variable<double>(discountPercent);
{
map['products'] = Variable<String>(
$DiscountsTable.$converterproducts.toSql(products),
);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
if (!nullToAbsent || deletedAt != null) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt,
PgTypes.timestampWithTimezone,
);
}
return map;
}
DiscountsCompanion toCompanion(bool nullToAbsent) {
return DiscountsCompanion(
id: Value(id),
campaignId: Value(campaignId),
discountPercent: Value(discountPercent),
products: Value(products),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
isDeleted: Value(isDeleted),
deletedAt: deletedAt == null && nullToAbsent
? const Value.absent()
: Value(deletedAt),
);
}
factory Discount.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return Discount(
id: serializer.fromJson<String>(json['id']),
campaignId: serializer.fromJson<String>(json['campaignId']),
discountPercent: serializer.fromJson<double>(json['discountPercent']),
products: serializer.fromJson<List<dynamic>>(json['products']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
deletedAt: serializer.fromJson<PgDateTime?>(json['deletedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'campaignId': serializer.toJson<String>(campaignId),
'discountPercent': serializer.toJson<double>(discountPercent),
'products': serializer.toJson<List<dynamic>>(products),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
'deletedAt': serializer.toJson<PgDateTime?>(deletedAt),
};
}
Discount copyWith({
String? id,
String? campaignId,
double? discountPercent,
List<dynamic>? products,
PgDateTime? createdAt,
PgDateTime? updatedAt,
bool? isDeleted,
Value<PgDateTime?> deletedAt = const Value.absent(),
}) => Discount(
id: id ?? this.id,
campaignId: campaignId ?? this.campaignId,
discountPercent: discountPercent ?? this.discountPercent,
products: products ?? this.products,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
);
Discount copyWithCompanion(DiscountsCompanion data) {
return Discount(
id: data.id.present ? data.id.value : this.id,
campaignId: data.campaignId.present
? data.campaignId.value
: this.campaignId,
discountPercent: data.discountPercent.present
? data.discountPercent.value
: this.discountPercent,
products: data.products.present ? data.products.value : this.products,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
);
}
@override
String toString() {
return (StringBuffer('Discount(')
..write('id: $id, ')
..write('campaignId: $campaignId, ')
..write('discountPercent: $discountPercent, ')
..write('products: $products, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
campaignId,
discountPercent,
products,
createdAt,
updatedAt,
isDeleted,
deletedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is Discount &&
other.id == this.id &&
other.campaignId == this.campaignId &&
other.discountPercent == this.discountPercent &&
other.products == this.products &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt &&
other.isDeleted == this.isDeleted &&
other.deletedAt == this.deletedAt);
}
class DiscountsCompanion extends UpdateCompanion<Discount> {
final Value<String> id;
final Value<String> campaignId;
final Value<double> discountPercent;
final Value<List<dynamic>> products;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<bool> isDeleted;
final Value<PgDateTime?> deletedAt;
final Value<int> rowid;
const DiscountsCompanion({
this.id = const Value.absent(),
this.campaignId = const Value.absent(),
this.discountPercent = const Value.absent(),
this.products = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
DiscountsCompanion.insert({
this.id = const Value.absent(),
required String campaignId,
required double discountPercent,
this.products = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : campaignId = Value(campaignId),
discountPercent = Value(discountPercent);
static Insertable<Discount> custom({
Expression<String>? id,
Expression<String>? campaignId,
Expression<double>? discountPercent,
Expression<String>? products,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<bool>? isDeleted,
Expression<PgDateTime>? deletedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (campaignId != null) 'campaign_id': campaignId,
if (discountPercent != null) 'discount_percent': discountPercent,
if (products != null) 'products': products,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (deletedAt != null) 'deleted_at': deletedAt,
if (rowid != null) 'rowid': rowid,
});
}
DiscountsCompanion copyWith({
Value<String>? id,
Value<String>? campaignId,
Value<double>? discountPercent,
Value<List<dynamic>>? products,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<bool>? isDeleted,
Value<PgDateTime?>? deletedAt,
Value<int>? rowid,
}) {
return DiscountsCompanion(
id: id ?? this.id,
campaignId: campaignId ?? this.campaignId,
discountPercent: discountPercent ?? this.discountPercent,
products: products ?? this.products,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt ?? this.deletedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (campaignId.present) {
map['campaign_id'] = Variable<String>(campaignId.value);
}
if (discountPercent.present) {
map['discount_percent'] = Variable<double>(discountPercent.value);
}
if (products.present) {
map['products'] = Variable<String>(
$DiscountsTable.$converterproducts.toSql(products.value),
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (deletedAt.present) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('DiscountsCompanion(')
..write('id: $id, ')
..write('campaignId: $campaignId, ')
..write('discountPercent: $discountPercent, ')
..write('products: $products, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $DiscountUserDatasTable extends DiscountUserDatas
with TableInfo<$DiscountUserDatasTable, DiscountUserData> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$DiscountUserDatasTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _discountIdMeta = const VerificationMeta(
'discountId',
);
@override
late final GeneratedColumn<String> discountId = GeneratedColumn<String>(
'discount_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES discounts (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES users (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _grantedAtMeta = const VerificationMeta(
'grantedAt',
);
@override
late final GeneratedColumn<PgDateTime> grantedAt =
GeneratedColumn<PgDateTime>(
'granted_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
@override
List<GeneratedColumn> get $columns => [discountId, userId, grantedAt];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'discount_user_datas';
@override
VerificationContext validateIntegrity(
Insertable<DiscountUserData> instance, {
bool isInserting = false,
}) {
final context = VerificationContext();
final data = instance.toColumns(true);
if (data.containsKey('discount_id')) {
context.handle(
_discountIdMeta,
discountId.isAcceptableOrUnknown(data['discount_id']!, _discountIdMeta),
);
} else if (isInserting) {
context.missing(_discountIdMeta);
}
if (data.containsKey('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('granted_at')) {
context.handle(
_grantedAtMeta,
grantedAt.isAcceptableOrUnknown(data['granted_at']!, _grantedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {discountId, userId};
@override
DiscountUserData map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return DiscountUserData(
discountId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}discount_id'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
)!,
grantedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}granted_at'],
)!,
);
}
@override
$DiscountUserDatasTable createAlias(String alias) {
return $DiscountUserDatasTable(attachedDatabase, alias);
}
}
class DiscountUserData extends DataClass
implements Insertable<DiscountUserData> {
final String discountId;
final String userId;
final PgDateTime grantedAt;
const DiscountUserData({
required this.discountId,
required this.userId,
required this.grantedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['discount_id'] = Variable<String>(discountId);
map['user_id'] = Variable<String>(userId);
map['granted_at'] = Variable<PgDateTime>(
grantedAt,
PgTypes.timestampWithTimezone,
);
return map;
}
DiscountUserDatasCompanion toCompanion(bool nullToAbsent) {
return DiscountUserDatasCompanion(
discountId: Value(discountId),
userId: Value(userId),
grantedAt: Value(grantedAt),
);
}
factory DiscountUserData.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return DiscountUserData(
discountId: serializer.fromJson<String>(json['discountId']),
userId: serializer.fromJson<String>(json['userId']),
grantedAt: serializer.fromJson<PgDateTime>(json['grantedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'discountId': serializer.toJson<String>(discountId),
'userId': serializer.toJson<String>(userId),
'grantedAt': serializer.toJson<PgDateTime>(grantedAt),
};
}
DiscountUserData copyWith({
String? discountId,
String? userId,
PgDateTime? grantedAt,
}) => DiscountUserData(
discountId: discountId ?? this.discountId,
userId: userId ?? this.userId,
grantedAt: grantedAt ?? this.grantedAt,
);
DiscountUserData copyWithCompanion(DiscountUserDatasCompanion data) {
return DiscountUserData(
discountId: data.discountId.present
? data.discountId.value
: this.discountId,
userId: data.userId.present ? data.userId.value : this.userId,
grantedAt: data.grantedAt.present ? data.grantedAt.value : this.grantedAt,
);
}
@override
String toString() {
return (StringBuffer('DiscountUserData(')
..write('discountId: $discountId, ')
..write('userId: $userId, ')
..write('grantedAt: $grantedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(discountId, userId, grantedAt);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is DiscountUserData &&
other.discountId == this.discountId &&
other.userId == this.userId &&
other.grantedAt == this.grantedAt);
}
class DiscountUserDatasCompanion extends UpdateCompanion<DiscountUserData> {
final Value<String> discountId;
final Value<String> userId;
final Value<PgDateTime> grantedAt;
final Value<int> rowid;
const DiscountUserDatasCompanion({
this.discountId = const Value.absent(),
this.userId = const Value.absent(),
this.grantedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
DiscountUserDatasCompanion.insert({
required String discountId,
required String userId,
this.grantedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : discountId = Value(discountId),
userId = Value(userId);
static Insertable<DiscountUserData> custom({
Expression<String>? discountId,
Expression<String>? userId,
Expression<PgDateTime>? grantedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (discountId != null) 'discount_id': discountId,
if (userId != null) 'user_id': userId,
if (grantedAt != null) 'granted_at': grantedAt,
if (rowid != null) 'rowid': rowid,
});
}
DiscountUserDatasCompanion copyWith({
Value<String>? discountId,
Value<String>? userId,
Value<PgDateTime>? grantedAt,
Value<int>? rowid,
}) {
return DiscountUserDatasCompanion(
discountId: discountId ?? this.discountId,
userId: userId ?? this.userId,
grantedAt: grantedAt ?? this.grantedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (discountId.present) {
map['discount_id'] = Variable<String>(discountId.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (grantedAt.present) {
map['granted_at'] = Variable<PgDateTime>(
grantedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('DiscountUserDatasCompanion(')
..write('discountId: $discountId, ')
..write('userId: $userId, ')
..write('grantedAt: $grantedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $StudySessionsTable extends StudySessions
with TableInfo<$StudySessionsTable, StudySession> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$StudySessionsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES users (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _sessionIdMeta = const VerificationMeta(
'sessionId',
);
@override
late final GeneratedColumn<String> sessionId = GeneratedColumn<String>(
'session_id',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
);
static const VerificationMeta _startTimeMeta = const VerificationMeta(
'startTime',
);
@override
late final GeneratedColumn<PgDateTime> startTime =
GeneratedColumn<PgDateTime>(
'start_time',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: true,
);
static const VerificationMeta _endTimeMeta = const VerificationMeta(
'endTime',
);
@override
late final GeneratedColumn<PgDateTime> endTime = GeneratedColumn<PgDateTime>(
'end_time',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
static const VerificationMeta _wordsLearnedMeta = const VerificationMeta(
'wordsLearned',
);
@override
late final GeneratedColumn<int> wordsLearned = GeneratedColumn<int>(
'words_learned',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _testsCompletedMeta = const VerificationMeta(
'testsCompleted',
);
@override
late final GeneratedColumn<int> testsCompleted = GeneratedColumn<int>(
'tests_completed',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _accuracyMeta = const VerificationMeta(
'accuracy',
);
@override
late final GeneratedColumn<double> accuracy = GeneratedColumn<double>(
'accuracy',
aliasedName,
false,
type: DriftSqlType.double,
requiredDuringInsert: false,
defaultValue: const Constant(0.0),
);
static const VerificationMeta _packIdMeta = const VerificationMeta('packId');
@override
late final GeneratedColumn<String> packId = GeneratedColumn<String>(
'pack_id',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _testIdMeta = const VerificationMeta('testId');
@override
late final GeneratedColumn<String> testId = GeneratedColumn<String>(
'test_id',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
);
@override
late final GeneratedColumn<PgDateTime> deletedAt =
GeneratedColumn<PgDateTime>(
'deleted_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
@override
List<GeneratedColumn> get $columns => [
id,
userId,
sessionId,
startTime,
endTime,
wordsLearned,
testsCompleted,
accuracy,
packId,
testId,
createdAt,
updatedAt,
isDeleted,
deletedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'study_sessions';
@override
VerificationContext validateIntegrity(
Insertable<StudySession> 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('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('session_id')) {
context.handle(
_sessionIdMeta,
sessionId.isAcceptableOrUnknown(data['session_id']!, _sessionIdMeta),
);
}
if (data.containsKey('start_time')) {
context.handle(
_startTimeMeta,
startTime.isAcceptableOrUnknown(data['start_time']!, _startTimeMeta),
);
} else if (isInserting) {
context.missing(_startTimeMeta);
}
if (data.containsKey('end_time')) {
context.handle(
_endTimeMeta,
endTime.isAcceptableOrUnknown(data['end_time']!, _endTimeMeta),
);
}
if (data.containsKey('words_learned')) {
context.handle(
_wordsLearnedMeta,
wordsLearned.isAcceptableOrUnknown(
data['words_learned']!,
_wordsLearnedMeta,
),
);
}
if (data.containsKey('tests_completed')) {
context.handle(
_testsCompletedMeta,
testsCompleted.isAcceptableOrUnknown(
data['tests_completed']!,
_testsCompletedMeta,
),
);
}
if (data.containsKey('accuracy')) {
context.handle(
_accuracyMeta,
accuracy.isAcceptableOrUnknown(data['accuracy']!, _accuracyMeta),
);
}
if (data.containsKey('pack_id')) {
context.handle(
_packIdMeta,
packId.isAcceptableOrUnknown(data['pack_id']!, _packIdMeta),
);
}
if (data.containsKey('test_id')) {
context.handle(
_testIdMeta,
testId.isAcceptableOrUnknown(data['test_id']!, _testIdMeta),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
if (data.containsKey('deleted_at')) {
context.handle(
_deletedAtMeta,
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
StudySession map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return StudySession(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
)!,
sessionId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}session_id'],
),
startTime: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}start_time'],
)!,
endTime: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}end_time'],
),
wordsLearned: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}words_learned'],
)!,
testsCompleted: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}tests_completed'],
)!,
accuracy: attachedDatabase.typeMapping.read(
DriftSqlType.double,
data['${effectivePrefix}accuracy'],
)!,
packId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}pack_id'],
),
testId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}test_id'],
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
deletedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}deleted_at'],
),
);
}
@override
$StudySessionsTable createAlias(String alias) {
return $StudySessionsTable(attachedDatabase, alias);
}
}
class StudySession extends DataClass implements Insertable<StudySession> {
final String id;
final String userId;
final String? sessionId;
final PgDateTime startTime;
final PgDateTime? endTime;
final int wordsLearned;
final int testsCompleted;
final double accuracy;
final String? packId;
final String? testId;
final PgDateTime createdAt;
final PgDateTime updatedAt;
final bool isDeleted;
final PgDateTime? deletedAt;
const StudySession({
required this.id,
required this.userId,
this.sessionId,
required this.startTime,
this.endTime,
required this.wordsLearned,
required this.testsCompleted,
required this.accuracy,
this.packId,
this.testId,
required this.createdAt,
required this.updatedAt,
required this.isDeleted,
this.deletedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['user_id'] = Variable<String>(userId);
if (!nullToAbsent || sessionId != null) {
map['session_id'] = Variable<String>(sessionId);
}
map['start_time'] = Variable<PgDateTime>(
startTime,
PgTypes.timestampWithTimezone,
);
if (!nullToAbsent || endTime != null) {
map['end_time'] = Variable<PgDateTime>(
endTime,
PgTypes.timestampWithTimezone,
);
}
map['words_learned'] = Variable<int>(wordsLearned);
map['tests_completed'] = Variable<int>(testsCompleted);
map['accuracy'] = Variable<double>(accuracy);
if (!nullToAbsent || packId != null) {
map['pack_id'] = Variable<String>(packId);
}
if (!nullToAbsent || testId != null) {
map['test_id'] = Variable<String>(testId);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
if (!nullToAbsent || deletedAt != null) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt,
PgTypes.timestampWithTimezone,
);
}
return map;
}
StudySessionsCompanion toCompanion(bool nullToAbsent) {
return StudySessionsCompanion(
id: Value(id),
userId: Value(userId),
sessionId: sessionId == null && nullToAbsent
? const Value.absent()
: Value(sessionId),
startTime: Value(startTime),
endTime: endTime == null && nullToAbsent
? const Value.absent()
: Value(endTime),
wordsLearned: Value(wordsLearned),
testsCompleted: Value(testsCompleted),
accuracy: Value(accuracy),
packId: packId == null && nullToAbsent
? const Value.absent()
: Value(packId),
testId: testId == null && nullToAbsent
? const Value.absent()
: Value(testId),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
isDeleted: Value(isDeleted),
deletedAt: deletedAt == null && nullToAbsent
? const Value.absent()
: Value(deletedAt),
);
}
factory StudySession.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return StudySession(
id: serializer.fromJson<String>(json['id']),
userId: serializer.fromJson<String>(json['userId']),
sessionId: serializer.fromJson<String?>(json['sessionId']),
startTime: serializer.fromJson<PgDateTime>(json['startTime']),
endTime: serializer.fromJson<PgDateTime?>(json['endTime']),
wordsLearned: serializer.fromJson<int>(json['wordsLearned']),
testsCompleted: serializer.fromJson<int>(json['testsCompleted']),
accuracy: serializer.fromJson<double>(json['accuracy']),
packId: serializer.fromJson<String?>(json['packId']),
testId: serializer.fromJson<String?>(json['testId']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
deletedAt: serializer.fromJson<PgDateTime?>(json['deletedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'userId': serializer.toJson<String>(userId),
'sessionId': serializer.toJson<String?>(sessionId),
'startTime': serializer.toJson<PgDateTime>(startTime),
'endTime': serializer.toJson<PgDateTime?>(endTime),
'wordsLearned': serializer.toJson<int>(wordsLearned),
'testsCompleted': serializer.toJson<int>(testsCompleted),
'accuracy': serializer.toJson<double>(accuracy),
'packId': serializer.toJson<String?>(packId),
'testId': serializer.toJson<String?>(testId),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
'deletedAt': serializer.toJson<PgDateTime?>(deletedAt),
};
}
StudySession copyWith({
String? id,
String? userId,
Value<String?> sessionId = const Value.absent(),
PgDateTime? startTime,
Value<PgDateTime?> endTime = const Value.absent(),
int? wordsLearned,
int? testsCompleted,
double? accuracy,
Value<String?> packId = const Value.absent(),
Value<String?> testId = const Value.absent(),
PgDateTime? createdAt,
PgDateTime? updatedAt,
bool? isDeleted,
Value<PgDateTime?> deletedAt = const Value.absent(),
}) => StudySession(
id: id ?? this.id,
userId: userId ?? this.userId,
sessionId: sessionId.present ? sessionId.value : this.sessionId,
startTime: startTime ?? this.startTime,
endTime: endTime.present ? endTime.value : this.endTime,
wordsLearned: wordsLearned ?? this.wordsLearned,
testsCompleted: testsCompleted ?? this.testsCompleted,
accuracy: accuracy ?? this.accuracy,
packId: packId.present ? packId.value : this.packId,
testId: testId.present ? testId.value : this.testId,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
);
StudySession copyWithCompanion(StudySessionsCompanion data) {
return StudySession(
id: data.id.present ? data.id.value : this.id,
userId: data.userId.present ? data.userId.value : this.userId,
sessionId: data.sessionId.present ? data.sessionId.value : this.sessionId,
startTime: data.startTime.present ? data.startTime.value : this.startTime,
endTime: data.endTime.present ? data.endTime.value : this.endTime,
wordsLearned: data.wordsLearned.present
? data.wordsLearned.value
: this.wordsLearned,
testsCompleted: data.testsCompleted.present
? data.testsCompleted.value
: this.testsCompleted,
accuracy: data.accuracy.present ? data.accuracy.value : this.accuracy,
packId: data.packId.present ? data.packId.value : this.packId,
testId: data.testId.present ? data.testId.value : this.testId,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
);
}
@override
String toString() {
return (StringBuffer('StudySession(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('sessionId: $sessionId, ')
..write('startTime: $startTime, ')
..write('endTime: $endTime, ')
..write('wordsLearned: $wordsLearned, ')
..write('testsCompleted: $testsCompleted, ')
..write('accuracy: $accuracy, ')
..write('packId: $packId, ')
..write('testId: $testId, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
userId,
sessionId,
startTime,
endTime,
wordsLearned,
testsCompleted,
accuracy,
packId,
testId,
createdAt,
updatedAt,
isDeleted,
deletedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is StudySession &&
other.id == this.id &&
other.userId == this.userId &&
other.sessionId == this.sessionId &&
other.startTime == this.startTime &&
other.endTime == this.endTime &&
other.wordsLearned == this.wordsLearned &&
other.testsCompleted == this.testsCompleted &&
other.accuracy == this.accuracy &&
other.packId == this.packId &&
other.testId == this.testId &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt &&
other.isDeleted == this.isDeleted &&
other.deletedAt == this.deletedAt);
}
class StudySessionsCompanion extends UpdateCompanion<StudySession> {
final Value<String> id;
final Value<String> userId;
final Value<String?> sessionId;
final Value<PgDateTime> startTime;
final Value<PgDateTime?> endTime;
final Value<int> wordsLearned;
final Value<int> testsCompleted;
final Value<double> accuracy;
final Value<String?> packId;
final Value<String?> testId;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<bool> isDeleted;
final Value<PgDateTime?> deletedAt;
final Value<int> rowid;
const StudySessionsCompanion({
this.id = const Value.absent(),
this.userId = const Value.absent(),
this.sessionId = const Value.absent(),
this.startTime = const Value.absent(),
this.endTime = const Value.absent(),
this.wordsLearned = const Value.absent(),
this.testsCompleted = const Value.absent(),
this.accuracy = const Value.absent(),
this.packId = const Value.absent(),
this.testId = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
StudySessionsCompanion.insert({
this.id = const Value.absent(),
required String userId,
this.sessionId = const Value.absent(),
required PgDateTime startTime,
this.endTime = const Value.absent(),
this.wordsLearned = const Value.absent(),
this.testsCompleted = const Value.absent(),
this.accuracy = const Value.absent(),
this.packId = const Value.absent(),
this.testId = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : userId = Value(userId),
startTime = Value(startTime);
static Insertable<StudySession> custom({
Expression<String>? id,
Expression<String>? userId,
Expression<String>? sessionId,
Expression<PgDateTime>? startTime,
Expression<PgDateTime>? endTime,
Expression<int>? wordsLearned,
Expression<int>? testsCompleted,
Expression<double>? accuracy,
Expression<String>? packId,
Expression<String>? testId,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<bool>? isDeleted,
Expression<PgDateTime>? deletedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (userId != null) 'user_id': userId,
if (sessionId != null) 'session_id': sessionId,
if (startTime != null) 'start_time': startTime,
if (endTime != null) 'end_time': endTime,
if (wordsLearned != null) 'words_learned': wordsLearned,
if (testsCompleted != null) 'tests_completed': testsCompleted,
if (accuracy != null) 'accuracy': accuracy,
if (packId != null) 'pack_id': packId,
if (testId != null) 'test_id': testId,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (deletedAt != null) 'deleted_at': deletedAt,
if (rowid != null) 'rowid': rowid,
});
}
StudySessionsCompanion copyWith({
Value<String>? id,
Value<String>? userId,
Value<String?>? sessionId,
Value<PgDateTime>? startTime,
Value<PgDateTime?>? endTime,
Value<int>? wordsLearned,
Value<int>? testsCompleted,
Value<double>? accuracy,
Value<String?>? packId,
Value<String?>? testId,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<bool>? isDeleted,
Value<PgDateTime?>? deletedAt,
Value<int>? rowid,
}) {
return StudySessionsCompanion(
id: id ?? this.id,
userId: userId ?? this.userId,
sessionId: sessionId ?? this.sessionId,
startTime: startTime ?? this.startTime,
endTime: endTime ?? this.endTime,
wordsLearned: wordsLearned ?? this.wordsLearned,
testsCompleted: testsCompleted ?? this.testsCompleted,
accuracy: accuracy ?? this.accuracy,
packId: packId ?? this.packId,
testId: testId ?? this.testId,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt ?? this.deletedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (sessionId.present) {
map['session_id'] = Variable<String>(sessionId.value);
}
if (startTime.present) {
map['start_time'] = Variable<PgDateTime>(
startTime.value,
PgTypes.timestampWithTimezone,
);
}
if (endTime.present) {
map['end_time'] = Variable<PgDateTime>(
endTime.value,
PgTypes.timestampWithTimezone,
);
}
if (wordsLearned.present) {
map['words_learned'] = Variable<int>(wordsLearned.value);
}
if (testsCompleted.present) {
map['tests_completed'] = Variable<int>(testsCompleted.value);
}
if (accuracy.present) {
map['accuracy'] = Variable<double>(accuracy.value);
}
if (packId.present) {
map['pack_id'] = Variable<String>(packId.value);
}
if (testId.present) {
map['test_id'] = Variable<String>(testId.value);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (deletedAt.present) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('StudySessionsCompanion(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('sessionId: $sessionId, ')
..write('startTime: $startTime, ')
..write('endTime: $endTime, ')
..write('wordsLearned: $wordsLearned, ')
..write('testsCompleted: $testsCompleted, ')
..write('accuracy: $accuracy, ')
..write('packId: $packId, ')
..write('testId: $testId, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $WordStatisticsTable extends WordStatistics
with TableInfo<$WordStatisticsTable, WordStatistic> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$WordStatisticsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES users (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _cardIdMeta = const VerificationMeta('cardId');
@override
late final GeneratedColumn<String> cardId = GeneratedColumn<String>(
'card_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES game_cards (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _correctAnswersMeta = const VerificationMeta(
'correctAnswers',
);
@override
late final GeneratedColumn<int> correctAnswers = GeneratedColumn<int>(
'correct_answers',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _incorrectAnswersMeta = const VerificationMeta(
'incorrectAnswers',
);
@override
late final GeneratedColumn<int> incorrectAnswers = GeneratedColumn<int>(
'incorrect_answers',
aliasedName,
false,
type: DriftSqlType.int,
requiredDuringInsert: false,
defaultValue: const Constant(0),
);
static const VerificationMeta _masteryMeta = const VerificationMeta(
'mastery',
);
@override
late final GeneratedColumn<double> mastery = GeneratedColumn<double>(
'mastery',
aliasedName,
false,
type: DriftSqlType.double,
requiredDuringInsert: false,
defaultValue: const Constant(0.0),
);
static const VerificationMeta _lastReviewedMeta = const VerificationMeta(
'lastReviewed',
);
@override
late final GeneratedColumn<PgDateTime> lastReviewed =
GeneratedColumn<PgDateTime>(
'last_reviewed',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
static const VerificationMeta _nextReviewMeta = const VerificationMeta(
'nextReview',
);
@override
late final GeneratedColumn<PgDateTime> nextReview =
GeneratedColumn<PgDateTime>(
'next_review',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _isDeletedMeta = const VerificationMeta(
'isDeleted',
);
@override
late final GeneratedColumn<bool> isDeleted = GeneratedColumn<bool>(
'is_deleted',
aliasedName,
false,
type: DriftSqlType.bool,
requiredDuringInsert: false,
$customConstraints: 'NOT NULL DEFAULT FALSE',
defaultValue: const CustomExpression('FALSE'),
);
static const VerificationMeta _deletedAtMeta = const VerificationMeta(
'deletedAt',
);
@override
late final GeneratedColumn<PgDateTime> deletedAt =
GeneratedColumn<PgDateTime>(
'deleted_at',
aliasedName,
true,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
);
@override
List<GeneratedColumn> get $columns => [
id,
userId,
cardId,
correctAnswers,
incorrectAnswers,
mastery,
lastReviewed,
nextReview,
createdAt,
updatedAt,
isDeleted,
deletedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'word_statistics';
@override
VerificationContext validateIntegrity(
Insertable<WordStatistic> 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('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('card_id')) {
context.handle(
_cardIdMeta,
cardId.isAcceptableOrUnknown(data['card_id']!, _cardIdMeta),
);
} else if (isInserting) {
context.missing(_cardIdMeta);
}
if (data.containsKey('correct_answers')) {
context.handle(
_correctAnswersMeta,
correctAnswers.isAcceptableOrUnknown(
data['correct_answers']!,
_correctAnswersMeta,
),
);
}
if (data.containsKey('incorrect_answers')) {
context.handle(
_incorrectAnswersMeta,
incorrectAnswers.isAcceptableOrUnknown(
data['incorrect_answers']!,
_incorrectAnswersMeta,
),
);
}
if (data.containsKey('mastery')) {
context.handle(
_masteryMeta,
mastery.isAcceptableOrUnknown(data['mastery']!, _masteryMeta),
);
}
if (data.containsKey('last_reviewed')) {
context.handle(
_lastReviewedMeta,
lastReviewed.isAcceptableOrUnknown(
data['last_reviewed']!,
_lastReviewedMeta,
),
);
}
if (data.containsKey('next_review')) {
context.handle(
_nextReviewMeta,
nextReview.isAcceptableOrUnknown(data['next_review']!, _nextReviewMeta),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
if (data.containsKey('is_deleted')) {
context.handle(
_isDeletedMeta,
isDeleted.isAcceptableOrUnknown(data['is_deleted']!, _isDeletedMeta),
);
}
if (data.containsKey('deleted_at')) {
context.handle(
_deletedAtMeta,
deletedAt.isAcceptableOrUnknown(data['deleted_at']!, _deletedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
WordStatistic map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return WordStatistic(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
)!,
cardId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}card_id'],
)!,
correctAnswers: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}correct_answers'],
)!,
incorrectAnswers: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}incorrect_answers'],
)!,
mastery: attachedDatabase.typeMapping.read(
DriftSqlType.double,
data['${effectivePrefix}mastery'],
)!,
lastReviewed: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}last_reviewed'],
),
nextReview: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}next_review'],
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
isDeleted: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}is_deleted'],
)!,
deletedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}deleted_at'],
),
);
}
@override
$WordStatisticsTable createAlias(String alias) {
return $WordStatisticsTable(attachedDatabase, alias);
}
}
class WordStatistic extends DataClass implements Insertable<WordStatistic> {
final String id;
final String userId;
final String cardId;
final int correctAnswers;
final int incorrectAnswers;
final double mastery;
final PgDateTime? lastReviewed;
final PgDateTime? nextReview;
final PgDateTime createdAt;
final PgDateTime updatedAt;
final bool isDeleted;
final PgDateTime? deletedAt;
const WordStatistic({
required this.id,
required this.userId,
required this.cardId,
required this.correctAnswers,
required this.incorrectAnswers,
required this.mastery,
this.lastReviewed,
this.nextReview,
required this.createdAt,
required this.updatedAt,
required this.isDeleted,
this.deletedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['user_id'] = Variable<String>(userId);
map['card_id'] = Variable<String>(cardId);
map['correct_answers'] = Variable<int>(correctAnswers);
map['incorrect_answers'] = Variable<int>(incorrectAnswers);
map['mastery'] = Variable<double>(mastery);
if (!nullToAbsent || lastReviewed != null) {
map['last_reviewed'] = Variable<PgDateTime>(
lastReviewed,
PgTypes.timestampWithTimezone,
);
}
if (!nullToAbsent || nextReview != null) {
map['next_review'] = Variable<PgDateTime>(
nextReview,
PgTypes.timestampWithTimezone,
);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
map['is_deleted'] = Variable<bool>(isDeleted);
if (!nullToAbsent || deletedAt != null) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt,
PgTypes.timestampWithTimezone,
);
}
return map;
}
WordStatisticsCompanion toCompanion(bool nullToAbsent) {
return WordStatisticsCompanion(
id: Value(id),
userId: Value(userId),
cardId: Value(cardId),
correctAnswers: Value(correctAnswers),
incorrectAnswers: Value(incorrectAnswers),
mastery: Value(mastery),
lastReviewed: lastReviewed == null && nullToAbsent
? const Value.absent()
: Value(lastReviewed),
nextReview: nextReview == null && nullToAbsent
? const Value.absent()
: Value(nextReview),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
isDeleted: Value(isDeleted),
deletedAt: deletedAt == null && nullToAbsent
? const Value.absent()
: Value(deletedAt),
);
}
factory WordStatistic.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return WordStatistic(
id: serializer.fromJson<String>(json['id']),
userId: serializer.fromJson<String>(json['userId']),
cardId: serializer.fromJson<String>(json['cardId']),
correctAnswers: serializer.fromJson<int>(json['correctAnswers']),
incorrectAnswers: serializer.fromJson<int>(json['incorrectAnswers']),
mastery: serializer.fromJson<double>(json['mastery']),
lastReviewed: serializer.fromJson<PgDateTime?>(json['lastReviewed']),
nextReview: serializer.fromJson<PgDateTime?>(json['nextReview']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
isDeleted: serializer.fromJson<bool>(json['isDeleted']),
deletedAt: serializer.fromJson<PgDateTime?>(json['deletedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'userId': serializer.toJson<String>(userId),
'cardId': serializer.toJson<String>(cardId),
'correctAnswers': serializer.toJson<int>(correctAnswers),
'incorrectAnswers': serializer.toJson<int>(incorrectAnswers),
'mastery': serializer.toJson<double>(mastery),
'lastReviewed': serializer.toJson<PgDateTime?>(lastReviewed),
'nextReview': serializer.toJson<PgDateTime?>(nextReview),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
'isDeleted': serializer.toJson<bool>(isDeleted),
'deletedAt': serializer.toJson<PgDateTime?>(deletedAt),
};
}
WordStatistic copyWith({
String? id,
String? userId,
String? cardId,
int? correctAnswers,
int? incorrectAnswers,
double? mastery,
Value<PgDateTime?> lastReviewed = const Value.absent(),
Value<PgDateTime?> nextReview = const Value.absent(),
PgDateTime? createdAt,
PgDateTime? updatedAt,
bool? isDeleted,
Value<PgDateTime?> deletedAt = const Value.absent(),
}) => WordStatistic(
id: id ?? this.id,
userId: userId ?? this.userId,
cardId: cardId ?? this.cardId,
correctAnswers: correctAnswers ?? this.correctAnswers,
incorrectAnswers: incorrectAnswers ?? this.incorrectAnswers,
mastery: mastery ?? this.mastery,
lastReviewed: lastReviewed.present ? lastReviewed.value : this.lastReviewed,
nextReview: nextReview.present ? nextReview.value : this.nextReview,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt.present ? deletedAt.value : this.deletedAt,
);
WordStatistic copyWithCompanion(WordStatisticsCompanion data) {
return WordStatistic(
id: data.id.present ? data.id.value : this.id,
userId: data.userId.present ? data.userId.value : this.userId,
cardId: data.cardId.present ? data.cardId.value : this.cardId,
correctAnswers: data.correctAnswers.present
? data.correctAnswers.value
: this.correctAnswers,
incorrectAnswers: data.incorrectAnswers.present
? data.incorrectAnswers.value
: this.incorrectAnswers,
mastery: data.mastery.present ? data.mastery.value : this.mastery,
lastReviewed: data.lastReviewed.present
? data.lastReviewed.value
: this.lastReviewed,
nextReview: data.nextReview.present
? data.nextReview.value
: this.nextReview,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
isDeleted: data.isDeleted.present ? data.isDeleted.value : this.isDeleted,
deletedAt: data.deletedAt.present ? data.deletedAt.value : this.deletedAt,
);
}
@override
String toString() {
return (StringBuffer('WordStatistic(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('cardId: $cardId, ')
..write('correctAnswers: $correctAnswers, ')
..write('incorrectAnswers: $incorrectAnswers, ')
..write('mastery: $mastery, ')
..write('lastReviewed: $lastReviewed, ')
..write('nextReview: $nextReview, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
userId,
cardId,
correctAnswers,
incorrectAnswers,
mastery,
lastReviewed,
nextReview,
createdAt,
updatedAt,
isDeleted,
deletedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is WordStatistic &&
other.id == this.id &&
other.userId == this.userId &&
other.cardId == this.cardId &&
other.correctAnswers == this.correctAnswers &&
other.incorrectAnswers == this.incorrectAnswers &&
other.mastery == this.mastery &&
other.lastReviewed == this.lastReviewed &&
other.nextReview == this.nextReview &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt &&
other.isDeleted == this.isDeleted &&
other.deletedAt == this.deletedAt);
}
class WordStatisticsCompanion extends UpdateCompanion<WordStatistic> {
final Value<String> id;
final Value<String> userId;
final Value<String> cardId;
final Value<int> correctAnswers;
final Value<int> incorrectAnswers;
final Value<double> mastery;
final Value<PgDateTime?> lastReviewed;
final Value<PgDateTime?> nextReview;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<bool> isDeleted;
final Value<PgDateTime?> deletedAt;
final Value<int> rowid;
const WordStatisticsCompanion({
this.id = const Value.absent(),
this.userId = const Value.absent(),
this.cardId = const Value.absent(),
this.correctAnswers = const Value.absent(),
this.incorrectAnswers = const Value.absent(),
this.mastery = const Value.absent(),
this.lastReviewed = const Value.absent(),
this.nextReview = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
WordStatisticsCompanion.insert({
this.id = const Value.absent(),
required String userId,
required String cardId,
this.correctAnswers = const Value.absent(),
this.incorrectAnswers = const Value.absent(),
this.mastery = const Value.absent(),
this.lastReviewed = const Value.absent(),
this.nextReview = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.isDeleted = const Value.absent(),
this.deletedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : userId = Value(userId),
cardId = Value(cardId);
static Insertable<WordStatistic> custom({
Expression<String>? id,
Expression<String>? userId,
Expression<String>? cardId,
Expression<int>? correctAnswers,
Expression<int>? incorrectAnswers,
Expression<double>? mastery,
Expression<PgDateTime>? lastReviewed,
Expression<PgDateTime>? nextReview,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<bool>? isDeleted,
Expression<PgDateTime>? deletedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (userId != null) 'user_id': userId,
if (cardId != null) 'card_id': cardId,
if (correctAnswers != null) 'correct_answers': correctAnswers,
if (incorrectAnswers != null) 'incorrect_answers': incorrectAnswers,
if (mastery != null) 'mastery': mastery,
if (lastReviewed != null) 'last_reviewed': lastReviewed,
if (nextReview != null) 'next_review': nextReview,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (isDeleted != null) 'is_deleted': isDeleted,
if (deletedAt != null) 'deleted_at': deletedAt,
if (rowid != null) 'rowid': rowid,
});
}
WordStatisticsCompanion copyWith({
Value<String>? id,
Value<String>? userId,
Value<String>? cardId,
Value<int>? correctAnswers,
Value<int>? incorrectAnswers,
Value<double>? mastery,
Value<PgDateTime?>? lastReviewed,
Value<PgDateTime?>? nextReview,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<bool>? isDeleted,
Value<PgDateTime?>? deletedAt,
Value<int>? rowid,
}) {
return WordStatisticsCompanion(
id: id ?? this.id,
userId: userId ?? this.userId,
cardId: cardId ?? this.cardId,
correctAnswers: correctAnswers ?? this.correctAnswers,
incorrectAnswers: incorrectAnswers ?? this.incorrectAnswers,
mastery: mastery ?? this.mastery,
lastReviewed: lastReviewed ?? this.lastReviewed,
nextReview: nextReview ?? this.nextReview,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
isDeleted: isDeleted ?? this.isDeleted,
deletedAt: deletedAt ?? this.deletedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (cardId.present) {
map['card_id'] = Variable<String>(cardId.value);
}
if (correctAnswers.present) {
map['correct_answers'] = Variable<int>(correctAnswers.value);
}
if (incorrectAnswers.present) {
map['incorrect_answers'] = Variable<int>(incorrectAnswers.value);
}
if (mastery.present) {
map['mastery'] = Variable<double>(mastery.value);
}
if (lastReviewed.present) {
map['last_reviewed'] = Variable<PgDateTime>(
lastReviewed.value,
PgTypes.timestampWithTimezone,
);
}
if (nextReview.present) {
map['next_review'] = Variable<PgDateTime>(
nextReview.value,
PgTypes.timestampWithTimezone,
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (isDeleted.present) {
map['is_deleted'] = Variable<bool>(isDeleted.value);
}
if (deletedAt.present) {
map['deleted_at'] = Variable<PgDateTime>(
deletedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('WordStatisticsCompanion(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('cardId: $cardId, ')
..write('correctAnswers: $correctAnswers, ')
..write('incorrectAnswers: $incorrectAnswers, ')
..write('mastery: $mastery, ')
..write('lastReviewed: $lastReviewed, ')
..write('nextReview: $nextReview, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('isDeleted: $isDeleted, ')
..write('deletedAt: $deletedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $UserAchievementsTable extends UserAchievements
with TableInfo<$UserAchievementsTable, UserAchievement> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$UserAchievementsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
defaultConstraints: GeneratedColumn.constraintIsAlways(
'REFERENCES users (id) ON DELETE CASCADE',
),
);
static const VerificationMeta _achievementIdMeta = const VerificationMeta(
'achievementId',
);
@override
late final GeneratedColumn<String> achievementId = GeneratedColumn<String>(
'achievement_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _unlockedAtMeta = const VerificationMeta(
'unlockedAt',
);
@override
late final GeneratedColumn<PgDateTime> unlockedAt =
GeneratedColumn<PgDateTime>(
'unlocked_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _progressMeta = const VerificationMeta(
'progress',
);
@override
late final GeneratedColumn<double> progress = GeneratedColumn<double>(
'progress',
aliasedName,
false,
type: DriftSqlType.double,
requiredDuringInsert: false,
defaultValue: const Constant(1.0),
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
@override
List<GeneratedColumn> get $columns => [
id,
userId,
achievementId,
unlockedAt,
progress,
createdAt,
updatedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'user_achievements';
@override
VerificationContext validateIntegrity(
Insertable<UserAchievement> 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('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
} else if (isInserting) {
context.missing(_userIdMeta);
}
if (data.containsKey('achievement_id')) {
context.handle(
_achievementIdMeta,
achievementId.isAcceptableOrUnknown(
data['achievement_id']!,
_achievementIdMeta,
),
);
} else if (isInserting) {
context.missing(_achievementIdMeta);
}
if (data.containsKey('unlocked_at')) {
context.handle(
_unlockedAtMeta,
unlockedAt.isAcceptableOrUnknown(data['unlocked_at']!, _unlockedAtMeta),
);
}
if (data.containsKey('progress')) {
context.handle(
_progressMeta,
progress.isAcceptableOrUnknown(data['progress']!, _progressMeta),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
UserAchievement map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return UserAchievement(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
)!,
achievementId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}achievement_id'],
)!,
unlockedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}unlocked_at'],
)!,
progress: attachedDatabase.typeMapping.read(
DriftSqlType.double,
data['${effectivePrefix}progress'],
)!,
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
);
}
@override
$UserAchievementsTable createAlias(String alias) {
return $UserAchievementsTable(attachedDatabase, alias);
}
}
class UserAchievement extends DataClass implements Insertable<UserAchievement> {
final String id;
final String userId;
final String achievementId;
final PgDateTime unlockedAt;
final double progress;
final PgDateTime createdAt;
final PgDateTime updatedAt;
const UserAchievement({
required this.id,
required this.userId,
required this.achievementId,
required this.unlockedAt,
required this.progress,
required this.createdAt,
required this.updatedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['user_id'] = Variable<String>(userId);
map['achievement_id'] = Variable<String>(achievementId);
map['unlocked_at'] = Variable<PgDateTime>(
unlockedAt,
PgTypes.timestampWithTimezone,
);
map['progress'] = Variable<double>(progress);
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
return map;
}
UserAchievementsCompanion toCompanion(bool nullToAbsent) {
return UserAchievementsCompanion(
id: Value(id),
userId: Value(userId),
achievementId: Value(achievementId),
unlockedAt: Value(unlockedAt),
progress: Value(progress),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
);
}
factory UserAchievement.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return UserAchievement(
id: serializer.fromJson<String>(json['id']),
userId: serializer.fromJson<String>(json['userId']),
achievementId: serializer.fromJson<String>(json['achievementId']),
unlockedAt: serializer.fromJson<PgDateTime>(json['unlockedAt']),
progress: serializer.fromJson<double>(json['progress']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'userId': serializer.toJson<String>(userId),
'achievementId': serializer.toJson<String>(achievementId),
'unlockedAt': serializer.toJson<PgDateTime>(unlockedAt),
'progress': serializer.toJson<double>(progress),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
};
}
UserAchievement copyWith({
String? id,
String? userId,
String? achievementId,
PgDateTime? unlockedAt,
double? progress,
PgDateTime? createdAt,
PgDateTime? updatedAt,
}) => UserAchievement(
id: id ?? this.id,
userId: userId ?? this.userId,
achievementId: achievementId ?? this.achievementId,
unlockedAt: unlockedAt ?? this.unlockedAt,
progress: progress ?? this.progress,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
);
UserAchievement copyWithCompanion(UserAchievementsCompanion data) {
return UserAchievement(
id: data.id.present ? data.id.value : this.id,
userId: data.userId.present ? data.userId.value : this.userId,
achievementId: data.achievementId.present
? data.achievementId.value
: this.achievementId,
unlockedAt: data.unlockedAt.present
? data.unlockedAt.value
: this.unlockedAt,
progress: data.progress.present ? data.progress.value : this.progress,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
);
}
@override
String toString() {
return (StringBuffer('UserAchievement(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('achievementId: $achievementId, ')
..write('unlockedAt: $unlockedAt, ')
..write('progress: $progress, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
userId,
achievementId,
unlockedAt,
progress,
createdAt,
updatedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is UserAchievement &&
other.id == this.id &&
other.userId == this.userId &&
other.achievementId == this.achievementId &&
other.unlockedAt == this.unlockedAt &&
other.progress == this.progress &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt);
}
class UserAchievementsCompanion extends UpdateCompanion<UserAchievement> {
final Value<String> id;
final Value<String> userId;
final Value<String> achievementId;
final Value<PgDateTime> unlockedAt;
final Value<double> progress;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<int> rowid;
const UserAchievementsCompanion({
this.id = const Value.absent(),
this.userId = const Value.absent(),
this.achievementId = const Value.absent(),
this.unlockedAt = const Value.absent(),
this.progress = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
UserAchievementsCompanion.insert({
this.id = const Value.absent(),
required String userId,
required String achievementId,
this.unlockedAt = const Value.absent(),
this.progress = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : userId = Value(userId),
achievementId = Value(achievementId);
static Insertable<UserAchievement> custom({
Expression<String>? id,
Expression<String>? userId,
Expression<String>? achievementId,
Expression<PgDateTime>? unlockedAt,
Expression<double>? progress,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (userId != null) 'user_id': userId,
if (achievementId != null) 'achievement_id': achievementId,
if (unlockedAt != null) 'unlocked_at': unlockedAt,
if (progress != null) 'progress': progress,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (rowid != null) 'rowid': rowid,
});
}
UserAchievementsCompanion copyWith({
Value<String>? id,
Value<String>? userId,
Value<String>? achievementId,
Value<PgDateTime>? unlockedAt,
Value<double>? progress,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<int>? rowid,
}) {
return UserAchievementsCompanion(
id: id ?? this.id,
userId: userId ?? this.userId,
achievementId: achievementId ?? this.achievementId,
unlockedAt: unlockedAt ?? this.unlockedAt,
progress: progress ?? this.progress,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (achievementId.present) {
map['achievement_id'] = Variable<String>(achievementId.value);
}
if (unlockedAt.present) {
map['unlocked_at'] = Variable<PgDateTime>(
unlockedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (progress.present) {
map['progress'] = Variable<double>(progress.value);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('UserAchievementsCompanion(')
..write('id: $id, ')
..write('userId: $userId, ')
..write('achievementId: $achievementId, ')
..write('unlockedAt: $unlockedAt, ')
..write('progress: $progress, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $ShareRequestsTable extends ShareRequests
with TableInfo<$ShareRequestsTable, ShareRequest> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$ShareRequestsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _telegramUserIdMeta = const VerificationMeta(
'telegramUserId',
);
@override
late final GeneratedColumn<String> telegramUserId = GeneratedColumn<String>(
'telegram_user_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _telegramUsernameMeta = const VerificationMeta(
'telegramUsername',
);
@override
late final GeneratedColumn<String> telegramUsername = GeneratedColumn<String>(
'telegram_username',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _sharedCardIdMeta = const VerificationMeta(
'sharedCardId',
);
@override
late final GeneratedColumn<String> sharedCardId = GeneratedColumn<String>(
'shared_card_id',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _requestedAtMeta = const VerificationMeta(
'requestedAt',
);
@override
late final GeneratedColumn<PgDateTime> requestedAt =
GeneratedColumn<PgDateTime>(
'requested_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
static const VerificationMeta _updatedAtMeta = const VerificationMeta(
'updatedAt',
);
@override
late final GeneratedColumn<PgDateTime> updatedAt =
GeneratedColumn<PgDateTime>(
'updated_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
@override
List<GeneratedColumn> get $columns => [
id,
telegramUserId,
telegramUsername,
sharedCardId,
requestedAt,
createdAt,
updatedAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'share_requests';
@override
VerificationContext validateIntegrity(
Insertable<ShareRequest> 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('telegram_user_id')) {
context.handle(
_telegramUserIdMeta,
telegramUserId.isAcceptableOrUnknown(
data['telegram_user_id']!,
_telegramUserIdMeta,
),
);
} else if (isInserting) {
context.missing(_telegramUserIdMeta);
}
if (data.containsKey('telegram_username')) {
context.handle(
_telegramUsernameMeta,
telegramUsername.isAcceptableOrUnknown(
data['telegram_username']!,
_telegramUsernameMeta,
),
);
}
if (data.containsKey('shared_card_id')) {
context.handle(
_sharedCardIdMeta,
sharedCardId.isAcceptableOrUnknown(
data['shared_card_id']!,
_sharedCardIdMeta,
),
);
}
if (data.containsKey('requested_at')) {
context.handle(
_requestedAtMeta,
requestedAt.isAcceptableOrUnknown(
data['requested_at']!,
_requestedAtMeta,
),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
if (data.containsKey('updated_at')) {
context.handle(
_updatedAtMeta,
updatedAt.isAcceptableOrUnknown(data['updated_at']!, _updatedAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
ShareRequest map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return ShareRequest(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
telegramUserId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}telegram_user_id'],
)!,
telegramUsername: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}telegram_username'],
),
sharedCardId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}shared_card_id'],
),
requestedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}requested_at'],
)!,
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
updatedAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}updated_at'],
)!,
);
}
@override
$ShareRequestsTable createAlias(String alias) {
return $ShareRequestsTable(attachedDatabase, alias);
}
}
class ShareRequest extends DataClass implements Insertable<ShareRequest> {
final String id;
final String telegramUserId;
final String? telegramUsername;
final String? sharedCardId;
final PgDateTime requestedAt;
final PgDateTime createdAt;
final PgDateTime updatedAt;
const ShareRequest({
required this.id,
required this.telegramUserId,
this.telegramUsername,
this.sharedCardId,
required this.requestedAt,
required this.createdAt,
required this.updatedAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['telegram_user_id'] = Variable<String>(telegramUserId);
if (!nullToAbsent || telegramUsername != null) {
map['telegram_username'] = Variable<String>(telegramUsername);
}
if (!nullToAbsent || sharedCardId != null) {
map['shared_card_id'] = Variable<String>(sharedCardId);
}
map['requested_at'] = Variable<PgDateTime>(
requestedAt,
PgTypes.timestampWithTimezone,
);
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
map['updated_at'] = Variable<PgDateTime>(
updatedAt,
PgTypes.timestampWithTimezone,
);
return map;
}
ShareRequestsCompanion toCompanion(bool nullToAbsent) {
return ShareRequestsCompanion(
id: Value(id),
telegramUserId: Value(telegramUserId),
telegramUsername: telegramUsername == null && nullToAbsent
? const Value.absent()
: Value(telegramUsername),
sharedCardId: sharedCardId == null && nullToAbsent
? const Value.absent()
: Value(sharedCardId),
requestedAt: Value(requestedAt),
createdAt: Value(createdAt),
updatedAt: Value(updatedAt),
);
}
factory ShareRequest.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return ShareRequest(
id: serializer.fromJson<String>(json['id']),
telegramUserId: serializer.fromJson<String>(json['telegramUserId']),
telegramUsername: serializer.fromJson<String?>(json['telegramUsername']),
sharedCardId: serializer.fromJson<String?>(json['sharedCardId']),
requestedAt: serializer.fromJson<PgDateTime>(json['requestedAt']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
updatedAt: serializer.fromJson<PgDateTime>(json['updatedAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'telegramUserId': serializer.toJson<String>(telegramUserId),
'telegramUsername': serializer.toJson<String?>(telegramUsername),
'sharedCardId': serializer.toJson<String?>(sharedCardId),
'requestedAt': serializer.toJson<PgDateTime>(requestedAt),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
'updatedAt': serializer.toJson<PgDateTime>(updatedAt),
};
}
ShareRequest copyWith({
String? id,
String? telegramUserId,
Value<String?> telegramUsername = const Value.absent(),
Value<String?> sharedCardId = const Value.absent(),
PgDateTime? requestedAt,
PgDateTime? createdAt,
PgDateTime? updatedAt,
}) => ShareRequest(
id: id ?? this.id,
telegramUserId: telegramUserId ?? this.telegramUserId,
telegramUsername: telegramUsername.present
? telegramUsername.value
: this.telegramUsername,
sharedCardId: sharedCardId.present ? sharedCardId.value : this.sharedCardId,
requestedAt: requestedAt ?? this.requestedAt,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
);
ShareRequest copyWithCompanion(ShareRequestsCompanion data) {
return ShareRequest(
id: data.id.present ? data.id.value : this.id,
telegramUserId: data.telegramUserId.present
? data.telegramUserId.value
: this.telegramUserId,
telegramUsername: data.telegramUsername.present
? data.telegramUsername.value
: this.telegramUsername,
sharedCardId: data.sharedCardId.present
? data.sharedCardId.value
: this.sharedCardId,
requestedAt: data.requestedAt.present
? data.requestedAt.value
: this.requestedAt,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
updatedAt: data.updatedAt.present ? data.updatedAt.value : this.updatedAt,
);
}
@override
String toString() {
return (StringBuffer('ShareRequest(')
..write('id: $id, ')
..write('telegramUserId: $telegramUserId, ')
..write('telegramUsername: $telegramUsername, ')
..write('sharedCardId: $sharedCardId, ')
..write('requestedAt: $requestedAt, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
telegramUserId,
telegramUsername,
sharedCardId,
requestedAt,
createdAt,
updatedAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is ShareRequest &&
other.id == this.id &&
other.telegramUserId == this.telegramUserId &&
other.telegramUsername == this.telegramUsername &&
other.sharedCardId == this.sharedCardId &&
other.requestedAt == this.requestedAt &&
other.createdAt == this.createdAt &&
other.updatedAt == this.updatedAt);
}
class ShareRequestsCompanion extends UpdateCompanion<ShareRequest> {
final Value<String> id;
final Value<String> telegramUserId;
final Value<String?> telegramUsername;
final Value<String?> sharedCardId;
final Value<PgDateTime> requestedAt;
final Value<PgDateTime> createdAt;
final Value<PgDateTime> updatedAt;
final Value<int> rowid;
const ShareRequestsCompanion({
this.id = const Value.absent(),
this.telegramUserId = const Value.absent(),
this.telegramUsername = const Value.absent(),
this.sharedCardId = const Value.absent(),
this.requestedAt = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
});
ShareRequestsCompanion.insert({
this.id = const Value.absent(),
required String telegramUserId,
this.telegramUsername = const Value.absent(),
this.sharedCardId = const Value.absent(),
this.requestedAt = const Value.absent(),
this.createdAt = const Value.absent(),
this.updatedAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : telegramUserId = Value(telegramUserId);
static Insertable<ShareRequest> custom({
Expression<String>? id,
Expression<String>? telegramUserId,
Expression<String>? telegramUsername,
Expression<String>? sharedCardId,
Expression<PgDateTime>? requestedAt,
Expression<PgDateTime>? createdAt,
Expression<PgDateTime>? updatedAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (telegramUserId != null) 'telegram_user_id': telegramUserId,
if (telegramUsername != null) 'telegram_username': telegramUsername,
if (sharedCardId != null) 'shared_card_id': sharedCardId,
if (requestedAt != null) 'requested_at': requestedAt,
if (createdAt != null) 'created_at': createdAt,
if (updatedAt != null) 'updated_at': updatedAt,
if (rowid != null) 'rowid': rowid,
});
}
ShareRequestsCompanion copyWith({
Value<String>? id,
Value<String>? telegramUserId,
Value<String?>? telegramUsername,
Value<String?>? sharedCardId,
Value<PgDateTime>? requestedAt,
Value<PgDateTime>? createdAt,
Value<PgDateTime>? updatedAt,
Value<int>? rowid,
}) {
return ShareRequestsCompanion(
id: id ?? this.id,
telegramUserId: telegramUserId ?? this.telegramUserId,
telegramUsername: telegramUsername ?? this.telegramUsername,
sharedCardId: sharedCardId ?? this.sharedCardId,
requestedAt: requestedAt ?? this.requestedAt,
createdAt: createdAt ?? this.createdAt,
updatedAt: updatedAt ?? this.updatedAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (telegramUserId.present) {
map['telegram_user_id'] = Variable<String>(telegramUserId.value);
}
if (telegramUsername.present) {
map['telegram_username'] = Variable<String>(telegramUsername.value);
}
if (sharedCardId.present) {
map['shared_card_id'] = Variable<String>(sharedCardId.value);
}
if (requestedAt.present) {
map['requested_at'] = Variable<PgDateTime>(
requestedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (updatedAt.present) {
map['updated_at'] = Variable<PgDateTime>(
updatedAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('ShareRequestsCompanion(')
..write('id: $id, ')
..write('telegramUserId: $telegramUserId, ')
..write('telegramUsername: $telegramUsername, ')
..write('sharedCardId: $sharedCardId, ')
..write('requestedAt: $requestedAt, ')
..write('createdAt: $createdAt, ')
..write('updatedAt: $updatedAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
class $AuditLogsTable extends AuditLogs
with TableInfo<$AuditLogsTable, AuditLog> {
@override
final GeneratedDatabase attachedDatabase;
final String? _alias;
$AuditLogsTable(this.attachedDatabase, [this._alias]);
static const VerificationMeta _idMeta = const VerificationMeta('id');
@override
late final GeneratedColumn<String> id = GeneratedColumn<String>(
'id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: false,
defaultValue: const CustomExpression('gen_random_uuid()::text'),
);
static const VerificationMeta _tableMeta = const VerificationMeta('table');
@override
late final GeneratedColumn<String> table = GeneratedColumn<String>(
'table',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _recordIdMeta = const VerificationMeta(
'recordId',
);
@override
late final GeneratedColumn<String> recordId = GeneratedColumn<String>(
'record_id',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _actionMeta = const VerificationMeta('action');
@override
late final GeneratedColumn<String> action = GeneratedColumn<String>(
'action',
aliasedName,
false,
type: DriftSqlType.string,
requiredDuringInsert: true,
);
static const VerificationMeta _userIdMeta = const VerificationMeta('userId');
@override
late final GeneratedColumn<String> userId = GeneratedColumn<String>(
'user_id',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _oldDataMeta = const VerificationMeta(
'oldData',
);
@override
late final GeneratedColumn<String> oldData = GeneratedColumn<String>(
'old_data',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _newDataMeta = const VerificationMeta(
'newData',
);
@override
late final GeneratedColumn<String> newData = GeneratedColumn<String>(
'new_data',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _ipAddressMeta = const VerificationMeta(
'ipAddress',
);
@override
late final GeneratedColumn<String> ipAddress = GeneratedColumn<String>(
'ip_address',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _userAgentMeta = const VerificationMeta(
'userAgent',
);
@override
late final GeneratedColumn<String> userAgent = GeneratedColumn<String>(
'user_agent',
aliasedName,
true,
type: DriftSqlType.string,
requiredDuringInsert: false,
);
static const VerificationMeta _createdAtMeta = const VerificationMeta(
'createdAt',
);
@override
late final GeneratedColumn<PgDateTime> createdAt =
GeneratedColumn<PgDateTime>(
'created_at',
aliasedName,
false,
type: PgTypes.timestampWithTimezone,
requiredDuringInsert: false,
defaultValue: now(),
);
@override
List<GeneratedColumn> get $columns => [
id,
table,
recordId,
action,
userId,
oldData,
newData,
ipAddress,
userAgent,
createdAt,
];
@override
String get aliasedName => _alias ?? actualTableName;
@override
String get actualTableName => $name;
static const String $name = 'audit_logs';
@override
VerificationContext validateIntegrity(
Insertable<AuditLog> 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('table')) {
context.handle(
_tableMeta,
table.isAcceptableOrUnknown(data['table']!, _tableMeta),
);
} else if (isInserting) {
context.missing(_tableMeta);
}
if (data.containsKey('record_id')) {
context.handle(
_recordIdMeta,
recordId.isAcceptableOrUnknown(data['record_id']!, _recordIdMeta),
);
} else if (isInserting) {
context.missing(_recordIdMeta);
}
if (data.containsKey('action')) {
context.handle(
_actionMeta,
action.isAcceptableOrUnknown(data['action']!, _actionMeta),
);
} else if (isInserting) {
context.missing(_actionMeta);
}
if (data.containsKey('user_id')) {
context.handle(
_userIdMeta,
userId.isAcceptableOrUnknown(data['user_id']!, _userIdMeta),
);
}
if (data.containsKey('old_data')) {
context.handle(
_oldDataMeta,
oldData.isAcceptableOrUnknown(data['old_data']!, _oldDataMeta),
);
}
if (data.containsKey('new_data')) {
context.handle(
_newDataMeta,
newData.isAcceptableOrUnknown(data['new_data']!, _newDataMeta),
);
}
if (data.containsKey('ip_address')) {
context.handle(
_ipAddressMeta,
ipAddress.isAcceptableOrUnknown(data['ip_address']!, _ipAddressMeta),
);
}
if (data.containsKey('user_agent')) {
context.handle(
_userAgentMeta,
userAgent.isAcceptableOrUnknown(data['user_agent']!, _userAgentMeta),
);
}
if (data.containsKey('created_at')) {
context.handle(
_createdAtMeta,
createdAt.isAcceptableOrUnknown(data['created_at']!, _createdAtMeta),
);
}
return context;
}
@override
Set<GeneratedColumn> get $primaryKey => {id};
@override
AuditLog map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return AuditLog(
id: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}id'],
)!,
table: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}table'],
)!,
recordId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}record_id'],
)!,
action: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}action'],
)!,
userId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_id'],
),
oldData: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}old_data'],
),
newData: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}new_data'],
),
ipAddress: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}ip_address'],
),
userAgent: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}user_agent'],
),
createdAt: attachedDatabase.typeMapping.read(
PgTypes.timestampWithTimezone,
data['${effectivePrefix}created_at'],
)!,
);
}
@override
$AuditLogsTable createAlias(String alias) {
return $AuditLogsTable(attachedDatabase, alias);
}
}
class AuditLog extends DataClass implements Insertable<AuditLog> {
final String id;
final String table;
final String recordId;
final String action;
final String? userId;
final String? oldData;
final String? newData;
final String? ipAddress;
final String? userAgent;
final PgDateTime createdAt;
const AuditLog({
required this.id,
required this.table,
required this.recordId,
required this.action,
this.userId,
this.oldData,
this.newData,
this.ipAddress,
this.userAgent,
required this.createdAt,
});
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
map['id'] = Variable<String>(id);
map['table'] = Variable<String>(table);
map['record_id'] = Variable<String>(recordId);
map['action'] = Variable<String>(action);
if (!nullToAbsent || userId != null) {
map['user_id'] = Variable<String>(userId);
}
if (!nullToAbsent || oldData != null) {
map['old_data'] = Variable<String>(oldData);
}
if (!nullToAbsent || newData != null) {
map['new_data'] = Variable<String>(newData);
}
if (!nullToAbsent || ipAddress != null) {
map['ip_address'] = Variable<String>(ipAddress);
}
if (!nullToAbsent || userAgent != null) {
map['user_agent'] = Variable<String>(userAgent);
}
map['created_at'] = Variable<PgDateTime>(
createdAt,
PgTypes.timestampWithTimezone,
);
return map;
}
AuditLogsCompanion toCompanion(bool nullToAbsent) {
return AuditLogsCompanion(
id: Value(id),
table: Value(table),
recordId: Value(recordId),
action: Value(action),
userId: userId == null && nullToAbsent
? const Value.absent()
: Value(userId),
oldData: oldData == null && nullToAbsent
? const Value.absent()
: Value(oldData),
newData: newData == null && nullToAbsent
? const Value.absent()
: Value(newData),
ipAddress: ipAddress == null && nullToAbsent
? const Value.absent()
: Value(ipAddress),
userAgent: userAgent == null && nullToAbsent
? const Value.absent()
: Value(userAgent),
createdAt: Value(createdAt),
);
}
factory AuditLog.fromJson(
Map<String, dynamic> json, {
ValueSerializer? serializer,
}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return AuditLog(
id: serializer.fromJson<String>(json['id']),
table: serializer.fromJson<String>(json['table']),
recordId: serializer.fromJson<String>(json['recordId']),
action: serializer.fromJson<String>(json['action']),
userId: serializer.fromJson<String?>(json['userId']),
oldData: serializer.fromJson<String?>(json['oldData']),
newData: serializer.fromJson<String?>(json['newData']),
ipAddress: serializer.fromJson<String?>(json['ipAddress']),
userAgent: serializer.fromJson<String?>(json['userAgent']),
createdAt: serializer.fromJson<PgDateTime>(json['createdAt']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
serializer ??= driftRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'id': serializer.toJson<String>(id),
'table': serializer.toJson<String>(table),
'recordId': serializer.toJson<String>(recordId),
'action': serializer.toJson<String>(action),
'userId': serializer.toJson<String?>(userId),
'oldData': serializer.toJson<String?>(oldData),
'newData': serializer.toJson<String?>(newData),
'ipAddress': serializer.toJson<String?>(ipAddress),
'userAgent': serializer.toJson<String?>(userAgent),
'createdAt': serializer.toJson<PgDateTime>(createdAt),
};
}
AuditLog copyWith({
String? id,
String? table,
String? recordId,
String? action,
Value<String?> userId = const Value.absent(),
Value<String?> oldData = const Value.absent(),
Value<String?> newData = const Value.absent(),
Value<String?> ipAddress = const Value.absent(),
Value<String?> userAgent = const Value.absent(),
PgDateTime? createdAt,
}) => AuditLog(
id: id ?? this.id,
table: table ?? this.table,
recordId: recordId ?? this.recordId,
action: action ?? this.action,
userId: userId.present ? userId.value : this.userId,
oldData: oldData.present ? oldData.value : this.oldData,
newData: newData.present ? newData.value : this.newData,
ipAddress: ipAddress.present ? ipAddress.value : this.ipAddress,
userAgent: userAgent.present ? userAgent.value : this.userAgent,
createdAt: createdAt ?? this.createdAt,
);
AuditLog copyWithCompanion(AuditLogsCompanion data) {
return AuditLog(
id: data.id.present ? data.id.value : this.id,
table: data.table.present ? data.table.value : this.table,
recordId: data.recordId.present ? data.recordId.value : this.recordId,
action: data.action.present ? data.action.value : this.action,
userId: data.userId.present ? data.userId.value : this.userId,
oldData: data.oldData.present ? data.oldData.value : this.oldData,
newData: data.newData.present ? data.newData.value : this.newData,
ipAddress: data.ipAddress.present ? data.ipAddress.value : this.ipAddress,
userAgent: data.userAgent.present ? data.userAgent.value : this.userAgent,
createdAt: data.createdAt.present ? data.createdAt.value : this.createdAt,
);
}
@override
String toString() {
return (StringBuffer('AuditLog(')
..write('id: $id, ')
..write('table: $table, ')
..write('recordId: $recordId, ')
..write('action: $action, ')
..write('userId: $userId, ')
..write('oldData: $oldData, ')
..write('newData: $newData, ')
..write('ipAddress: $ipAddress, ')
..write('userAgent: $userAgent, ')
..write('createdAt: $createdAt')
..write(')'))
.toString();
}
@override
int get hashCode => Object.hash(
id,
table,
recordId,
action,
userId,
oldData,
newData,
ipAddress,
userAgent,
createdAt,
);
@override
bool operator ==(Object other) =>
identical(this, other) ||
(other is AuditLog &&
other.id == this.id &&
other.table == this.table &&
other.recordId == this.recordId &&
other.action == this.action &&
other.userId == this.userId &&
other.oldData == this.oldData &&
other.newData == this.newData &&
other.ipAddress == this.ipAddress &&
other.userAgent == this.userAgent &&
other.createdAt == this.createdAt);
}
class AuditLogsCompanion extends UpdateCompanion<AuditLog> {
final Value<String> id;
final Value<String> table;
final Value<String> recordId;
final Value<String> action;
final Value<String?> userId;
final Value<String?> oldData;
final Value<String?> newData;
final Value<String?> ipAddress;
final Value<String?> userAgent;
final Value<PgDateTime> createdAt;
final Value<int> rowid;
const AuditLogsCompanion({
this.id = const Value.absent(),
this.table = const Value.absent(),
this.recordId = const Value.absent(),
this.action = const Value.absent(),
this.userId = const Value.absent(),
this.oldData = const Value.absent(),
this.newData = const Value.absent(),
this.ipAddress = const Value.absent(),
this.userAgent = const Value.absent(),
this.createdAt = const Value.absent(),
this.rowid = const Value.absent(),
});
AuditLogsCompanion.insert({
this.id = const Value.absent(),
required String table,
required String recordId,
required String action,
this.userId = const Value.absent(),
this.oldData = const Value.absent(),
this.newData = const Value.absent(),
this.ipAddress = const Value.absent(),
this.userAgent = const Value.absent(),
this.createdAt = const Value.absent(),
this.rowid = const Value.absent(),
}) : table = Value(table),
recordId = Value(recordId),
action = Value(action);
static Insertable<AuditLog> custom({
Expression<String>? id,
Expression<String>? table,
Expression<String>? recordId,
Expression<String>? action,
Expression<String>? userId,
Expression<String>? oldData,
Expression<String>? newData,
Expression<String>? ipAddress,
Expression<String>? userAgent,
Expression<PgDateTime>? createdAt,
Expression<int>? rowid,
}) {
return RawValuesInsertable({
if (id != null) 'id': id,
if (table != null) 'table': table,
if (recordId != null) 'record_id': recordId,
if (action != null) 'action': action,
if (userId != null) 'user_id': userId,
if (oldData != null) 'old_data': oldData,
if (newData != null) 'new_data': newData,
if (ipAddress != null) 'ip_address': ipAddress,
if (userAgent != null) 'user_agent': userAgent,
if (createdAt != null) 'created_at': createdAt,
if (rowid != null) 'rowid': rowid,
});
}
AuditLogsCompanion copyWith({
Value<String>? id,
Value<String>? table,
Value<String>? recordId,
Value<String>? action,
Value<String?>? userId,
Value<String?>? oldData,
Value<String?>? newData,
Value<String?>? ipAddress,
Value<String?>? userAgent,
Value<PgDateTime>? createdAt,
Value<int>? rowid,
}) {
return AuditLogsCompanion(
id: id ?? this.id,
table: table ?? this.table,
recordId: recordId ?? this.recordId,
action: action ?? this.action,
userId: userId ?? this.userId,
oldData: oldData ?? this.oldData,
newData: newData ?? this.newData,
ipAddress: ipAddress ?? this.ipAddress,
userAgent: userAgent ?? this.userAgent,
createdAt: createdAt ?? this.createdAt,
rowid: rowid ?? this.rowid,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (id.present) {
map['id'] = Variable<String>(id.value);
}
if (table.present) {
map['table'] = Variable<String>(table.value);
}
if (recordId.present) {
map['record_id'] = Variable<String>(recordId.value);
}
if (action.present) {
map['action'] = Variable<String>(action.value);
}
if (userId.present) {
map['user_id'] = Variable<String>(userId.value);
}
if (oldData.present) {
map['old_data'] = Variable<String>(oldData.value);
}
if (newData.present) {
map['new_data'] = Variable<String>(newData.value);
}
if (ipAddress.present) {
map['ip_address'] = Variable<String>(ipAddress.value);
}
if (userAgent.present) {
map['user_agent'] = Variable<String>(userAgent.value);
}
if (createdAt.present) {
map['created_at'] = Variable<PgDateTime>(
createdAt.value,
PgTypes.timestampWithTimezone,
);
}
if (rowid.present) {
map['rowid'] = Variable<int>(rowid.value);
}
return map;
}
@override
String toString() {
return (StringBuffer('AuditLogsCompanion(')
..write('id: $id, ')
..write('table: $table, ')
..write('recordId: $recordId, ')
..write('action: $action, ')
..write('userId: $userId, ')
..write('oldData: $oldData, ')
..write('newData: $newData, ')
..write('ipAddress: $ipAddress, ')
..write('userAgent: $userAgent, ')
..write('createdAt: $createdAt, ')
..write('rowid: $rowid')
..write(')'))
.toString();
}
}
abstract class _$AppDatabase extends GeneratedDatabase {
_$AppDatabase(QueryExecutor e) : super(e);
$AppDatabaseManager get managers => $AppDatabaseManager(this);
late final $UsersTable users = $UsersTable(this);
late final $UserDatasTable userDatas = $UserDatasTable(this);
late final $TokensTable tokens = $TokensTable(this);
late final $RefreshTokensTable refreshTokens = $RefreshTokensTable(this);
late final $TelegramAuthCodesTable telegramAuthCodes =
$TelegramAuthCodesTable(this);
late final $CardPacksTable cardPacks = $CardPacksTable(this);
late final $GameCardsTable gameCards = $GameCardsTable(this);
late final $VoiceModelsTable voiceModels = $VoiceModelsTable(this);
late final $UserPacksTable userPacks = $UserPacksTable(this);
late final $PreviewCardsTable previewCards = $PreviewCardsTable(this);
late final $CardPackCardsTable cardPackCards = $CardPackCardsTable(this);
late final $CardVoicesTable cardVoices = $CardVoicesTable(this);
late final $SubscriptionPlansTable subscriptionPlans =
$SubscriptionPlansTable(this);
late final $UserSubscriptionsTable userSubscriptions =
$UserSubscriptionsTable(this);
late final $PaymentsTable payments = $PaymentsTable(this);
late final $TestsTable tests = $TestsTable(this);
late final $TestQuestionsTable testQuestions = $TestQuestionsTable(this);
late final $TestPackRelationsTable testPackRelations =
$TestPackRelationsTable(this);
late final $TestStatisticsTable testStatistics = $TestStatisticsTable(this);
late final $TasksTable tasks = $TasksTable(this);
late final $UserTasksTable userTasks = $UserTasksTable(this);
late final $UserTaskProgressesTable userTaskProgresses =
$UserTaskProgressesTable(this);
late final $UserTaskResultsTable userTaskResults = $UserTaskResultsTable(
this,
);
late final $PromoCodesCampaignsTable promoCodesCampaigns =
$PromoCodesCampaignsTable(this);
late final $PromoCodesTable promoCodes = $PromoCodesTable(this);
late final $DiscountCampaignsTable discountCampaigns =
$DiscountCampaignsTable(this);
late final $DiscountsTable discounts = $DiscountsTable(this);
late final $DiscountUserDatasTable discountUserDatas =
$DiscountUserDatasTable(this);
late final $StudySessionsTable studySessions = $StudySessionsTable(this);
late final $WordStatisticsTable wordStatistics = $WordStatisticsTable(this);
late final $UserAchievementsTable userAchievements = $UserAchievementsTable(
this,
);
late final $ShareRequestsTable shareRequests = $ShareRequestsTable(this);
late final $AuditLogsTable auditLogs = $AuditLogsTable(this);
late final UserDao userDao = UserDao(this as AppDatabase);
late final PackDao packDao = PackDao(this as AppDatabase);
late final TestDao testDao = TestDao(this as AppDatabase);
late final PaymentDao paymentDao = PaymentDao(this as AppDatabase);
late final SubscriptionDao subscriptionDao = SubscriptionDao(
this as AppDatabase,
);
late final TaskDao taskDao = TaskDao(this as AppDatabase);
late final PromoCodeDao promoCodeDao = PromoCodeDao(this as AppDatabase);
late final DiscountDao discountDao = DiscountDao(this as AppDatabase);
late final StatisticsDao statisticsDao = StatisticsDao(this as AppDatabase);
late final AchievementDao achievementDao = AchievementDao(
this as AppDatabase,
);
late final WordStatisticsDao wordStatisticsDao = WordStatisticsDao(
this as AppDatabase,
);
late final AuditDao auditDao = AuditDao(this as AppDatabase);
@override
Iterable<TableInfo<Table, Object?>> get allTables =>
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
@override
List<DatabaseSchemaEntity> get allSchemaEntities => [
users,
userDatas,
tokens,
refreshTokens,
telegramAuthCodes,
cardPacks,
gameCards,
voiceModels,
userPacks,
previewCards,
cardPackCards,
cardVoices,
subscriptionPlans,
userSubscriptions,
payments,
tests,
testQuestions,
testPackRelations,
testStatistics,
tasks,
userTasks,
userTaskProgresses,
userTaskResults,
promoCodesCampaigns,
promoCodes,
discountCampaigns,
discounts,
discountUserDatas,
studySessions,
wordStatistics,
userAchievements,
shareRequests,
auditLogs,
];
@override
StreamQueryUpdateRules get streamUpdateRules => const StreamQueryUpdateRules([
WritePropagation(
on: TableUpdateQuery.onTableName(
'users',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('user_datas', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'users',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('tokens', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'users',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('refresh_tokens', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'game_cards',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('voice_models', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'users',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('user_packs', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'card_packs',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('user_packs', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'card_packs',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('preview_cards', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'game_cards',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('preview_cards', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'card_packs',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('card_pack_cards', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'game_cards',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('card_pack_cards', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'game_cards',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('card_voices', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'voice_models',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('card_voices', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'users',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('user_subscriptions', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'users',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('payments', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'tests',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('test_questions', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'tests',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('test_pack_relations', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'card_packs',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('test_pack_relations', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'tests',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('test_statistics', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'users',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('user_task_progresses', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'users',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('user_task_results', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'promo_codes_campaigns',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('promo_codes', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'users',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('promo_codes', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'discount_campaigns',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('discounts', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'discounts',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('discount_user_datas', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'users',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('discount_user_datas', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'users',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('study_sessions', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'users',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('word_statistics', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'game_cards',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('word_statistics', kind: UpdateKind.delete)],
),
WritePropagation(
on: TableUpdateQuery.onTableName(
'users',
limitUpdateKind: UpdateKind.delete,
),
result: [TableUpdate('user_achievements', kind: UpdateKind.delete)],
),
]);
}
typedef $$UsersTableCreateCompanionBuilder =
UsersCompanion Function({
Value<String> id,
required String externalUserId,
Value<String?> name,
Value<String?> email,
Value<bool> admin,
Value<String?> userSettings,
Value<List<String>> purchases,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<int> rowid,
});
typedef $$UsersTableUpdateCompanionBuilder =
UsersCompanion Function({
Value<String> id,
Value<String> externalUserId,
Value<String?> name,
Value<String?> email,
Value<bool> admin,
Value<String?> userSettings,
Value<List<String>> purchases,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<int> rowid,
});
final class $$UsersTableReferences
extends BaseReferences<_$AppDatabase, $UsersTable, User> {
$$UsersTableReferences(super.$_db, super.$_table, super.$_typedResult);
static MultiTypedResultKey<$UserDatasTable, List<UserData>>
_userDatasRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.userDatas,
aliasName: $_aliasNameGenerator(db.users.id, db.userDatas.userId),
);
$$UserDatasTableProcessedTableManager get userDatasRefs {
final manager = $$UserDatasTableTableManager(
$_db,
$_db.userDatas,
).filter((f) => f.userId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_userDatasRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$TokensTable, List<Token>> _tokensRefsTable(
_$AppDatabase db,
) => MultiTypedResultKey.fromTable(
db.tokens,
aliasName: $_aliasNameGenerator(db.users.id, db.tokens.userId),
);
$$TokensTableProcessedTableManager get tokensRefs {
final manager = $$TokensTableTableManager(
$_db,
$_db.tokens,
).filter((f) => f.userId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_tokensRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$RefreshTokensTable, List<RefreshToken>>
_refreshTokensRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.refreshTokens,
aliasName: $_aliasNameGenerator(db.users.id, db.refreshTokens.userId),
);
$$RefreshTokensTableProcessedTableManager get refreshTokensRefs {
final manager = $$RefreshTokensTableTableManager(
$_db,
$_db.refreshTokens,
).filter((f) => f.userId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_refreshTokensRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$UserPacksTable, List<UserPack>>
_userPacksRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.userPacks,
aliasName: $_aliasNameGenerator(db.users.id, db.userPacks.userId),
);
$$UserPacksTableProcessedTableManager get userPacksRefs {
final manager = $$UserPacksTableTableManager(
$_db,
$_db.userPacks,
).filter((f) => f.userId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_userPacksRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$UserSubscriptionsTable, List<UserSubscription>>
_userSubscriptionsRefsTable(_$AppDatabase db) =>
MultiTypedResultKey.fromTable(
db.userSubscriptions,
aliasName: $_aliasNameGenerator(
db.users.id,
db.userSubscriptions.userId,
),
);
$$UserSubscriptionsTableProcessedTableManager get userSubscriptionsRefs {
final manager = $$UserSubscriptionsTableTableManager(
$_db,
$_db.userSubscriptions,
).filter((f) => f.userId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(
_userSubscriptionsRefsTable($_db),
);
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$PaymentsTable, List<Payment>> _paymentsRefsTable(
_$AppDatabase db,
) => MultiTypedResultKey.fromTable(
db.payments,
aliasName: $_aliasNameGenerator(db.users.id, db.payments.userId),
);
$$PaymentsTableProcessedTableManager get paymentsRefs {
final manager = $$PaymentsTableTableManager(
$_db,
$_db.payments,
).filter((f) => f.userId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_paymentsRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<
$UserTaskProgressesTable,
List<UserTaskProgressesData>
>
_userTaskProgressesRefsTable(_$AppDatabase db) =>
MultiTypedResultKey.fromTable(
db.userTaskProgresses,
aliasName: $_aliasNameGenerator(
db.users.id,
db.userTaskProgresses.userId,
),
);
$$UserTaskProgressesTableProcessedTableManager get userTaskProgressesRefs {
final manager = $$UserTaskProgressesTableTableManager(
$_db,
$_db.userTaskProgresses,
).filter((f) => f.userId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(
_userTaskProgressesRefsTable($_db),
);
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$UserTaskResultsTable, List<UserTaskResult>>
_userTaskResultsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.userTaskResults,
aliasName: $_aliasNameGenerator(db.users.id, db.userTaskResults.userId),
);
$$UserTaskResultsTableProcessedTableManager get userTaskResultsRefs {
final manager = $$UserTaskResultsTableTableManager(
$_db,
$_db.userTaskResults,
).filter((f) => f.userId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(
_userTaskResultsRefsTable($_db),
);
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$PromoCodesTable, List<PromoCode>>
_promoCodesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.promoCodes,
aliasName: $_aliasNameGenerator(db.users.id, db.promoCodes.userId),
);
$$PromoCodesTableProcessedTableManager get promoCodesRefs {
final manager = $$PromoCodesTableTableManager(
$_db,
$_db.promoCodes,
).filter((f) => f.userId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_promoCodesRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$DiscountUserDatasTable, List<DiscountUserData>>
_discountUserDatasRefsTable(_$AppDatabase db) =>
MultiTypedResultKey.fromTable(
db.discountUserDatas,
aliasName: $_aliasNameGenerator(
db.users.id,
db.discountUserDatas.userId,
),
);
$$DiscountUserDatasTableProcessedTableManager get discountUserDatasRefs {
final manager = $$DiscountUserDatasTableTableManager(
$_db,
$_db.discountUserDatas,
).filter((f) => f.userId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(
_discountUserDatasRefsTable($_db),
);
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$StudySessionsTable, List<StudySession>>
_studySessionsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.studySessions,
aliasName: $_aliasNameGenerator(db.users.id, db.studySessions.userId),
);
$$StudySessionsTableProcessedTableManager get studySessionsRefs {
final manager = $$StudySessionsTableTableManager(
$_db,
$_db.studySessions,
).filter((f) => f.userId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_studySessionsRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$WordStatisticsTable, List<WordStatistic>>
_wordStatisticsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.wordStatistics,
aliasName: $_aliasNameGenerator(db.users.id, db.wordStatistics.userId),
);
$$WordStatisticsTableProcessedTableManager get wordStatisticsRefs {
final manager = $$WordStatisticsTableTableManager(
$_db,
$_db.wordStatistics,
).filter((f) => f.userId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_wordStatisticsRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$UserAchievementsTable, List<UserAchievement>>
_userAchievementsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.userAchievements,
aliasName: $_aliasNameGenerator(db.users.id, db.userAchievements.userId),
);
$$UserAchievementsTableProcessedTableManager get userAchievementsRefs {
final manager = $$UserAchievementsTableTableManager(
$_db,
$_db.userAchievements,
).filter((f) => f.userId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(
_userAchievementsRefsTable($_db),
);
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
}
class $$UsersTableFilterComposer extends Composer<_$AppDatabase, $UsersTable> {
$$UsersTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get externalUserId => $composableBuilder(
column: $table.externalUserId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get name => $composableBuilder(
column: $table.name,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get email => $composableBuilder(
column: $table.email,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get admin => $composableBuilder(
column: $table.admin,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get userSettings => $composableBuilder(
column: $table.userSettings,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<List<String>, List<String>, String>
get purchases => $composableBuilder(
column: $table.purchases,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
Expression<bool> userDatasRefs(
Expression<bool> Function($$UserDatasTableFilterComposer f) f,
) {
final $$UserDatasTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userDatas,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserDatasTableFilterComposer(
$db: $db,
$table: $db.userDatas,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> tokensRefs(
Expression<bool> Function($$TokensTableFilterComposer f) f,
) {
final $$TokensTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.tokens,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TokensTableFilterComposer(
$db: $db,
$table: $db.tokens,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> refreshTokensRefs(
Expression<bool> Function($$RefreshTokensTableFilterComposer f) f,
) {
final $$RefreshTokensTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.refreshTokens,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$RefreshTokensTableFilterComposer(
$db: $db,
$table: $db.refreshTokens,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> userPacksRefs(
Expression<bool> Function($$UserPacksTableFilterComposer f) f,
) {
final $$UserPacksTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userPacks,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserPacksTableFilterComposer(
$db: $db,
$table: $db.userPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> userSubscriptionsRefs(
Expression<bool> Function($$UserSubscriptionsTableFilterComposer f) f,
) {
final $$UserSubscriptionsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userSubscriptions,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserSubscriptionsTableFilterComposer(
$db: $db,
$table: $db.userSubscriptions,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> paymentsRefs(
Expression<bool> Function($$PaymentsTableFilterComposer f) f,
) {
final $$PaymentsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.payments,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$PaymentsTableFilterComposer(
$db: $db,
$table: $db.payments,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> userTaskProgressesRefs(
Expression<bool> Function($$UserTaskProgressesTableFilterComposer f) f,
) {
final $$UserTaskProgressesTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userTaskProgresses,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserTaskProgressesTableFilterComposer(
$db: $db,
$table: $db.userTaskProgresses,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> userTaskResultsRefs(
Expression<bool> Function($$UserTaskResultsTableFilterComposer f) f,
) {
final $$UserTaskResultsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userTaskResults,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserTaskResultsTableFilterComposer(
$db: $db,
$table: $db.userTaskResults,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> promoCodesRefs(
Expression<bool> Function($$PromoCodesTableFilterComposer f) f,
) {
final $$PromoCodesTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.promoCodes,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$PromoCodesTableFilterComposer(
$db: $db,
$table: $db.promoCodes,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> discountUserDatasRefs(
Expression<bool> Function($$DiscountUserDatasTableFilterComposer f) f,
) {
final $$DiscountUserDatasTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.discountUserDatas,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$DiscountUserDatasTableFilterComposer(
$db: $db,
$table: $db.discountUserDatas,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> studySessionsRefs(
Expression<bool> Function($$StudySessionsTableFilterComposer f) f,
) {
final $$StudySessionsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.studySessions,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$StudySessionsTableFilterComposer(
$db: $db,
$table: $db.studySessions,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> wordStatisticsRefs(
Expression<bool> Function($$WordStatisticsTableFilterComposer f) f,
) {
final $$WordStatisticsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.wordStatistics,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$WordStatisticsTableFilterComposer(
$db: $db,
$table: $db.wordStatistics,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> userAchievementsRefs(
Expression<bool> Function($$UserAchievementsTableFilterComposer f) f,
) {
final $$UserAchievementsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userAchievements,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserAchievementsTableFilterComposer(
$db: $db,
$table: $db.userAchievements,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$UsersTableOrderingComposer
extends Composer<_$AppDatabase, $UsersTable> {
$$UsersTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get externalUserId => $composableBuilder(
column: $table.externalUserId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get name => $composableBuilder(
column: $table.name,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get email => $composableBuilder(
column: $table.email,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get admin => $composableBuilder(
column: $table.admin,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get userSettings => $composableBuilder(
column: $table.userSettings,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get purchases => $composableBuilder(
column: $table.purchases,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
}
class $$UsersTableAnnotationComposer
extends Composer<_$AppDatabase, $UsersTable> {
$$UsersTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get externalUserId => $composableBuilder(
column: $table.externalUserId,
builder: (column) => column,
);
GeneratedColumn<String> get name =>
$composableBuilder(column: $table.name, builder: (column) => column);
GeneratedColumn<String> get email =>
$composableBuilder(column: $table.email, builder: (column) => column);
GeneratedColumn<bool> get admin =>
$composableBuilder(column: $table.admin, builder: (column) => column);
GeneratedColumn<String> get userSettings => $composableBuilder(
column: $table.userSettings,
builder: (column) => column,
);
GeneratedColumnWithTypeConverter<List<String>, String> get purchases =>
$composableBuilder(column: $table.purchases, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
Expression<T> userDatasRefs<T extends Object>(
Expression<T> Function($$UserDatasTableAnnotationComposer a) f,
) {
final $$UserDatasTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userDatas,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserDatasTableAnnotationComposer(
$db: $db,
$table: $db.userDatas,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> tokensRefs<T extends Object>(
Expression<T> Function($$TokensTableAnnotationComposer a) f,
) {
final $$TokensTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.tokens,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TokensTableAnnotationComposer(
$db: $db,
$table: $db.tokens,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> refreshTokensRefs<T extends Object>(
Expression<T> Function($$RefreshTokensTableAnnotationComposer a) f,
) {
final $$RefreshTokensTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.refreshTokens,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$RefreshTokensTableAnnotationComposer(
$db: $db,
$table: $db.refreshTokens,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> userPacksRefs<T extends Object>(
Expression<T> Function($$UserPacksTableAnnotationComposer a) f,
) {
final $$UserPacksTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userPacks,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserPacksTableAnnotationComposer(
$db: $db,
$table: $db.userPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> userSubscriptionsRefs<T extends Object>(
Expression<T> Function($$UserSubscriptionsTableAnnotationComposer a) f,
) {
final $$UserSubscriptionsTableAnnotationComposer composer =
$composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userSubscriptions,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserSubscriptionsTableAnnotationComposer(
$db: $db,
$table: $db.userSubscriptions,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> paymentsRefs<T extends Object>(
Expression<T> Function($$PaymentsTableAnnotationComposer a) f,
) {
final $$PaymentsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.payments,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$PaymentsTableAnnotationComposer(
$db: $db,
$table: $db.payments,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> userTaskProgressesRefs<T extends Object>(
Expression<T> Function($$UserTaskProgressesTableAnnotationComposer a) f,
) {
final $$UserTaskProgressesTableAnnotationComposer composer =
$composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userTaskProgresses,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserTaskProgressesTableAnnotationComposer(
$db: $db,
$table: $db.userTaskProgresses,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> userTaskResultsRefs<T extends Object>(
Expression<T> Function($$UserTaskResultsTableAnnotationComposer a) f,
) {
final $$UserTaskResultsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userTaskResults,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserTaskResultsTableAnnotationComposer(
$db: $db,
$table: $db.userTaskResults,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> promoCodesRefs<T extends Object>(
Expression<T> Function($$PromoCodesTableAnnotationComposer a) f,
) {
final $$PromoCodesTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.promoCodes,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$PromoCodesTableAnnotationComposer(
$db: $db,
$table: $db.promoCodes,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> discountUserDatasRefs<T extends Object>(
Expression<T> Function($$DiscountUserDatasTableAnnotationComposer a) f,
) {
final $$DiscountUserDatasTableAnnotationComposer composer =
$composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.discountUserDatas,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$DiscountUserDatasTableAnnotationComposer(
$db: $db,
$table: $db.discountUserDatas,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> studySessionsRefs<T extends Object>(
Expression<T> Function($$StudySessionsTableAnnotationComposer a) f,
) {
final $$StudySessionsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.studySessions,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$StudySessionsTableAnnotationComposer(
$db: $db,
$table: $db.studySessions,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> wordStatisticsRefs<T extends Object>(
Expression<T> Function($$WordStatisticsTableAnnotationComposer a) f,
) {
final $$WordStatisticsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.wordStatistics,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$WordStatisticsTableAnnotationComposer(
$db: $db,
$table: $db.wordStatistics,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> userAchievementsRefs<T extends Object>(
Expression<T> Function($$UserAchievementsTableAnnotationComposer a) f,
) {
final $$UserAchievementsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userAchievements,
getReferencedColumn: (t) => t.userId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserAchievementsTableAnnotationComposer(
$db: $db,
$table: $db.userAchievements,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$UsersTableTableManager
extends
RootTableManager<
_$AppDatabase,
$UsersTable,
User,
$$UsersTableFilterComposer,
$$UsersTableOrderingComposer,
$$UsersTableAnnotationComposer,
$$UsersTableCreateCompanionBuilder,
$$UsersTableUpdateCompanionBuilder,
(User, $$UsersTableReferences),
User,
PrefetchHooks Function({
bool userDatasRefs,
bool tokensRefs,
bool refreshTokensRefs,
bool userPacksRefs,
bool userSubscriptionsRefs,
bool paymentsRefs,
bool userTaskProgressesRefs,
bool userTaskResultsRefs,
bool promoCodesRefs,
bool discountUserDatasRefs,
bool studySessionsRefs,
bool wordStatisticsRefs,
bool userAchievementsRefs,
})
> {
$$UsersTableTableManager(_$AppDatabase db, $UsersTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$UsersTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$UsersTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$UsersTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> externalUserId = const Value.absent(),
Value<String?> name = const Value.absent(),
Value<String?> email = const Value.absent(),
Value<bool> admin = const Value.absent(),
Value<String?> userSettings = const Value.absent(),
Value<List<String>> purchases = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UsersCompanion(
id: id,
externalUserId: externalUserId,
name: name,
email: email,
admin: admin,
userSettings: userSettings,
purchases: purchases,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String externalUserId,
Value<String?> name = const Value.absent(),
Value<String?> email = const Value.absent(),
Value<bool> admin = const Value.absent(),
Value<String?> userSettings = const Value.absent(),
Value<List<String>> purchases = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UsersCompanion.insert(
id: id,
externalUserId: externalUserId,
name: name,
email: email,
admin: admin,
userSettings: userSettings,
purchases: purchases,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) =>
(e.readTable(table), $$UsersTableReferences(db, table, e)),
)
.toList(),
prefetchHooksCallback:
({
userDatasRefs = false,
tokensRefs = false,
refreshTokensRefs = false,
userPacksRefs = false,
userSubscriptionsRefs = false,
paymentsRefs = false,
userTaskProgressesRefs = false,
userTaskResultsRefs = false,
promoCodesRefs = false,
discountUserDatasRefs = false,
studySessionsRefs = false,
wordStatisticsRefs = false,
userAchievementsRefs = false,
}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [
if (userDatasRefs) db.userDatas,
if (tokensRefs) db.tokens,
if (refreshTokensRefs) db.refreshTokens,
if (userPacksRefs) db.userPacks,
if (userSubscriptionsRefs) db.userSubscriptions,
if (paymentsRefs) db.payments,
if (userTaskProgressesRefs) db.userTaskProgresses,
if (userTaskResultsRefs) db.userTaskResults,
if (promoCodesRefs) db.promoCodes,
if (discountUserDatasRefs) db.discountUserDatas,
if (studySessionsRefs) db.studySessions,
if (wordStatisticsRefs) db.wordStatistics,
if (userAchievementsRefs) db.userAchievements,
],
addJoins: null,
getPrefetchedDataCallback: (items) async {
return [
if (userDatasRefs)
await $_getPrefetchedData<User, $UsersTable, UserData>(
currentTable: table,
referencedTable: $$UsersTableReferences
._userDatasRefsTable(db),
managerFromTypedResult: (p0) =>
$$UsersTableReferences(
db,
table,
p0,
).userDatasRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.userId == item.id,
),
typedResults: items,
),
if (tokensRefs)
await $_getPrefetchedData<User, $UsersTable, Token>(
currentTable: table,
referencedTable: $$UsersTableReferences
._tokensRefsTable(db),
managerFromTypedResult: (p0) =>
$$UsersTableReferences(db, table, p0).tokensRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.userId == item.id,
),
typedResults: items,
),
if (refreshTokensRefs)
await $_getPrefetchedData<
User,
$UsersTable,
RefreshToken
>(
currentTable: table,
referencedTable: $$UsersTableReferences
._refreshTokensRefsTable(db),
managerFromTypedResult: (p0) =>
$$UsersTableReferences(
db,
table,
p0,
).refreshTokensRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.userId == item.id,
),
typedResults: items,
),
if (userPacksRefs)
await $_getPrefetchedData<User, $UsersTable, UserPack>(
currentTable: table,
referencedTable: $$UsersTableReferences
._userPacksRefsTable(db),
managerFromTypedResult: (p0) =>
$$UsersTableReferences(
db,
table,
p0,
).userPacksRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.userId == item.id,
),
typedResults: items,
),
if (userSubscriptionsRefs)
await $_getPrefetchedData<
User,
$UsersTable,
UserSubscription
>(
currentTable: table,
referencedTable: $$UsersTableReferences
._userSubscriptionsRefsTable(db),
managerFromTypedResult: (p0) =>
$$UsersTableReferences(
db,
table,
p0,
).userSubscriptionsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.userId == item.id,
),
typedResults: items,
),
if (paymentsRefs)
await $_getPrefetchedData<User, $UsersTable, Payment>(
currentTable: table,
referencedTable: $$UsersTableReferences
._paymentsRefsTable(db),
managerFromTypedResult: (p0) =>
$$UsersTableReferences(
db,
table,
p0,
).paymentsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.userId == item.id,
),
typedResults: items,
),
if (userTaskProgressesRefs)
await $_getPrefetchedData<
User,
$UsersTable,
UserTaskProgressesData
>(
currentTable: table,
referencedTable: $$UsersTableReferences
._userTaskProgressesRefsTable(db),
managerFromTypedResult: (p0) =>
$$UsersTableReferences(
db,
table,
p0,
).userTaskProgressesRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.userId == item.id,
),
typedResults: items,
),
if (userTaskResultsRefs)
await $_getPrefetchedData<
User,
$UsersTable,
UserTaskResult
>(
currentTable: table,
referencedTable: $$UsersTableReferences
._userTaskResultsRefsTable(db),
managerFromTypedResult: (p0) =>
$$UsersTableReferences(
db,
table,
p0,
).userTaskResultsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.userId == item.id,
),
typedResults: items,
),
if (promoCodesRefs)
await $_getPrefetchedData<User, $UsersTable, PromoCode>(
currentTable: table,
referencedTable: $$UsersTableReferences
._promoCodesRefsTable(db),
managerFromTypedResult: (p0) =>
$$UsersTableReferences(
db,
table,
p0,
).promoCodesRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.userId == item.id,
),
typedResults: items,
),
if (discountUserDatasRefs)
await $_getPrefetchedData<
User,
$UsersTable,
DiscountUserData
>(
currentTable: table,
referencedTable: $$UsersTableReferences
._discountUserDatasRefsTable(db),
managerFromTypedResult: (p0) =>
$$UsersTableReferences(
db,
table,
p0,
).discountUserDatasRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.userId == item.id,
),
typedResults: items,
),
if (studySessionsRefs)
await $_getPrefetchedData<
User,
$UsersTable,
StudySession
>(
currentTable: table,
referencedTable: $$UsersTableReferences
._studySessionsRefsTable(db),
managerFromTypedResult: (p0) =>
$$UsersTableReferences(
db,
table,
p0,
).studySessionsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.userId == item.id,
),
typedResults: items,
),
if (wordStatisticsRefs)
await $_getPrefetchedData<
User,
$UsersTable,
WordStatistic
>(
currentTable: table,
referencedTable: $$UsersTableReferences
._wordStatisticsRefsTable(db),
managerFromTypedResult: (p0) =>
$$UsersTableReferences(
db,
table,
p0,
).wordStatisticsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.userId == item.id,
),
typedResults: items,
),
if (userAchievementsRefs)
await $_getPrefetchedData<
User,
$UsersTable,
UserAchievement
>(
currentTable: table,
referencedTable: $$UsersTableReferences
._userAchievementsRefsTable(db),
managerFromTypedResult: (p0) =>
$$UsersTableReferences(
db,
table,
p0,
).userAchievementsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.userId == item.id,
),
typedResults: items,
),
];
},
);
},
),
);
}
typedef $$UsersTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$UsersTable,
User,
$$UsersTableFilterComposer,
$$UsersTableOrderingComposer,
$$UsersTableAnnotationComposer,
$$UsersTableCreateCompanionBuilder,
$$UsersTableUpdateCompanionBuilder,
(User, $$UsersTableReferences),
User,
PrefetchHooks Function({
bool userDatasRefs,
bool tokensRefs,
bool refreshTokensRefs,
bool userPacksRefs,
bool userSubscriptionsRefs,
bool paymentsRefs,
bool userTaskProgressesRefs,
bool userTaskResultsRefs,
bool promoCodesRefs,
bool discountUserDatasRefs,
bool studySessionsRefs,
bool wordStatisticsRefs,
bool userAchievementsRefs,
})
>;
typedef $$UserDatasTableCreateCompanionBuilder =
UserDatasCompanion Function({
Value<String> id,
required String userId,
Value<int> totalStudyTimeMinutes,
Value<int> currentStreak,
Value<int> longestStreak,
Value<int> totalCards,
Value<int> totalTests,
Value<PgDateTime?> lastTimeOnline,
Value<PgDateTime> registrationDate,
Value<String?> lastTestSessionToken,
Value<List<String>> tags,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
typedef $$UserDatasTableUpdateCompanionBuilder =
UserDatasCompanion Function({
Value<String> id,
Value<String> userId,
Value<int> totalStudyTimeMinutes,
Value<int> currentStreak,
Value<int> longestStreak,
Value<int> totalCards,
Value<int> totalTests,
Value<PgDateTime?> lastTimeOnline,
Value<PgDateTime> registrationDate,
Value<String?> lastTestSessionToken,
Value<List<String>> tags,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
final class $$UserDatasTableReferences
extends BaseReferences<_$AppDatabase, $UserDatasTable, UserData> {
$$UserDatasTableReferences(super.$_db, super.$_table, super.$_typedResult);
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
$_aliasNameGenerator(db.userDatas.userId, db.users.id),
);
$$UsersTableProcessedTableManager get userId {
final $_column = $_itemColumn<String>('user_id')!;
final manager = $$UsersTableTableManager(
$_db,
$_db.users,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$UserDatasTableFilterComposer
extends Composer<_$AppDatabase, $UserDatasTable> {
$$UserDatasTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get totalStudyTimeMinutes => $composableBuilder(
column: $table.totalStudyTimeMinutes,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get currentStreak => $composableBuilder(
column: $table.currentStreak,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get longestStreak => $composableBuilder(
column: $table.longestStreak,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get totalCards => $composableBuilder(
column: $table.totalCards,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get totalTests => $composableBuilder(
column: $table.totalTests,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get lastTimeOnline => $composableBuilder(
column: $table.lastTimeOnline,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get registrationDate => $composableBuilder(
column: $table.registrationDate,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get lastTestSessionToken => $composableBuilder(
column: $table.lastTestSessionToken,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<List<String>, List<String>, String> get tags =>
$composableBuilder(
column: $table.tags,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
$$UsersTableFilterComposer get userId {
final $$UsersTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableFilterComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserDatasTableOrderingComposer
extends Composer<_$AppDatabase, $UserDatasTable> {
$$UserDatasTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get totalStudyTimeMinutes => $composableBuilder(
column: $table.totalStudyTimeMinutes,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get currentStreak => $composableBuilder(
column: $table.currentStreak,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get longestStreak => $composableBuilder(
column: $table.longestStreak,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get totalCards => $composableBuilder(
column: $table.totalCards,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get totalTests => $composableBuilder(
column: $table.totalTests,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get lastTimeOnline => $composableBuilder(
column: $table.lastTimeOnline,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get registrationDate => $composableBuilder(
column: $table.registrationDate,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get lastTestSessionToken => $composableBuilder(
column: $table.lastTestSessionToken,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get tags => $composableBuilder(
column: $table.tags,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
$$UsersTableOrderingComposer get userId {
final $$UsersTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableOrderingComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserDatasTableAnnotationComposer
extends Composer<_$AppDatabase, $UserDatasTable> {
$$UserDatasTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<int> get totalStudyTimeMinutes => $composableBuilder(
column: $table.totalStudyTimeMinutes,
builder: (column) => column,
);
GeneratedColumn<int> get currentStreak => $composableBuilder(
column: $table.currentStreak,
builder: (column) => column,
);
GeneratedColumn<int> get longestStreak => $composableBuilder(
column: $table.longestStreak,
builder: (column) => column,
);
GeneratedColumn<int> get totalCards => $composableBuilder(
column: $table.totalCards,
builder: (column) => column,
);
GeneratedColumn<int> get totalTests => $composableBuilder(
column: $table.totalTests,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get lastTimeOnline => $composableBuilder(
column: $table.lastTimeOnline,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get registrationDate => $composableBuilder(
column: $table.registrationDate,
builder: (column) => column,
);
GeneratedColumn<String> get lastTestSessionToken => $composableBuilder(
column: $table.lastTestSessionToken,
builder: (column) => column,
);
GeneratedColumnWithTypeConverter<List<String>, String> get tags =>
$composableBuilder(column: $table.tags, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
$$UsersTableAnnotationComposer get userId {
final $$UsersTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableAnnotationComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserDatasTableTableManager
extends
RootTableManager<
_$AppDatabase,
$UserDatasTable,
UserData,
$$UserDatasTableFilterComposer,
$$UserDatasTableOrderingComposer,
$$UserDatasTableAnnotationComposer,
$$UserDatasTableCreateCompanionBuilder,
$$UserDatasTableUpdateCompanionBuilder,
(UserData, $$UserDatasTableReferences),
UserData,
PrefetchHooks Function({bool userId})
> {
$$UserDatasTableTableManager(_$AppDatabase db, $UserDatasTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$UserDatasTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$UserDatasTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$UserDatasTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> userId = const Value.absent(),
Value<int> totalStudyTimeMinutes = const Value.absent(),
Value<int> currentStreak = const Value.absent(),
Value<int> longestStreak = const Value.absent(),
Value<int> totalCards = const Value.absent(),
Value<int> totalTests = const Value.absent(),
Value<PgDateTime?> lastTimeOnline = const Value.absent(),
Value<PgDateTime> registrationDate = const Value.absent(),
Value<String?> lastTestSessionToken = const Value.absent(),
Value<List<String>> tags = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserDatasCompanion(
id: id,
userId: userId,
totalStudyTimeMinutes: totalStudyTimeMinutes,
currentStreak: currentStreak,
longestStreak: longestStreak,
totalCards: totalCards,
totalTests: totalTests,
lastTimeOnline: lastTimeOnline,
registrationDate: registrationDate,
lastTestSessionToken: lastTestSessionToken,
tags: tags,
createdAt: createdAt,
updatedAt: updatedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String userId,
Value<int> totalStudyTimeMinutes = const Value.absent(),
Value<int> currentStreak = const Value.absent(),
Value<int> longestStreak = const Value.absent(),
Value<int> totalCards = const Value.absent(),
Value<int> totalTests = const Value.absent(),
Value<PgDateTime?> lastTimeOnline = const Value.absent(),
Value<PgDateTime> registrationDate = const Value.absent(),
Value<String?> lastTestSessionToken = const Value.absent(),
Value<List<String>> tags = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserDatasCompanion.insert(
id: id,
userId: userId,
totalStudyTimeMinutes: totalStudyTimeMinutes,
currentStreak: currentStreak,
longestStreak: longestStreak,
totalCards: totalCards,
totalTests: totalTests,
lastTimeOnline: lastTimeOnline,
registrationDate: registrationDate,
lastTestSessionToken: lastTestSessionToken,
tags: tags,
createdAt: createdAt,
updatedAt: updatedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$UserDatasTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({userId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (userId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.userId,
referencedTable: $$UserDatasTableReferences
._userIdTable(db),
referencedColumn: $$UserDatasTableReferences
._userIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$UserDatasTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$UserDatasTable,
UserData,
$$UserDatasTableFilterComposer,
$$UserDatasTableOrderingComposer,
$$UserDatasTableAnnotationComposer,
$$UserDatasTableCreateCompanionBuilder,
$$UserDatasTableUpdateCompanionBuilder,
(UserData, $$UserDatasTableReferences),
UserData,
PrefetchHooks Function({bool userId})
>;
typedef $$TokensTableCreateCompanionBuilder =
TokensCompanion Function({
Value<String> id,
required String userId,
required String token,
required String externalUserId,
Value<PgDateTime> created,
required PgDateTime expires,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
typedef $$TokensTableUpdateCompanionBuilder =
TokensCompanion Function({
Value<String> id,
Value<String> userId,
Value<String> token,
Value<String> externalUserId,
Value<PgDateTime> created,
Value<PgDateTime> expires,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
final class $$TokensTableReferences
extends BaseReferences<_$AppDatabase, $TokensTable, Token> {
$$TokensTableReferences(super.$_db, super.$_table, super.$_typedResult);
static $UsersTable _userIdTable(_$AppDatabase db) =>
db.users.createAlias($_aliasNameGenerator(db.tokens.userId, db.users.id));
$$UsersTableProcessedTableManager get userId {
final $_column = $_itemColumn<String>('user_id')!;
final manager = $$UsersTableTableManager(
$_db,
$_db.users,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$TokensTableFilterComposer
extends Composer<_$AppDatabase, $TokensTable> {
$$TokensTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get token => $composableBuilder(
column: $table.token,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get externalUserId => $composableBuilder(
column: $table.externalUserId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get created => $composableBuilder(
column: $table.created,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get expires => $composableBuilder(
column: $table.expires,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnFilters(column),
);
$$UsersTableFilterComposer get userId {
final $$UsersTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableFilterComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$TokensTableOrderingComposer
extends Composer<_$AppDatabase, $TokensTable> {
$$TokensTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get token => $composableBuilder(
column: $table.token,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get externalUserId => $composableBuilder(
column: $table.externalUserId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get created => $composableBuilder(
column: $table.created,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get expires => $composableBuilder(
column: $table.expires,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnOrderings(column),
);
$$UsersTableOrderingComposer get userId {
final $$UsersTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableOrderingComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$TokensTableAnnotationComposer
extends Composer<_$AppDatabase, $TokensTable> {
$$TokensTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get token =>
$composableBuilder(column: $table.token, builder: (column) => column);
GeneratedColumn<String> get externalUserId => $composableBuilder(
column: $table.externalUserId,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get created =>
$composableBuilder(column: $table.created, builder: (column) => column);
GeneratedColumn<PgDateTime> get expires =>
$composableBuilder(column: $table.expires, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
GeneratedColumn<PgDateTime> get deletedAt =>
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
$$UsersTableAnnotationComposer get userId {
final $$UsersTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableAnnotationComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$TokensTableTableManager
extends
RootTableManager<
_$AppDatabase,
$TokensTable,
Token,
$$TokensTableFilterComposer,
$$TokensTableOrderingComposer,
$$TokensTableAnnotationComposer,
$$TokensTableCreateCompanionBuilder,
$$TokensTableUpdateCompanionBuilder,
(Token, $$TokensTableReferences),
Token,
PrefetchHooks Function({bool userId})
> {
$$TokensTableTableManager(_$AppDatabase db, $TokensTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$TokensTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$TokensTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$TokensTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> userId = const Value.absent(),
Value<String> token = const Value.absent(),
Value<String> externalUserId = const Value.absent(),
Value<PgDateTime> created = const Value.absent(),
Value<PgDateTime> expires = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => TokensCompanion(
id: id,
userId: userId,
token: token,
externalUserId: externalUserId,
created: created,
expires: expires,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String userId,
required String token,
required String externalUserId,
Value<PgDateTime> created = const Value.absent(),
required PgDateTime expires,
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => TokensCompanion.insert(
id: id,
userId: userId,
token: token,
externalUserId: externalUserId,
created: created,
expires: expires,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) =>
(e.readTable(table), $$TokensTableReferences(db, table, e)),
)
.toList(),
prefetchHooksCallback: ({userId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (userId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.userId,
referencedTable: $$TokensTableReferences
._userIdTable(db),
referencedColumn: $$TokensTableReferences
._userIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$TokensTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$TokensTable,
Token,
$$TokensTableFilterComposer,
$$TokensTableOrderingComposer,
$$TokensTableAnnotationComposer,
$$TokensTableCreateCompanionBuilder,
$$TokensTableUpdateCompanionBuilder,
(Token, $$TokensTableReferences),
Token,
PrefetchHooks Function({bool userId})
>;
typedef $$RefreshTokensTableCreateCompanionBuilder =
RefreshTokensCompanion Function({
Value<String> id,
required String userId,
required String jti,
Value<bool> isBlacklisted,
Value<PgDateTime> createdAt,
required PgDateTime expiresAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
typedef $$RefreshTokensTableUpdateCompanionBuilder =
RefreshTokensCompanion Function({
Value<String> id,
Value<String> userId,
Value<String> jti,
Value<bool> isBlacklisted,
Value<PgDateTime> createdAt,
Value<PgDateTime> expiresAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
final class $$RefreshTokensTableReferences
extends BaseReferences<_$AppDatabase, $RefreshTokensTable, RefreshToken> {
$$RefreshTokensTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
$_aliasNameGenerator(db.refreshTokens.userId, db.users.id),
);
$$UsersTableProcessedTableManager get userId {
final $_column = $_itemColumn<String>('user_id')!;
final manager = $$UsersTableTableManager(
$_db,
$_db.users,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$RefreshTokensTableFilterComposer
extends Composer<_$AppDatabase, $RefreshTokensTable> {
$$RefreshTokensTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get jti => $composableBuilder(
column: $table.jti,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isBlacklisted => $composableBuilder(
column: $table.isBlacklisted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get expiresAt => $composableBuilder(
column: $table.expiresAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnFilters(column),
);
$$UsersTableFilterComposer get userId {
final $$UsersTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableFilterComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$RefreshTokensTableOrderingComposer
extends Composer<_$AppDatabase, $RefreshTokensTable> {
$$RefreshTokensTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get jti => $composableBuilder(
column: $table.jti,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isBlacklisted => $composableBuilder(
column: $table.isBlacklisted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get expiresAt => $composableBuilder(
column: $table.expiresAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnOrderings(column),
);
$$UsersTableOrderingComposer get userId {
final $$UsersTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableOrderingComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$RefreshTokensTableAnnotationComposer
extends Composer<_$AppDatabase, $RefreshTokensTable> {
$$RefreshTokensTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get jti =>
$composableBuilder(column: $table.jti, builder: (column) => column);
GeneratedColumn<bool> get isBlacklisted => $composableBuilder(
column: $table.isBlacklisted,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get expiresAt =>
$composableBuilder(column: $table.expiresAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
GeneratedColumn<PgDateTime> get deletedAt =>
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
$$UsersTableAnnotationComposer get userId {
final $$UsersTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableAnnotationComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$RefreshTokensTableTableManager
extends
RootTableManager<
_$AppDatabase,
$RefreshTokensTable,
RefreshToken,
$$RefreshTokensTableFilterComposer,
$$RefreshTokensTableOrderingComposer,
$$RefreshTokensTableAnnotationComposer,
$$RefreshTokensTableCreateCompanionBuilder,
$$RefreshTokensTableUpdateCompanionBuilder,
(RefreshToken, $$RefreshTokensTableReferences),
RefreshToken,
PrefetchHooks Function({bool userId})
> {
$$RefreshTokensTableTableManager(_$AppDatabase db, $RefreshTokensTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$RefreshTokensTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$RefreshTokensTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$RefreshTokensTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> userId = const Value.absent(),
Value<String> jti = const Value.absent(),
Value<bool> isBlacklisted = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> expiresAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => RefreshTokensCompanion(
id: id,
userId: userId,
jti: jti,
isBlacklisted: isBlacklisted,
createdAt: createdAt,
expiresAt: expiresAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String userId,
required String jti,
Value<bool> isBlacklisted = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
required PgDateTime expiresAt,
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => RefreshTokensCompanion.insert(
id: id,
userId: userId,
jti: jti,
isBlacklisted: isBlacklisted,
createdAt: createdAt,
expiresAt: expiresAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$RefreshTokensTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({userId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (userId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.userId,
referencedTable: $$RefreshTokensTableReferences
._userIdTable(db),
referencedColumn: $$RefreshTokensTableReferences
._userIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$RefreshTokensTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$RefreshTokensTable,
RefreshToken,
$$RefreshTokensTableFilterComposer,
$$RefreshTokensTableOrderingComposer,
$$RefreshTokensTableAnnotationComposer,
$$RefreshTokensTableCreateCompanionBuilder,
$$RefreshTokensTableUpdateCompanionBuilder,
(RefreshToken, $$RefreshTokensTableReferences),
RefreshToken,
PrefetchHooks Function({bool userId})
>;
typedef $$TelegramAuthCodesTableCreateCompanionBuilder =
TelegramAuthCodesCompanion Function({
Value<String> id,
required String code,
required String telegramUserId,
Value<String?> telegramUsername,
Value<String?> firstName,
Value<String?> lastName,
Value<bool> isUsed,
Value<PgDateTime?> usedAt,
Value<PgDateTime> createdAt,
required PgDateTime expiresAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
typedef $$TelegramAuthCodesTableUpdateCompanionBuilder =
TelegramAuthCodesCompanion Function({
Value<String> id,
Value<String> code,
Value<String> telegramUserId,
Value<String?> telegramUsername,
Value<String?> firstName,
Value<String?> lastName,
Value<bool> isUsed,
Value<PgDateTime?> usedAt,
Value<PgDateTime> createdAt,
Value<PgDateTime> expiresAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
class $$TelegramAuthCodesTableFilterComposer
extends Composer<_$AppDatabase, $TelegramAuthCodesTable> {
$$TelegramAuthCodesTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get code => $composableBuilder(
column: $table.code,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get telegramUserId => $composableBuilder(
column: $table.telegramUserId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get telegramUsername => $composableBuilder(
column: $table.telegramUsername,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get firstName => $composableBuilder(
column: $table.firstName,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get lastName => $composableBuilder(
column: $table.lastName,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isUsed => $composableBuilder(
column: $table.isUsed,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get usedAt => $composableBuilder(
column: $table.usedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get expiresAt => $composableBuilder(
column: $table.expiresAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnFilters(column),
);
}
class $$TelegramAuthCodesTableOrderingComposer
extends Composer<_$AppDatabase, $TelegramAuthCodesTable> {
$$TelegramAuthCodesTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get code => $composableBuilder(
column: $table.code,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get telegramUserId => $composableBuilder(
column: $table.telegramUserId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get telegramUsername => $composableBuilder(
column: $table.telegramUsername,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get firstName => $composableBuilder(
column: $table.firstName,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get lastName => $composableBuilder(
column: $table.lastName,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isUsed => $composableBuilder(
column: $table.isUsed,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get usedAt => $composableBuilder(
column: $table.usedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get expiresAt => $composableBuilder(
column: $table.expiresAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnOrderings(column),
);
}
class $$TelegramAuthCodesTableAnnotationComposer
extends Composer<_$AppDatabase, $TelegramAuthCodesTable> {
$$TelegramAuthCodesTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get code =>
$composableBuilder(column: $table.code, builder: (column) => column);
GeneratedColumn<String> get telegramUserId => $composableBuilder(
column: $table.telegramUserId,
builder: (column) => column,
);
GeneratedColumn<String> get telegramUsername => $composableBuilder(
column: $table.telegramUsername,
builder: (column) => column,
);
GeneratedColumn<String> get firstName =>
$composableBuilder(column: $table.firstName, builder: (column) => column);
GeneratedColumn<String> get lastName =>
$composableBuilder(column: $table.lastName, builder: (column) => column);
GeneratedColumn<bool> get isUsed =>
$composableBuilder(column: $table.isUsed, builder: (column) => column);
GeneratedColumn<PgDateTime> get usedAt =>
$composableBuilder(column: $table.usedAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get expiresAt =>
$composableBuilder(column: $table.expiresAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
GeneratedColumn<PgDateTime> get deletedAt =>
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
}
class $$TelegramAuthCodesTableTableManager
extends
RootTableManager<
_$AppDatabase,
$TelegramAuthCodesTable,
TelegramAuthCode,
$$TelegramAuthCodesTableFilterComposer,
$$TelegramAuthCodesTableOrderingComposer,
$$TelegramAuthCodesTableAnnotationComposer,
$$TelegramAuthCodesTableCreateCompanionBuilder,
$$TelegramAuthCodesTableUpdateCompanionBuilder,
(
TelegramAuthCode,
BaseReferences<
_$AppDatabase,
$TelegramAuthCodesTable,
TelegramAuthCode
>,
),
TelegramAuthCode,
PrefetchHooks Function()
> {
$$TelegramAuthCodesTableTableManager(
_$AppDatabase db,
$TelegramAuthCodesTable table,
) : super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$TelegramAuthCodesTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$TelegramAuthCodesTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$TelegramAuthCodesTableAnnotationComposer(
$db: db,
$table: table,
),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> code = const Value.absent(),
Value<String> telegramUserId = const Value.absent(),
Value<String?> telegramUsername = const Value.absent(),
Value<String?> firstName = const Value.absent(),
Value<String?> lastName = const Value.absent(),
Value<bool> isUsed = const Value.absent(),
Value<PgDateTime?> usedAt = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> expiresAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => TelegramAuthCodesCompanion(
id: id,
code: code,
telegramUserId: telegramUserId,
telegramUsername: telegramUsername,
firstName: firstName,
lastName: lastName,
isUsed: isUsed,
usedAt: usedAt,
createdAt: createdAt,
expiresAt: expiresAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String code,
required String telegramUserId,
Value<String?> telegramUsername = const Value.absent(),
Value<String?> firstName = const Value.absent(),
Value<String?> lastName = const Value.absent(),
Value<bool> isUsed = const Value.absent(),
Value<PgDateTime?> usedAt = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
required PgDateTime expiresAt,
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => TelegramAuthCodesCompanion.insert(
id: id,
code: code,
telegramUserId: telegramUserId,
telegramUsername: telegramUsername,
firstName: firstName,
lastName: lastName,
isUsed: isUsed,
usedAt: usedAt,
createdAt: createdAt,
expiresAt: expiresAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
),
);
}
typedef $$TelegramAuthCodesTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$TelegramAuthCodesTable,
TelegramAuthCode,
$$TelegramAuthCodesTableFilterComposer,
$$TelegramAuthCodesTableOrderingComposer,
$$TelegramAuthCodesTableAnnotationComposer,
$$TelegramAuthCodesTableCreateCompanionBuilder,
$$TelegramAuthCodesTableUpdateCompanionBuilder,
(
TelegramAuthCode,
BaseReferences<
_$AppDatabase,
$TelegramAuthCodesTable,
TelegramAuthCode
>,
),
TelegramAuthCode,
PrefetchHooks Function()
>;
typedef $$CardPacksTableCreateCompanionBuilder =
CardPacksCompanion Function({
Value<String> id,
required String title,
required String subtitle,
Value<String?> description,
Value<String?> color,
Value<String?> cover,
required int size,
Value<String?> version,
Value<int> order,
Value<bool> enabled,
Value<List<String>> cardsOrder,
Value<String?> googlePlayId,
Value<String?> rustoreId,
Value<String?> appStoreId,
Value<String?> price,
Value<String> currency,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<int> rowid,
});
typedef $$CardPacksTableUpdateCompanionBuilder =
CardPacksCompanion Function({
Value<String> id,
Value<String> title,
Value<String> subtitle,
Value<String?> description,
Value<String?> color,
Value<String?> cover,
Value<int> size,
Value<String?> version,
Value<int> order,
Value<bool> enabled,
Value<List<String>> cardsOrder,
Value<String?> googlePlayId,
Value<String?> rustoreId,
Value<String?> appStoreId,
Value<String?> price,
Value<String> currency,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<int> rowid,
});
final class $$CardPacksTableReferences
extends BaseReferences<_$AppDatabase, $CardPacksTable, CardPack> {
$$CardPacksTableReferences(super.$_db, super.$_table, super.$_typedResult);
static MultiTypedResultKey<$UserPacksTable, List<UserPack>>
_userPacksRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.userPacks,
aliasName: $_aliasNameGenerator(db.cardPacks.id, db.userPacks.packId),
);
$$UserPacksTableProcessedTableManager get userPacksRefs {
final manager = $$UserPacksTableTableManager(
$_db,
$_db.userPacks,
).filter((f) => f.packId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_userPacksRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$PreviewCardsTable, List<PreviewCard>>
_previewCardsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.previewCards,
aliasName: $_aliasNameGenerator(db.cardPacks.id, db.previewCards.packId),
);
$$PreviewCardsTableProcessedTableManager get previewCardsRefs {
final manager = $$PreviewCardsTableTableManager(
$_db,
$_db.previewCards,
).filter((f) => f.packId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_previewCardsRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$CardPackCardsTable, List<CardPackCard>>
_cardPackCardsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.cardPackCards,
aliasName: $_aliasNameGenerator(db.cardPacks.id, db.cardPackCards.packId),
);
$$CardPackCardsTableProcessedTableManager get cardPackCardsRefs {
final manager = $$CardPackCardsTableTableManager(
$_db,
$_db.cardPackCards,
).filter((f) => f.packId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_cardPackCardsRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$TestPackRelationsTable, List<TestPackRelation>>
_testPackRelationsRefsTable(_$AppDatabase db) =>
MultiTypedResultKey.fromTable(
db.testPackRelations,
aliasName: $_aliasNameGenerator(
db.cardPacks.id,
db.testPackRelations.packId,
),
);
$$TestPackRelationsTableProcessedTableManager get testPackRelationsRefs {
final manager = $$TestPackRelationsTableTableManager(
$_db,
$_db.testPackRelations,
).filter((f) => f.packId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(
_testPackRelationsRefsTable($_db),
);
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
}
class $$CardPacksTableFilterComposer
extends Composer<_$AppDatabase, $CardPacksTable> {
$$CardPacksTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get title => $composableBuilder(
column: $table.title,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get subtitle => $composableBuilder(
column: $table.subtitle,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get description => $composableBuilder(
column: $table.description,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get color => $composableBuilder(
column: $table.color,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get cover => $composableBuilder(
column: $table.cover,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get size => $composableBuilder(
column: $table.size,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get version => $composableBuilder(
column: $table.version,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get order => $composableBuilder(
column: $table.order,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get enabled => $composableBuilder(
column: $table.enabled,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<List<String>, List<String>, String>
get cardsOrder => $composableBuilder(
column: $table.cardsOrder,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<String> get googlePlayId => $composableBuilder(
column: $table.googlePlayId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get rustoreId => $composableBuilder(
column: $table.rustoreId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get appStoreId => $composableBuilder(
column: $table.appStoreId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get price => $composableBuilder(
column: $table.price,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get currency => $composableBuilder(
column: $table.currency,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
Expression<bool> userPacksRefs(
Expression<bool> Function($$UserPacksTableFilterComposer f) f,
) {
final $$UserPacksTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userPacks,
getReferencedColumn: (t) => t.packId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserPacksTableFilterComposer(
$db: $db,
$table: $db.userPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> previewCardsRefs(
Expression<bool> Function($$PreviewCardsTableFilterComposer f) f,
) {
final $$PreviewCardsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.previewCards,
getReferencedColumn: (t) => t.packId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$PreviewCardsTableFilterComposer(
$db: $db,
$table: $db.previewCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> cardPackCardsRefs(
Expression<bool> Function($$CardPackCardsTableFilterComposer f) f,
) {
final $$CardPackCardsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.cardPackCards,
getReferencedColumn: (t) => t.packId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPackCardsTableFilterComposer(
$db: $db,
$table: $db.cardPackCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> testPackRelationsRefs(
Expression<bool> Function($$TestPackRelationsTableFilterComposer f) f,
) {
final $$TestPackRelationsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.testPackRelations,
getReferencedColumn: (t) => t.packId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestPackRelationsTableFilterComposer(
$db: $db,
$table: $db.testPackRelations,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$CardPacksTableOrderingComposer
extends Composer<_$AppDatabase, $CardPacksTable> {
$$CardPacksTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get title => $composableBuilder(
column: $table.title,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get subtitle => $composableBuilder(
column: $table.subtitle,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get description => $composableBuilder(
column: $table.description,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get color => $composableBuilder(
column: $table.color,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get cover => $composableBuilder(
column: $table.cover,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get size => $composableBuilder(
column: $table.size,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get version => $composableBuilder(
column: $table.version,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get order => $composableBuilder(
column: $table.order,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get enabled => $composableBuilder(
column: $table.enabled,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get cardsOrder => $composableBuilder(
column: $table.cardsOrder,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get googlePlayId => $composableBuilder(
column: $table.googlePlayId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get rustoreId => $composableBuilder(
column: $table.rustoreId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get appStoreId => $composableBuilder(
column: $table.appStoreId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get price => $composableBuilder(
column: $table.price,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get currency => $composableBuilder(
column: $table.currency,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
}
class $$CardPacksTableAnnotationComposer
extends Composer<_$AppDatabase, $CardPacksTable> {
$$CardPacksTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get title =>
$composableBuilder(column: $table.title, builder: (column) => column);
GeneratedColumn<String> get subtitle =>
$composableBuilder(column: $table.subtitle, builder: (column) => column);
GeneratedColumn<String> get description => $composableBuilder(
column: $table.description,
builder: (column) => column,
);
GeneratedColumn<String> get color =>
$composableBuilder(column: $table.color, builder: (column) => column);
GeneratedColumn<String> get cover =>
$composableBuilder(column: $table.cover, builder: (column) => column);
GeneratedColumn<int> get size =>
$composableBuilder(column: $table.size, builder: (column) => column);
GeneratedColumn<String> get version =>
$composableBuilder(column: $table.version, builder: (column) => column);
GeneratedColumn<int> get order =>
$composableBuilder(column: $table.order, builder: (column) => column);
GeneratedColumn<bool> get enabled =>
$composableBuilder(column: $table.enabled, builder: (column) => column);
GeneratedColumnWithTypeConverter<List<String>, String> get cardsOrder =>
$composableBuilder(
column: $table.cardsOrder,
builder: (column) => column,
);
GeneratedColumn<String> get googlePlayId => $composableBuilder(
column: $table.googlePlayId,
builder: (column) => column,
);
GeneratedColumn<String> get rustoreId =>
$composableBuilder(column: $table.rustoreId, builder: (column) => column);
GeneratedColumn<String> get appStoreId => $composableBuilder(
column: $table.appStoreId,
builder: (column) => column,
);
GeneratedColumn<String> get price =>
$composableBuilder(column: $table.price, builder: (column) => column);
GeneratedColumn<String> get currency =>
$composableBuilder(column: $table.currency, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
Expression<T> userPacksRefs<T extends Object>(
Expression<T> Function($$UserPacksTableAnnotationComposer a) f,
) {
final $$UserPacksTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.userPacks,
getReferencedColumn: (t) => t.packId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UserPacksTableAnnotationComposer(
$db: $db,
$table: $db.userPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> previewCardsRefs<T extends Object>(
Expression<T> Function($$PreviewCardsTableAnnotationComposer a) f,
) {
final $$PreviewCardsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.previewCards,
getReferencedColumn: (t) => t.packId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$PreviewCardsTableAnnotationComposer(
$db: $db,
$table: $db.previewCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> cardPackCardsRefs<T extends Object>(
Expression<T> Function($$CardPackCardsTableAnnotationComposer a) f,
) {
final $$CardPackCardsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.cardPackCards,
getReferencedColumn: (t) => t.packId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPackCardsTableAnnotationComposer(
$db: $db,
$table: $db.cardPackCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> testPackRelationsRefs<T extends Object>(
Expression<T> Function($$TestPackRelationsTableAnnotationComposer a) f,
) {
final $$TestPackRelationsTableAnnotationComposer composer =
$composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.testPackRelations,
getReferencedColumn: (t) => t.packId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestPackRelationsTableAnnotationComposer(
$db: $db,
$table: $db.testPackRelations,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$CardPacksTableTableManager
extends
RootTableManager<
_$AppDatabase,
$CardPacksTable,
CardPack,
$$CardPacksTableFilterComposer,
$$CardPacksTableOrderingComposer,
$$CardPacksTableAnnotationComposer,
$$CardPacksTableCreateCompanionBuilder,
$$CardPacksTableUpdateCompanionBuilder,
(CardPack, $$CardPacksTableReferences),
CardPack,
PrefetchHooks Function({
bool userPacksRefs,
bool previewCardsRefs,
bool cardPackCardsRefs,
bool testPackRelationsRefs,
})
> {
$$CardPacksTableTableManager(_$AppDatabase db, $CardPacksTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$CardPacksTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$CardPacksTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$CardPacksTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> title = const Value.absent(),
Value<String> subtitle = const Value.absent(),
Value<String?> description = const Value.absent(),
Value<String?> color = const Value.absent(),
Value<String?> cover = const Value.absent(),
Value<int> size = const Value.absent(),
Value<String?> version = const Value.absent(),
Value<int> order = const Value.absent(),
Value<bool> enabled = const Value.absent(),
Value<List<String>> cardsOrder = const Value.absent(),
Value<String?> googlePlayId = const Value.absent(),
Value<String?> rustoreId = const Value.absent(),
Value<String?> appStoreId = const Value.absent(),
Value<String?> price = const Value.absent(),
Value<String> currency = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => CardPacksCompanion(
id: id,
title: title,
subtitle: subtitle,
description: description,
color: color,
cover: cover,
size: size,
version: version,
order: order,
enabled: enabled,
cardsOrder: cardsOrder,
googlePlayId: googlePlayId,
rustoreId: rustoreId,
appStoreId: appStoreId,
price: price,
currency: currency,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String title,
required String subtitle,
Value<String?> description = const Value.absent(),
Value<String?> color = const Value.absent(),
Value<String?> cover = const Value.absent(),
required int size,
Value<String?> version = const Value.absent(),
Value<int> order = const Value.absent(),
Value<bool> enabled = const Value.absent(),
Value<List<String>> cardsOrder = const Value.absent(),
Value<String?> googlePlayId = const Value.absent(),
Value<String?> rustoreId = const Value.absent(),
Value<String?> appStoreId = const Value.absent(),
Value<String?> price = const Value.absent(),
Value<String> currency = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => CardPacksCompanion.insert(
id: id,
title: title,
subtitle: subtitle,
description: description,
color: color,
cover: cover,
size: size,
version: version,
order: order,
enabled: enabled,
cardsOrder: cardsOrder,
googlePlayId: googlePlayId,
rustoreId: rustoreId,
appStoreId: appStoreId,
price: price,
currency: currency,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$CardPacksTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback:
({
userPacksRefs = false,
previewCardsRefs = false,
cardPackCardsRefs = false,
testPackRelationsRefs = false,
}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [
if (userPacksRefs) db.userPacks,
if (previewCardsRefs) db.previewCards,
if (cardPackCardsRefs) db.cardPackCards,
if (testPackRelationsRefs) db.testPackRelations,
],
addJoins: null,
getPrefetchedDataCallback: (items) async {
return [
if (userPacksRefs)
await $_getPrefetchedData<
CardPack,
$CardPacksTable,
UserPack
>(
currentTable: table,
referencedTable: $$CardPacksTableReferences
._userPacksRefsTable(db),
managerFromTypedResult: (p0) =>
$$CardPacksTableReferences(
db,
table,
p0,
).userPacksRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.packId == item.id,
),
typedResults: items,
),
if (previewCardsRefs)
await $_getPrefetchedData<
CardPack,
$CardPacksTable,
PreviewCard
>(
currentTable: table,
referencedTable: $$CardPacksTableReferences
._previewCardsRefsTable(db),
managerFromTypedResult: (p0) =>
$$CardPacksTableReferences(
db,
table,
p0,
).previewCardsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.packId == item.id,
),
typedResults: items,
),
if (cardPackCardsRefs)
await $_getPrefetchedData<
CardPack,
$CardPacksTable,
CardPackCard
>(
currentTable: table,
referencedTable: $$CardPacksTableReferences
._cardPackCardsRefsTable(db),
managerFromTypedResult: (p0) =>
$$CardPacksTableReferences(
db,
table,
p0,
).cardPackCardsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.packId == item.id,
),
typedResults: items,
),
if (testPackRelationsRefs)
await $_getPrefetchedData<
CardPack,
$CardPacksTable,
TestPackRelation
>(
currentTable: table,
referencedTable: $$CardPacksTableReferences
._testPackRelationsRefsTable(db),
managerFromTypedResult: (p0) =>
$$CardPacksTableReferences(
db,
table,
p0,
).testPackRelationsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.packId == item.id,
),
typedResults: items,
),
];
},
);
},
),
);
}
typedef $$CardPacksTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$CardPacksTable,
CardPack,
$$CardPacksTableFilterComposer,
$$CardPacksTableOrderingComposer,
$$CardPacksTableAnnotationComposer,
$$CardPacksTableCreateCompanionBuilder,
$$CardPacksTableUpdateCompanionBuilder,
(CardPack, $$CardPacksTableReferences),
CardPack,
PrefetchHooks Function({
bool userPacksRefs,
bool previewCardsRefs,
bool cardPackCardsRefs,
bool testPackRelationsRefs,
})
>;
typedef $$GameCardsTableCreateCompanionBuilder =
GameCardsCompanion Function({
Value<String> id,
required String original,
required String translation,
Value<String?> mnemo,
required String image,
Value<String?> imageBack,
Value<String?> transcription,
Value<String?> transcriptionMnemo,
Value<String?> back,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<int> rowid,
});
typedef $$GameCardsTableUpdateCompanionBuilder =
GameCardsCompanion Function({
Value<String> id,
Value<String> original,
Value<String> translation,
Value<String?> mnemo,
Value<String> image,
Value<String?> imageBack,
Value<String?> transcription,
Value<String?> transcriptionMnemo,
Value<String?> back,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<int> rowid,
});
final class $$GameCardsTableReferences
extends BaseReferences<_$AppDatabase, $GameCardsTable, GameCard> {
$$GameCardsTableReferences(super.$_db, super.$_table, super.$_typedResult);
static MultiTypedResultKey<$VoiceModelsTable, List<VoiceModel>>
_voiceModelsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.voiceModels,
aliasName: $_aliasNameGenerator(db.gameCards.id, db.voiceModels.cardId),
);
$$VoiceModelsTableProcessedTableManager get voiceModelsRefs {
final manager = $$VoiceModelsTableTableManager(
$_db,
$_db.voiceModels,
).filter((f) => f.cardId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_voiceModelsRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$PreviewCardsTable, List<PreviewCard>>
_previewCardsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.previewCards,
aliasName: $_aliasNameGenerator(db.gameCards.id, db.previewCards.cardId),
);
$$PreviewCardsTableProcessedTableManager get previewCardsRefs {
final manager = $$PreviewCardsTableTableManager(
$_db,
$_db.previewCards,
).filter((f) => f.cardId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_previewCardsRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$CardPackCardsTable, List<CardPackCard>>
_cardPackCardsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.cardPackCards,
aliasName: $_aliasNameGenerator(db.gameCards.id, db.cardPackCards.cardId),
);
$$CardPackCardsTableProcessedTableManager get cardPackCardsRefs {
final manager = $$CardPackCardsTableTableManager(
$_db,
$_db.cardPackCards,
).filter((f) => f.cardId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_cardPackCardsRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$CardVoicesTable, List<CardVoice>>
_cardVoicesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.cardVoices,
aliasName: $_aliasNameGenerator(db.gameCards.id, db.cardVoices.cardId),
);
$$CardVoicesTableProcessedTableManager get cardVoicesRefs {
final manager = $$CardVoicesTableTableManager(
$_db,
$_db.cardVoices,
).filter((f) => f.cardId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_cardVoicesRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$WordStatisticsTable, List<WordStatistic>>
_wordStatisticsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.wordStatistics,
aliasName: $_aliasNameGenerator(db.gameCards.id, db.wordStatistics.cardId),
);
$$WordStatisticsTableProcessedTableManager get wordStatisticsRefs {
final manager = $$WordStatisticsTableTableManager(
$_db,
$_db.wordStatistics,
).filter((f) => f.cardId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_wordStatisticsRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
}
class $$GameCardsTableFilterComposer
extends Composer<_$AppDatabase, $GameCardsTable> {
$$GameCardsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get original => $composableBuilder(
column: $table.original,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get translation => $composableBuilder(
column: $table.translation,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get mnemo => $composableBuilder(
column: $table.mnemo,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get image => $composableBuilder(
column: $table.image,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get imageBack => $composableBuilder(
column: $table.imageBack,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get transcription => $composableBuilder(
column: $table.transcription,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get transcriptionMnemo => $composableBuilder(
column: $table.transcriptionMnemo,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get back => $composableBuilder(
column: $table.back,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
Expression<bool> voiceModelsRefs(
Expression<bool> Function($$VoiceModelsTableFilterComposer f) f,
) {
final $$VoiceModelsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.voiceModels,
getReferencedColumn: (t) => t.cardId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$VoiceModelsTableFilterComposer(
$db: $db,
$table: $db.voiceModels,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> previewCardsRefs(
Expression<bool> Function($$PreviewCardsTableFilterComposer f) f,
) {
final $$PreviewCardsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.previewCards,
getReferencedColumn: (t) => t.cardId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$PreviewCardsTableFilterComposer(
$db: $db,
$table: $db.previewCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> cardPackCardsRefs(
Expression<bool> Function($$CardPackCardsTableFilterComposer f) f,
) {
final $$CardPackCardsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.cardPackCards,
getReferencedColumn: (t) => t.cardId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPackCardsTableFilterComposer(
$db: $db,
$table: $db.cardPackCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> cardVoicesRefs(
Expression<bool> Function($$CardVoicesTableFilterComposer f) f,
) {
final $$CardVoicesTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.cardVoices,
getReferencedColumn: (t) => t.cardId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardVoicesTableFilterComposer(
$db: $db,
$table: $db.cardVoices,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> wordStatisticsRefs(
Expression<bool> Function($$WordStatisticsTableFilterComposer f) f,
) {
final $$WordStatisticsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.wordStatistics,
getReferencedColumn: (t) => t.cardId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$WordStatisticsTableFilterComposer(
$db: $db,
$table: $db.wordStatistics,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$GameCardsTableOrderingComposer
extends Composer<_$AppDatabase, $GameCardsTable> {
$$GameCardsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get original => $composableBuilder(
column: $table.original,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get translation => $composableBuilder(
column: $table.translation,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get mnemo => $composableBuilder(
column: $table.mnemo,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get image => $composableBuilder(
column: $table.image,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get imageBack => $composableBuilder(
column: $table.imageBack,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get transcription => $composableBuilder(
column: $table.transcription,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get transcriptionMnemo => $composableBuilder(
column: $table.transcriptionMnemo,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get back => $composableBuilder(
column: $table.back,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
}
class $$GameCardsTableAnnotationComposer
extends Composer<_$AppDatabase, $GameCardsTable> {
$$GameCardsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get original =>
$composableBuilder(column: $table.original, builder: (column) => column);
GeneratedColumn<String> get translation => $composableBuilder(
column: $table.translation,
builder: (column) => column,
);
GeneratedColumn<String> get mnemo =>
$composableBuilder(column: $table.mnemo, builder: (column) => column);
GeneratedColumn<String> get image =>
$composableBuilder(column: $table.image, builder: (column) => column);
GeneratedColumn<String> get imageBack =>
$composableBuilder(column: $table.imageBack, builder: (column) => column);
GeneratedColumn<String> get transcription => $composableBuilder(
column: $table.transcription,
builder: (column) => column,
);
GeneratedColumn<String> get transcriptionMnemo => $composableBuilder(
column: $table.transcriptionMnemo,
builder: (column) => column,
);
GeneratedColumn<String> get back =>
$composableBuilder(column: $table.back, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
Expression<T> voiceModelsRefs<T extends Object>(
Expression<T> Function($$VoiceModelsTableAnnotationComposer a) f,
) {
final $$VoiceModelsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.voiceModels,
getReferencedColumn: (t) => t.cardId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$VoiceModelsTableAnnotationComposer(
$db: $db,
$table: $db.voiceModels,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> previewCardsRefs<T extends Object>(
Expression<T> Function($$PreviewCardsTableAnnotationComposer a) f,
) {
final $$PreviewCardsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.previewCards,
getReferencedColumn: (t) => t.cardId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$PreviewCardsTableAnnotationComposer(
$db: $db,
$table: $db.previewCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> cardPackCardsRefs<T extends Object>(
Expression<T> Function($$CardPackCardsTableAnnotationComposer a) f,
) {
final $$CardPackCardsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.cardPackCards,
getReferencedColumn: (t) => t.cardId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPackCardsTableAnnotationComposer(
$db: $db,
$table: $db.cardPackCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> cardVoicesRefs<T extends Object>(
Expression<T> Function($$CardVoicesTableAnnotationComposer a) f,
) {
final $$CardVoicesTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.cardVoices,
getReferencedColumn: (t) => t.cardId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardVoicesTableAnnotationComposer(
$db: $db,
$table: $db.cardVoices,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> wordStatisticsRefs<T extends Object>(
Expression<T> Function($$WordStatisticsTableAnnotationComposer a) f,
) {
final $$WordStatisticsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.wordStatistics,
getReferencedColumn: (t) => t.cardId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$WordStatisticsTableAnnotationComposer(
$db: $db,
$table: $db.wordStatistics,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$GameCardsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$GameCardsTable,
GameCard,
$$GameCardsTableFilterComposer,
$$GameCardsTableOrderingComposer,
$$GameCardsTableAnnotationComposer,
$$GameCardsTableCreateCompanionBuilder,
$$GameCardsTableUpdateCompanionBuilder,
(GameCard, $$GameCardsTableReferences),
GameCard,
PrefetchHooks Function({
bool voiceModelsRefs,
bool previewCardsRefs,
bool cardPackCardsRefs,
bool cardVoicesRefs,
bool wordStatisticsRefs,
})
> {
$$GameCardsTableTableManager(_$AppDatabase db, $GameCardsTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$GameCardsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$GameCardsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$GameCardsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> original = const Value.absent(),
Value<String> translation = const Value.absent(),
Value<String?> mnemo = const Value.absent(),
Value<String> image = const Value.absent(),
Value<String?> imageBack = const Value.absent(),
Value<String?> transcription = const Value.absent(),
Value<String?> transcriptionMnemo = const Value.absent(),
Value<String?> back = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => GameCardsCompanion(
id: id,
original: original,
translation: translation,
mnemo: mnemo,
image: image,
imageBack: imageBack,
transcription: transcription,
transcriptionMnemo: transcriptionMnemo,
back: back,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String original,
required String translation,
Value<String?> mnemo = const Value.absent(),
required String image,
Value<String?> imageBack = const Value.absent(),
Value<String?> transcription = const Value.absent(),
Value<String?> transcriptionMnemo = const Value.absent(),
Value<String?> back = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => GameCardsCompanion.insert(
id: id,
original: original,
translation: translation,
mnemo: mnemo,
image: image,
imageBack: imageBack,
transcription: transcription,
transcriptionMnemo: transcriptionMnemo,
back: back,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$GameCardsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback:
({
voiceModelsRefs = false,
previewCardsRefs = false,
cardPackCardsRefs = false,
cardVoicesRefs = false,
wordStatisticsRefs = false,
}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [
if (voiceModelsRefs) db.voiceModels,
if (previewCardsRefs) db.previewCards,
if (cardPackCardsRefs) db.cardPackCards,
if (cardVoicesRefs) db.cardVoices,
if (wordStatisticsRefs) db.wordStatistics,
],
addJoins: null,
getPrefetchedDataCallback: (items) async {
return [
if (voiceModelsRefs)
await $_getPrefetchedData<
GameCard,
$GameCardsTable,
VoiceModel
>(
currentTable: table,
referencedTable: $$GameCardsTableReferences
._voiceModelsRefsTable(db),
managerFromTypedResult: (p0) =>
$$GameCardsTableReferences(
db,
table,
p0,
).voiceModelsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.cardId == item.id,
),
typedResults: items,
),
if (previewCardsRefs)
await $_getPrefetchedData<
GameCard,
$GameCardsTable,
PreviewCard
>(
currentTable: table,
referencedTable: $$GameCardsTableReferences
._previewCardsRefsTable(db),
managerFromTypedResult: (p0) =>
$$GameCardsTableReferences(
db,
table,
p0,
).previewCardsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.cardId == item.id,
),
typedResults: items,
),
if (cardPackCardsRefs)
await $_getPrefetchedData<
GameCard,
$GameCardsTable,
CardPackCard
>(
currentTable: table,
referencedTable: $$GameCardsTableReferences
._cardPackCardsRefsTable(db),
managerFromTypedResult: (p0) =>
$$GameCardsTableReferences(
db,
table,
p0,
).cardPackCardsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.cardId == item.id,
),
typedResults: items,
),
if (cardVoicesRefs)
await $_getPrefetchedData<
GameCard,
$GameCardsTable,
CardVoice
>(
currentTable: table,
referencedTable: $$GameCardsTableReferences
._cardVoicesRefsTable(db),
managerFromTypedResult: (p0) =>
$$GameCardsTableReferences(
db,
table,
p0,
).cardVoicesRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.cardId == item.id,
),
typedResults: items,
),
if (wordStatisticsRefs)
await $_getPrefetchedData<
GameCard,
$GameCardsTable,
WordStatistic
>(
currentTable: table,
referencedTable: $$GameCardsTableReferences
._wordStatisticsRefsTable(db),
managerFromTypedResult: (p0) =>
$$GameCardsTableReferences(
db,
table,
p0,
).wordStatisticsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.cardId == item.id,
),
typedResults: items,
),
];
},
);
},
),
);
}
typedef $$GameCardsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$GameCardsTable,
GameCard,
$$GameCardsTableFilterComposer,
$$GameCardsTableOrderingComposer,
$$GameCardsTableAnnotationComposer,
$$GameCardsTableCreateCompanionBuilder,
$$GameCardsTableUpdateCompanionBuilder,
(GameCard, $$GameCardsTableReferences),
GameCard,
PrefetchHooks Function({
bool voiceModelsRefs,
bool previewCardsRefs,
bool cardPackCardsRefs,
bool cardVoicesRefs,
bool wordStatisticsRefs,
})
>;
typedef $$VoiceModelsTableCreateCompanionBuilder =
VoiceModelsCompanion Function({
Value<String> id,
required String cardId,
required String voiceUrl,
required String language,
Value<PgDateTime> createdAt,
Value<int> rowid,
});
typedef $$VoiceModelsTableUpdateCompanionBuilder =
VoiceModelsCompanion Function({
Value<String> id,
Value<String> cardId,
Value<String> voiceUrl,
Value<String> language,
Value<PgDateTime> createdAt,
Value<int> rowid,
});
final class $$VoiceModelsTableReferences
extends BaseReferences<_$AppDatabase, $VoiceModelsTable, VoiceModel> {
$$VoiceModelsTableReferences(super.$_db, super.$_table, super.$_typedResult);
static $GameCardsTable _cardIdTable(_$AppDatabase db) =>
db.gameCards.createAlias(
$_aliasNameGenerator(db.voiceModels.cardId, db.gameCards.id),
);
$$GameCardsTableProcessedTableManager get cardId {
final $_column = $_itemColumn<String>('card_id')!;
final manager = $$GameCardsTableTableManager(
$_db,
$_db.gameCards,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_cardIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
static MultiTypedResultKey<$CardVoicesTable, List<CardVoice>>
_cardVoicesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.cardVoices,
aliasName: $_aliasNameGenerator(db.voiceModels.id, db.cardVoices.voiceId),
);
$$CardVoicesTableProcessedTableManager get cardVoicesRefs {
final manager = $$CardVoicesTableTableManager(
$_db,
$_db.cardVoices,
).filter((f) => f.voiceId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_cardVoicesRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
}
class $$VoiceModelsTableFilterComposer
extends Composer<_$AppDatabase, $VoiceModelsTable> {
$$VoiceModelsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get voiceUrl => $composableBuilder(
column: $table.voiceUrl,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get language => $composableBuilder(
column: $table.language,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
$$GameCardsTableFilterComposer get cardId {
final $$GameCardsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableFilterComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
Expression<bool> cardVoicesRefs(
Expression<bool> Function($$CardVoicesTableFilterComposer f) f,
) {
final $$CardVoicesTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.cardVoices,
getReferencedColumn: (t) => t.voiceId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardVoicesTableFilterComposer(
$db: $db,
$table: $db.cardVoices,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$VoiceModelsTableOrderingComposer
extends Composer<_$AppDatabase, $VoiceModelsTable> {
$$VoiceModelsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get voiceUrl => $composableBuilder(
column: $table.voiceUrl,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get language => $composableBuilder(
column: $table.language,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
$$GameCardsTableOrderingComposer get cardId {
final $$GameCardsTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableOrderingComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$VoiceModelsTableAnnotationComposer
extends Composer<_$AppDatabase, $VoiceModelsTable> {
$$VoiceModelsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get voiceUrl =>
$composableBuilder(column: $table.voiceUrl, builder: (column) => column);
GeneratedColumn<String> get language =>
$composableBuilder(column: $table.language, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
$$GameCardsTableAnnotationComposer get cardId {
final $$GameCardsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableAnnotationComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
Expression<T> cardVoicesRefs<T extends Object>(
Expression<T> Function($$CardVoicesTableAnnotationComposer a) f,
) {
final $$CardVoicesTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.cardVoices,
getReferencedColumn: (t) => t.voiceId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardVoicesTableAnnotationComposer(
$db: $db,
$table: $db.cardVoices,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$VoiceModelsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$VoiceModelsTable,
VoiceModel,
$$VoiceModelsTableFilterComposer,
$$VoiceModelsTableOrderingComposer,
$$VoiceModelsTableAnnotationComposer,
$$VoiceModelsTableCreateCompanionBuilder,
$$VoiceModelsTableUpdateCompanionBuilder,
(VoiceModel, $$VoiceModelsTableReferences),
VoiceModel,
PrefetchHooks Function({bool cardId, bool cardVoicesRefs})
> {
$$VoiceModelsTableTableManager(_$AppDatabase db, $VoiceModelsTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$VoiceModelsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$VoiceModelsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$VoiceModelsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> cardId = const Value.absent(),
Value<String> voiceUrl = const Value.absent(),
Value<String> language = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => VoiceModelsCompanion(
id: id,
cardId: cardId,
voiceUrl: voiceUrl,
language: language,
createdAt: createdAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String cardId,
required String voiceUrl,
required String language,
Value<PgDateTime> createdAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => VoiceModelsCompanion.insert(
id: id,
cardId: cardId,
voiceUrl: voiceUrl,
language: language,
createdAt: createdAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$VoiceModelsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({cardId = false, cardVoicesRefs = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [if (cardVoicesRefs) db.cardVoices],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (cardId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.cardId,
referencedTable: $$VoiceModelsTableReferences
._cardIdTable(db),
referencedColumn: $$VoiceModelsTableReferences
._cardIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [
if (cardVoicesRefs)
await $_getPrefetchedData<
VoiceModel,
$VoiceModelsTable,
CardVoice
>(
currentTable: table,
referencedTable: $$VoiceModelsTableReferences
._cardVoicesRefsTable(db),
managerFromTypedResult: (p0) =>
$$VoiceModelsTableReferences(
db,
table,
p0,
).cardVoicesRefs,
referencedItemsForCurrentItem: (item, referencedItems) =>
referencedItems.where((e) => e.voiceId == item.id),
typedResults: items,
),
];
},
);
},
),
);
}
typedef $$VoiceModelsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$VoiceModelsTable,
VoiceModel,
$$VoiceModelsTableFilterComposer,
$$VoiceModelsTableOrderingComposer,
$$VoiceModelsTableAnnotationComposer,
$$VoiceModelsTableCreateCompanionBuilder,
$$VoiceModelsTableUpdateCompanionBuilder,
(VoiceModel, $$VoiceModelsTableReferences),
VoiceModel,
PrefetchHooks Function({bool cardId, bool cardVoicesRefs})
>;
typedef $$UserPacksTableCreateCompanionBuilder =
UserPacksCompanion Function({
required String userId,
required String packId,
Value<PgDateTime> grantedAt,
Value<String> grantType,
Value<int> rowid,
});
typedef $$UserPacksTableUpdateCompanionBuilder =
UserPacksCompanion Function({
Value<String> userId,
Value<String> packId,
Value<PgDateTime> grantedAt,
Value<String> grantType,
Value<int> rowid,
});
final class $$UserPacksTableReferences
extends BaseReferences<_$AppDatabase, $UserPacksTable, UserPack> {
$$UserPacksTableReferences(super.$_db, super.$_table, super.$_typedResult);
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
$_aliasNameGenerator(db.userPacks.userId, db.users.id),
);
$$UsersTableProcessedTableManager get userId {
final $_column = $_itemColumn<String>('user_id')!;
final manager = $$UsersTableTableManager(
$_db,
$_db.users,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
static $CardPacksTable _packIdTable(_$AppDatabase db) => db.cardPacks
.createAlias($_aliasNameGenerator(db.userPacks.packId, db.cardPacks.id));
$$CardPacksTableProcessedTableManager get packId {
final $_column = $_itemColumn<String>('pack_id')!;
final manager = $$CardPacksTableTableManager(
$_db,
$_db.cardPacks,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_packIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$UserPacksTableFilterComposer
extends Composer<_$AppDatabase, $UserPacksTable> {
$$UserPacksTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<PgDateTime> get grantedAt => $composableBuilder(
column: $table.grantedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get grantType => $composableBuilder(
column: $table.grantType,
builder: (column) => ColumnFilters(column),
);
$$UsersTableFilterComposer get userId {
final $$UsersTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableFilterComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$CardPacksTableFilterComposer get packId {
final $$CardPacksTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.packId,
referencedTable: $db.cardPacks,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPacksTableFilterComposer(
$db: $db,
$table: $db.cardPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserPacksTableOrderingComposer
extends Composer<_$AppDatabase, $UserPacksTable> {
$$UserPacksTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<PgDateTime> get grantedAt => $composableBuilder(
column: $table.grantedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get grantType => $composableBuilder(
column: $table.grantType,
builder: (column) => ColumnOrderings(column),
);
$$UsersTableOrderingComposer get userId {
final $$UsersTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableOrderingComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$CardPacksTableOrderingComposer get packId {
final $$CardPacksTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.packId,
referencedTable: $db.cardPacks,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPacksTableOrderingComposer(
$db: $db,
$table: $db.cardPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserPacksTableAnnotationComposer
extends Composer<_$AppDatabase, $UserPacksTable> {
$$UserPacksTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<PgDateTime> get grantedAt =>
$composableBuilder(column: $table.grantedAt, builder: (column) => column);
GeneratedColumn<String> get grantType =>
$composableBuilder(column: $table.grantType, builder: (column) => column);
$$UsersTableAnnotationComposer get userId {
final $$UsersTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableAnnotationComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$CardPacksTableAnnotationComposer get packId {
final $$CardPacksTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.packId,
referencedTable: $db.cardPacks,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPacksTableAnnotationComposer(
$db: $db,
$table: $db.cardPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserPacksTableTableManager
extends
RootTableManager<
_$AppDatabase,
$UserPacksTable,
UserPack,
$$UserPacksTableFilterComposer,
$$UserPacksTableOrderingComposer,
$$UserPacksTableAnnotationComposer,
$$UserPacksTableCreateCompanionBuilder,
$$UserPacksTableUpdateCompanionBuilder,
(UserPack, $$UserPacksTableReferences),
UserPack,
PrefetchHooks Function({bool userId, bool packId})
> {
$$UserPacksTableTableManager(_$AppDatabase db, $UserPacksTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$UserPacksTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$UserPacksTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$UserPacksTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> userId = const Value.absent(),
Value<String> packId = const Value.absent(),
Value<PgDateTime> grantedAt = const Value.absent(),
Value<String> grantType = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserPacksCompanion(
userId: userId,
packId: packId,
grantedAt: grantedAt,
grantType: grantType,
rowid: rowid,
),
createCompanionCallback:
({
required String userId,
required String packId,
Value<PgDateTime> grantedAt = const Value.absent(),
Value<String> grantType = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserPacksCompanion.insert(
userId: userId,
packId: packId,
grantedAt: grantedAt,
grantType: grantType,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$UserPacksTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({userId = false, packId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (userId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.userId,
referencedTable: $$UserPacksTableReferences
._userIdTable(db),
referencedColumn: $$UserPacksTableReferences
._userIdTable(db)
.id,
)
as T;
}
if (packId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.packId,
referencedTable: $$UserPacksTableReferences
._packIdTable(db),
referencedColumn: $$UserPacksTableReferences
._packIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$UserPacksTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$UserPacksTable,
UserPack,
$$UserPacksTableFilterComposer,
$$UserPacksTableOrderingComposer,
$$UserPacksTableAnnotationComposer,
$$UserPacksTableCreateCompanionBuilder,
$$UserPacksTableUpdateCompanionBuilder,
(UserPack, $$UserPacksTableReferences),
UserPack,
PrefetchHooks Function({bool userId, bool packId})
>;
typedef $$PreviewCardsTableCreateCompanionBuilder =
PreviewCardsCompanion Function({
required String packId,
required String cardId,
Value<int> order,
Value<int> rowid,
});
typedef $$PreviewCardsTableUpdateCompanionBuilder =
PreviewCardsCompanion Function({
Value<String> packId,
Value<String> cardId,
Value<int> order,
Value<int> rowid,
});
final class $$PreviewCardsTableReferences
extends BaseReferences<_$AppDatabase, $PreviewCardsTable, PreviewCard> {
$$PreviewCardsTableReferences(super.$_db, super.$_table, super.$_typedResult);
static $CardPacksTable _packIdTable(_$AppDatabase db) =>
db.cardPacks.createAlias(
$_aliasNameGenerator(db.previewCards.packId, db.cardPacks.id),
);
$$CardPacksTableProcessedTableManager get packId {
final $_column = $_itemColumn<String>('pack_id')!;
final manager = $$CardPacksTableTableManager(
$_db,
$_db.cardPacks,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_packIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
static $GameCardsTable _cardIdTable(_$AppDatabase db) =>
db.gameCards.createAlias(
$_aliasNameGenerator(db.previewCards.cardId, db.gameCards.id),
);
$$GameCardsTableProcessedTableManager get cardId {
final $_column = $_itemColumn<String>('card_id')!;
final manager = $$GameCardsTableTableManager(
$_db,
$_db.gameCards,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_cardIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$PreviewCardsTableFilterComposer
extends Composer<_$AppDatabase, $PreviewCardsTable> {
$$PreviewCardsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<int> get order => $composableBuilder(
column: $table.order,
builder: (column) => ColumnFilters(column),
);
$$CardPacksTableFilterComposer get packId {
final $$CardPacksTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.packId,
referencedTable: $db.cardPacks,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPacksTableFilterComposer(
$db: $db,
$table: $db.cardPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$GameCardsTableFilterComposer get cardId {
final $$GameCardsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableFilterComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$PreviewCardsTableOrderingComposer
extends Composer<_$AppDatabase, $PreviewCardsTable> {
$$PreviewCardsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<int> get order => $composableBuilder(
column: $table.order,
builder: (column) => ColumnOrderings(column),
);
$$CardPacksTableOrderingComposer get packId {
final $$CardPacksTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.packId,
referencedTable: $db.cardPacks,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPacksTableOrderingComposer(
$db: $db,
$table: $db.cardPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$GameCardsTableOrderingComposer get cardId {
final $$GameCardsTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableOrderingComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$PreviewCardsTableAnnotationComposer
extends Composer<_$AppDatabase, $PreviewCardsTable> {
$$PreviewCardsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<int> get order =>
$composableBuilder(column: $table.order, builder: (column) => column);
$$CardPacksTableAnnotationComposer get packId {
final $$CardPacksTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.packId,
referencedTable: $db.cardPacks,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPacksTableAnnotationComposer(
$db: $db,
$table: $db.cardPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$GameCardsTableAnnotationComposer get cardId {
final $$GameCardsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableAnnotationComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$PreviewCardsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$PreviewCardsTable,
PreviewCard,
$$PreviewCardsTableFilterComposer,
$$PreviewCardsTableOrderingComposer,
$$PreviewCardsTableAnnotationComposer,
$$PreviewCardsTableCreateCompanionBuilder,
$$PreviewCardsTableUpdateCompanionBuilder,
(PreviewCard, $$PreviewCardsTableReferences),
PreviewCard,
PrefetchHooks Function({bool packId, bool cardId})
> {
$$PreviewCardsTableTableManager(_$AppDatabase db, $PreviewCardsTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$PreviewCardsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$PreviewCardsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$PreviewCardsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> packId = const Value.absent(),
Value<String> cardId = const Value.absent(),
Value<int> order = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => PreviewCardsCompanion(
packId: packId,
cardId: cardId,
order: order,
rowid: rowid,
),
createCompanionCallback:
({
required String packId,
required String cardId,
Value<int> order = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => PreviewCardsCompanion.insert(
packId: packId,
cardId: cardId,
order: order,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$PreviewCardsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({packId = false, cardId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (packId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.packId,
referencedTable: $$PreviewCardsTableReferences
._packIdTable(db),
referencedColumn: $$PreviewCardsTableReferences
._packIdTable(db)
.id,
)
as T;
}
if (cardId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.cardId,
referencedTable: $$PreviewCardsTableReferences
._cardIdTable(db),
referencedColumn: $$PreviewCardsTableReferences
._cardIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$PreviewCardsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$PreviewCardsTable,
PreviewCard,
$$PreviewCardsTableFilterComposer,
$$PreviewCardsTableOrderingComposer,
$$PreviewCardsTableAnnotationComposer,
$$PreviewCardsTableCreateCompanionBuilder,
$$PreviewCardsTableUpdateCompanionBuilder,
(PreviewCard, $$PreviewCardsTableReferences),
PreviewCard,
PrefetchHooks Function({bool packId, bool cardId})
>;
typedef $$CardPackCardsTableCreateCompanionBuilder =
CardPackCardsCompanion Function({
required String packId,
required String cardId,
Value<int> order,
Value<int> rowid,
});
typedef $$CardPackCardsTableUpdateCompanionBuilder =
CardPackCardsCompanion Function({
Value<String> packId,
Value<String> cardId,
Value<int> order,
Value<int> rowid,
});
final class $$CardPackCardsTableReferences
extends BaseReferences<_$AppDatabase, $CardPackCardsTable, CardPackCard> {
$$CardPackCardsTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static $CardPacksTable _packIdTable(_$AppDatabase db) =>
db.cardPacks.createAlias(
$_aliasNameGenerator(db.cardPackCards.packId, db.cardPacks.id),
);
$$CardPacksTableProcessedTableManager get packId {
final $_column = $_itemColumn<String>('pack_id')!;
final manager = $$CardPacksTableTableManager(
$_db,
$_db.cardPacks,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_packIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
static $GameCardsTable _cardIdTable(_$AppDatabase db) =>
db.gameCards.createAlias(
$_aliasNameGenerator(db.cardPackCards.cardId, db.gameCards.id),
);
$$GameCardsTableProcessedTableManager get cardId {
final $_column = $_itemColumn<String>('card_id')!;
final manager = $$GameCardsTableTableManager(
$_db,
$_db.gameCards,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_cardIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$CardPackCardsTableFilterComposer
extends Composer<_$AppDatabase, $CardPackCardsTable> {
$$CardPackCardsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<int> get order => $composableBuilder(
column: $table.order,
builder: (column) => ColumnFilters(column),
);
$$CardPacksTableFilterComposer get packId {
final $$CardPacksTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.packId,
referencedTable: $db.cardPacks,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPacksTableFilterComposer(
$db: $db,
$table: $db.cardPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$GameCardsTableFilterComposer get cardId {
final $$GameCardsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableFilterComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$CardPackCardsTableOrderingComposer
extends Composer<_$AppDatabase, $CardPackCardsTable> {
$$CardPackCardsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<int> get order => $composableBuilder(
column: $table.order,
builder: (column) => ColumnOrderings(column),
);
$$CardPacksTableOrderingComposer get packId {
final $$CardPacksTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.packId,
referencedTable: $db.cardPacks,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPacksTableOrderingComposer(
$db: $db,
$table: $db.cardPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$GameCardsTableOrderingComposer get cardId {
final $$GameCardsTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableOrderingComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$CardPackCardsTableAnnotationComposer
extends Composer<_$AppDatabase, $CardPackCardsTable> {
$$CardPackCardsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<int> get order =>
$composableBuilder(column: $table.order, builder: (column) => column);
$$CardPacksTableAnnotationComposer get packId {
final $$CardPacksTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.packId,
referencedTable: $db.cardPacks,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPacksTableAnnotationComposer(
$db: $db,
$table: $db.cardPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$GameCardsTableAnnotationComposer get cardId {
final $$GameCardsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableAnnotationComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$CardPackCardsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$CardPackCardsTable,
CardPackCard,
$$CardPackCardsTableFilterComposer,
$$CardPackCardsTableOrderingComposer,
$$CardPackCardsTableAnnotationComposer,
$$CardPackCardsTableCreateCompanionBuilder,
$$CardPackCardsTableUpdateCompanionBuilder,
(CardPackCard, $$CardPackCardsTableReferences),
CardPackCard,
PrefetchHooks Function({bool packId, bool cardId})
> {
$$CardPackCardsTableTableManager(_$AppDatabase db, $CardPackCardsTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$CardPackCardsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$CardPackCardsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$CardPackCardsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> packId = const Value.absent(),
Value<String> cardId = const Value.absent(),
Value<int> order = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => CardPackCardsCompanion(
packId: packId,
cardId: cardId,
order: order,
rowid: rowid,
),
createCompanionCallback:
({
required String packId,
required String cardId,
Value<int> order = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => CardPackCardsCompanion.insert(
packId: packId,
cardId: cardId,
order: order,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$CardPackCardsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({packId = false, cardId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (packId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.packId,
referencedTable: $$CardPackCardsTableReferences
._packIdTable(db),
referencedColumn: $$CardPackCardsTableReferences
._packIdTable(db)
.id,
)
as T;
}
if (cardId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.cardId,
referencedTable: $$CardPackCardsTableReferences
._cardIdTable(db),
referencedColumn: $$CardPackCardsTableReferences
._cardIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$CardPackCardsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$CardPackCardsTable,
CardPackCard,
$$CardPackCardsTableFilterComposer,
$$CardPackCardsTableOrderingComposer,
$$CardPackCardsTableAnnotationComposer,
$$CardPackCardsTableCreateCompanionBuilder,
$$CardPackCardsTableUpdateCompanionBuilder,
(CardPackCard, $$CardPackCardsTableReferences),
CardPackCard,
PrefetchHooks Function({bool packId, bool cardId})
>;
typedef $$CardVoicesTableCreateCompanionBuilder =
CardVoicesCompanion Function({
required String cardId,
required String voiceId,
Value<int> rowid,
});
typedef $$CardVoicesTableUpdateCompanionBuilder =
CardVoicesCompanion Function({
Value<String> cardId,
Value<String> voiceId,
Value<int> rowid,
});
final class $$CardVoicesTableReferences
extends BaseReferences<_$AppDatabase, $CardVoicesTable, CardVoice> {
$$CardVoicesTableReferences(super.$_db, super.$_table, super.$_typedResult);
static $GameCardsTable _cardIdTable(_$AppDatabase db) => db.gameCards
.createAlias($_aliasNameGenerator(db.cardVoices.cardId, db.gameCards.id));
$$GameCardsTableProcessedTableManager get cardId {
final $_column = $_itemColumn<String>('card_id')!;
final manager = $$GameCardsTableTableManager(
$_db,
$_db.gameCards,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_cardIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
static $VoiceModelsTable _voiceIdTable(_$AppDatabase db) =>
db.voiceModels.createAlias(
$_aliasNameGenerator(db.cardVoices.voiceId, db.voiceModels.id),
);
$$VoiceModelsTableProcessedTableManager get voiceId {
final $_column = $_itemColumn<String>('voice_id')!;
final manager = $$VoiceModelsTableTableManager(
$_db,
$_db.voiceModels,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_voiceIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$CardVoicesTableFilterComposer
extends Composer<_$AppDatabase, $CardVoicesTable> {
$$CardVoicesTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
$$GameCardsTableFilterComposer get cardId {
final $$GameCardsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableFilterComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$VoiceModelsTableFilterComposer get voiceId {
final $$VoiceModelsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.voiceId,
referencedTable: $db.voiceModels,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$VoiceModelsTableFilterComposer(
$db: $db,
$table: $db.voiceModels,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$CardVoicesTableOrderingComposer
extends Composer<_$AppDatabase, $CardVoicesTable> {
$$CardVoicesTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
$$GameCardsTableOrderingComposer get cardId {
final $$GameCardsTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableOrderingComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$VoiceModelsTableOrderingComposer get voiceId {
final $$VoiceModelsTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.voiceId,
referencedTable: $db.voiceModels,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$VoiceModelsTableOrderingComposer(
$db: $db,
$table: $db.voiceModels,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$CardVoicesTableAnnotationComposer
extends Composer<_$AppDatabase, $CardVoicesTable> {
$$CardVoicesTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
$$GameCardsTableAnnotationComposer get cardId {
final $$GameCardsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableAnnotationComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$VoiceModelsTableAnnotationComposer get voiceId {
final $$VoiceModelsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.voiceId,
referencedTable: $db.voiceModels,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$VoiceModelsTableAnnotationComposer(
$db: $db,
$table: $db.voiceModels,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$CardVoicesTableTableManager
extends
RootTableManager<
_$AppDatabase,
$CardVoicesTable,
CardVoice,
$$CardVoicesTableFilterComposer,
$$CardVoicesTableOrderingComposer,
$$CardVoicesTableAnnotationComposer,
$$CardVoicesTableCreateCompanionBuilder,
$$CardVoicesTableUpdateCompanionBuilder,
(CardVoice, $$CardVoicesTableReferences),
CardVoice,
PrefetchHooks Function({bool cardId, bool voiceId})
> {
$$CardVoicesTableTableManager(_$AppDatabase db, $CardVoicesTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$CardVoicesTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$CardVoicesTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$CardVoicesTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> cardId = const Value.absent(),
Value<String> voiceId = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => CardVoicesCompanion(
cardId: cardId,
voiceId: voiceId,
rowid: rowid,
),
createCompanionCallback:
({
required String cardId,
required String voiceId,
Value<int> rowid = const Value.absent(),
}) => CardVoicesCompanion.insert(
cardId: cardId,
voiceId: voiceId,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$CardVoicesTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({cardId = false, voiceId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (cardId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.cardId,
referencedTable: $$CardVoicesTableReferences
._cardIdTable(db),
referencedColumn: $$CardVoicesTableReferences
._cardIdTable(db)
.id,
)
as T;
}
if (voiceId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.voiceId,
referencedTable: $$CardVoicesTableReferences
._voiceIdTable(db),
referencedColumn: $$CardVoicesTableReferences
._voiceIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$CardVoicesTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$CardVoicesTable,
CardVoice,
$$CardVoicesTableFilterComposer,
$$CardVoicesTableOrderingComposer,
$$CardVoicesTableAnnotationComposer,
$$CardVoicesTableCreateCompanionBuilder,
$$CardVoicesTableUpdateCompanionBuilder,
(CardVoice, $$CardVoicesTableReferences),
CardVoice,
PrefetchHooks Function({bool cardId, bool voiceId})
>;
typedef $$SubscriptionPlansTableCreateCompanionBuilder =
SubscriptionPlansCompanion Function({
Value<String> id,
Value<Map<String, dynamic>?> ui,
required String price,
required String currency,
required int durationDays,
Value<List<dynamic>> features,
Value<String?> paymentId,
required String paymentSystem,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<int> rowid,
});
typedef $$SubscriptionPlansTableUpdateCompanionBuilder =
SubscriptionPlansCompanion Function({
Value<String> id,
Value<Map<String, dynamic>?> ui,
Value<String> price,
Value<String> currency,
Value<int> durationDays,
Value<List<dynamic>> features,
Value<String?> paymentId,
Value<String> paymentSystem,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<int> rowid,
});
class $$SubscriptionPlansTableFilterComposer
extends Composer<_$AppDatabase, $SubscriptionPlansTable> {
$$SubscriptionPlansTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<
Map<String, dynamic>?,
Map<String, dynamic>,
String
>
get ui => $composableBuilder(
column: $table.ui,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<String> get price => $composableBuilder(
column: $table.price,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get currency => $composableBuilder(
column: $table.currency,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get durationDays => $composableBuilder(
column: $table.durationDays,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<List<dynamic>, List<dynamic>, String>
get features => $composableBuilder(
column: $table.features,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<String> get paymentId => $composableBuilder(
column: $table.paymentId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get paymentSystem => $composableBuilder(
column: $table.paymentSystem,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
}
class $$SubscriptionPlansTableOrderingComposer
extends Composer<_$AppDatabase, $SubscriptionPlansTable> {
$$SubscriptionPlansTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get ui => $composableBuilder(
column: $table.ui,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get price => $composableBuilder(
column: $table.price,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get currency => $composableBuilder(
column: $table.currency,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get durationDays => $composableBuilder(
column: $table.durationDays,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get features => $composableBuilder(
column: $table.features,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get paymentId => $composableBuilder(
column: $table.paymentId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get paymentSystem => $composableBuilder(
column: $table.paymentSystem,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
}
class $$SubscriptionPlansTableAnnotationComposer
extends Composer<_$AppDatabase, $SubscriptionPlansTable> {
$$SubscriptionPlansTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumnWithTypeConverter<Map<String, dynamic>?, String> get ui =>
$composableBuilder(column: $table.ui, builder: (column) => column);
GeneratedColumn<String> get price =>
$composableBuilder(column: $table.price, builder: (column) => column);
GeneratedColumn<String> get currency =>
$composableBuilder(column: $table.currency, builder: (column) => column);
GeneratedColumn<int> get durationDays => $composableBuilder(
column: $table.durationDays,
builder: (column) => column,
);
GeneratedColumnWithTypeConverter<List<dynamic>, String> get features =>
$composableBuilder(column: $table.features, builder: (column) => column);
GeneratedColumn<String> get paymentId =>
$composableBuilder(column: $table.paymentId, builder: (column) => column);
GeneratedColumn<String> get paymentSystem => $composableBuilder(
column: $table.paymentSystem,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
}
class $$SubscriptionPlansTableTableManager
extends
RootTableManager<
_$AppDatabase,
$SubscriptionPlansTable,
SubscriptionPlan,
$$SubscriptionPlansTableFilterComposer,
$$SubscriptionPlansTableOrderingComposer,
$$SubscriptionPlansTableAnnotationComposer,
$$SubscriptionPlansTableCreateCompanionBuilder,
$$SubscriptionPlansTableUpdateCompanionBuilder,
(
SubscriptionPlan,
BaseReferences<
_$AppDatabase,
$SubscriptionPlansTable,
SubscriptionPlan
>,
),
SubscriptionPlan,
PrefetchHooks Function()
> {
$$SubscriptionPlansTableTableManager(
_$AppDatabase db,
$SubscriptionPlansTable table,
) : super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$SubscriptionPlansTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$SubscriptionPlansTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$SubscriptionPlansTableAnnotationComposer(
$db: db,
$table: table,
),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<Map<String, dynamic>?> ui = const Value.absent(),
Value<String> price = const Value.absent(),
Value<String> currency = const Value.absent(),
Value<int> durationDays = const Value.absent(),
Value<List<dynamic>> features = const Value.absent(),
Value<String?> paymentId = const Value.absent(),
Value<String> paymentSystem = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => SubscriptionPlansCompanion(
id: id,
ui: ui,
price: price,
currency: currency,
durationDays: durationDays,
features: features,
paymentId: paymentId,
paymentSystem: paymentSystem,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<Map<String, dynamic>?> ui = const Value.absent(),
required String price,
required String currency,
required int durationDays,
Value<List<dynamic>> features = const Value.absent(),
Value<String?> paymentId = const Value.absent(),
required String paymentSystem,
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => SubscriptionPlansCompanion.insert(
id: id,
ui: ui,
price: price,
currency: currency,
durationDays: durationDays,
features: features,
paymentId: paymentId,
paymentSystem: paymentSystem,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
),
);
}
typedef $$SubscriptionPlansTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$SubscriptionPlansTable,
SubscriptionPlan,
$$SubscriptionPlansTableFilterComposer,
$$SubscriptionPlansTableOrderingComposer,
$$SubscriptionPlansTableAnnotationComposer,
$$SubscriptionPlansTableCreateCompanionBuilder,
$$SubscriptionPlansTableUpdateCompanionBuilder,
(
SubscriptionPlan,
BaseReferences<
_$AppDatabase,
$SubscriptionPlansTable,
SubscriptionPlan
>,
),
SubscriptionPlan,
PrefetchHooks Function()
>;
typedef $$UserSubscriptionsTableCreateCompanionBuilder =
UserSubscriptionsCompanion Function({
Value<String> id,
required String userId,
required PgDateTime start,
required PgDateTime finish,
Value<List<dynamic>> features,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
typedef $$UserSubscriptionsTableUpdateCompanionBuilder =
UserSubscriptionsCompanion Function({
Value<String> id,
Value<String> userId,
Value<PgDateTime> start,
Value<PgDateTime> finish,
Value<List<dynamic>> features,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
final class $$UserSubscriptionsTableReferences
extends
BaseReferences<
_$AppDatabase,
$UserSubscriptionsTable,
UserSubscription
> {
$$UserSubscriptionsTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
$_aliasNameGenerator(db.userSubscriptions.userId, db.users.id),
);
$$UsersTableProcessedTableManager get userId {
final $_column = $_itemColumn<String>('user_id')!;
final manager = $$UsersTableTableManager(
$_db,
$_db.users,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$UserSubscriptionsTableFilterComposer
extends Composer<_$AppDatabase, $UserSubscriptionsTable> {
$$UserSubscriptionsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get start => $composableBuilder(
column: $table.start,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get finish => $composableBuilder(
column: $table.finish,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<List<dynamic>, List<dynamic>, String>
get features => $composableBuilder(
column: $table.features,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
$$UsersTableFilterComposer get userId {
final $$UsersTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableFilterComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserSubscriptionsTableOrderingComposer
extends Composer<_$AppDatabase, $UserSubscriptionsTable> {
$$UserSubscriptionsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get start => $composableBuilder(
column: $table.start,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get finish => $composableBuilder(
column: $table.finish,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get features => $composableBuilder(
column: $table.features,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
$$UsersTableOrderingComposer get userId {
final $$UsersTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableOrderingComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserSubscriptionsTableAnnotationComposer
extends Composer<_$AppDatabase, $UserSubscriptionsTable> {
$$UserSubscriptionsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<PgDateTime> get start =>
$composableBuilder(column: $table.start, builder: (column) => column);
GeneratedColumn<PgDateTime> get finish =>
$composableBuilder(column: $table.finish, builder: (column) => column);
GeneratedColumnWithTypeConverter<List<dynamic>, String> get features =>
$composableBuilder(column: $table.features, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
$$UsersTableAnnotationComposer get userId {
final $$UsersTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableAnnotationComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserSubscriptionsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$UserSubscriptionsTable,
UserSubscription,
$$UserSubscriptionsTableFilterComposer,
$$UserSubscriptionsTableOrderingComposer,
$$UserSubscriptionsTableAnnotationComposer,
$$UserSubscriptionsTableCreateCompanionBuilder,
$$UserSubscriptionsTableUpdateCompanionBuilder,
(UserSubscription, $$UserSubscriptionsTableReferences),
UserSubscription,
PrefetchHooks Function({bool userId})
> {
$$UserSubscriptionsTableTableManager(
_$AppDatabase db,
$UserSubscriptionsTable table,
) : super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$UserSubscriptionsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$UserSubscriptionsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$UserSubscriptionsTableAnnotationComposer(
$db: db,
$table: table,
),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> userId = const Value.absent(),
Value<PgDateTime> start = const Value.absent(),
Value<PgDateTime> finish = const Value.absent(),
Value<List<dynamic>> features = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserSubscriptionsCompanion(
id: id,
userId: userId,
start: start,
finish: finish,
features: features,
createdAt: createdAt,
updatedAt: updatedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String userId,
required PgDateTime start,
required PgDateTime finish,
Value<List<dynamic>> features = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserSubscriptionsCompanion.insert(
id: id,
userId: userId,
start: start,
finish: finish,
features: features,
createdAt: createdAt,
updatedAt: updatedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$UserSubscriptionsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({userId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (userId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.userId,
referencedTable:
$$UserSubscriptionsTableReferences
._userIdTable(db),
referencedColumn:
$$UserSubscriptionsTableReferences
._userIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$UserSubscriptionsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$UserSubscriptionsTable,
UserSubscription,
$$UserSubscriptionsTableFilterComposer,
$$UserSubscriptionsTableOrderingComposer,
$$UserSubscriptionsTableAnnotationComposer,
$$UserSubscriptionsTableCreateCompanionBuilder,
$$UserSubscriptionsTableUpdateCompanionBuilder,
(UserSubscription, $$UserSubscriptionsTableReferences),
UserSubscription,
PrefetchHooks Function({bool userId})
>;
typedef $$PaymentsTableCreateCompanionBuilder =
PaymentsCompanion Function({
Value<String> id,
required String userId,
required String amount,
required String currency,
required String status,
required String paymentSystem,
Value<String?> externalToken,
Value<String?> meta,
Value<PgDateTime> date,
Value<List<dynamic>> products,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
typedef $$PaymentsTableUpdateCompanionBuilder =
PaymentsCompanion Function({
Value<String> id,
Value<String> userId,
Value<String> amount,
Value<String> currency,
Value<String> status,
Value<String> paymentSystem,
Value<String?> externalToken,
Value<String?> meta,
Value<PgDateTime> date,
Value<List<dynamic>> products,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
final class $$PaymentsTableReferences
extends BaseReferences<_$AppDatabase, $PaymentsTable, Payment> {
$$PaymentsTableReferences(super.$_db, super.$_table, super.$_typedResult);
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
$_aliasNameGenerator(db.payments.userId, db.users.id),
);
$$UsersTableProcessedTableManager get userId {
final $_column = $_itemColumn<String>('user_id')!;
final manager = $$UsersTableTableManager(
$_db,
$_db.users,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$PaymentsTableFilterComposer
extends Composer<_$AppDatabase, $PaymentsTable> {
$$PaymentsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get amount => $composableBuilder(
column: $table.amount,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get currency => $composableBuilder(
column: $table.currency,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get status => $composableBuilder(
column: $table.status,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get paymentSystem => $composableBuilder(
column: $table.paymentSystem,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get externalToken => $composableBuilder(
column: $table.externalToken,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get meta => $composableBuilder(
column: $table.meta,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get date => $composableBuilder(
column: $table.date,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<List<dynamic>, List<dynamic>, String>
get products => $composableBuilder(
column: $table.products,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnFilters(column),
);
$$UsersTableFilterComposer get userId {
final $$UsersTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableFilterComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$PaymentsTableOrderingComposer
extends Composer<_$AppDatabase, $PaymentsTable> {
$$PaymentsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get amount => $composableBuilder(
column: $table.amount,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get currency => $composableBuilder(
column: $table.currency,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get status => $composableBuilder(
column: $table.status,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get paymentSystem => $composableBuilder(
column: $table.paymentSystem,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get externalToken => $composableBuilder(
column: $table.externalToken,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get meta => $composableBuilder(
column: $table.meta,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get date => $composableBuilder(
column: $table.date,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get products => $composableBuilder(
column: $table.products,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnOrderings(column),
);
$$UsersTableOrderingComposer get userId {
final $$UsersTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableOrderingComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$PaymentsTableAnnotationComposer
extends Composer<_$AppDatabase, $PaymentsTable> {
$$PaymentsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get amount =>
$composableBuilder(column: $table.amount, builder: (column) => column);
GeneratedColumn<String> get currency =>
$composableBuilder(column: $table.currency, builder: (column) => column);
GeneratedColumn<String> get status =>
$composableBuilder(column: $table.status, builder: (column) => column);
GeneratedColumn<String> get paymentSystem => $composableBuilder(
column: $table.paymentSystem,
builder: (column) => column,
);
GeneratedColumn<String> get externalToken => $composableBuilder(
column: $table.externalToken,
builder: (column) => column,
);
GeneratedColumn<String> get meta =>
$composableBuilder(column: $table.meta, builder: (column) => column);
GeneratedColumn<PgDateTime> get date =>
$composableBuilder(column: $table.date, builder: (column) => column);
GeneratedColumnWithTypeConverter<List<dynamic>, String> get products =>
$composableBuilder(column: $table.products, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
GeneratedColumn<PgDateTime> get deletedAt =>
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
$$UsersTableAnnotationComposer get userId {
final $$UsersTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableAnnotationComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$PaymentsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$PaymentsTable,
Payment,
$$PaymentsTableFilterComposer,
$$PaymentsTableOrderingComposer,
$$PaymentsTableAnnotationComposer,
$$PaymentsTableCreateCompanionBuilder,
$$PaymentsTableUpdateCompanionBuilder,
(Payment, $$PaymentsTableReferences),
Payment,
PrefetchHooks Function({bool userId})
> {
$$PaymentsTableTableManager(_$AppDatabase db, $PaymentsTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$PaymentsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$PaymentsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$PaymentsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> userId = const Value.absent(),
Value<String> amount = const Value.absent(),
Value<String> currency = const Value.absent(),
Value<String> status = const Value.absent(),
Value<String> paymentSystem = const Value.absent(),
Value<String?> externalToken = const Value.absent(),
Value<String?> meta = const Value.absent(),
Value<PgDateTime> date = const Value.absent(),
Value<List<dynamic>> products = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => PaymentsCompanion(
id: id,
userId: userId,
amount: amount,
currency: currency,
status: status,
paymentSystem: paymentSystem,
externalToken: externalToken,
meta: meta,
date: date,
products: products,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String userId,
required String amount,
required String currency,
required String status,
required String paymentSystem,
Value<String?> externalToken = const Value.absent(),
Value<String?> meta = const Value.absent(),
Value<PgDateTime> date = const Value.absent(),
Value<List<dynamic>> products = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => PaymentsCompanion.insert(
id: id,
userId: userId,
amount: amount,
currency: currency,
status: status,
paymentSystem: paymentSystem,
externalToken: externalToken,
meta: meta,
date: date,
products: products,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$PaymentsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({userId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (userId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.userId,
referencedTable: $$PaymentsTableReferences
._userIdTable(db),
referencedColumn: $$PaymentsTableReferences
._userIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$PaymentsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$PaymentsTable,
Payment,
$$PaymentsTableFilterComposer,
$$PaymentsTableOrderingComposer,
$$PaymentsTableAnnotationComposer,
$$PaymentsTableCreateCompanionBuilder,
$$PaymentsTableUpdateCompanionBuilder,
(Payment, $$PaymentsTableReferences),
Payment,
PrefetchHooks Function({bool userId})
>;
typedef $$TestsTableCreateCompanionBuilder =
TestsCompanion Function({
Value<String> id,
required String name,
Value<String?> color,
Value<String?> cover,
Value<String?> version,
Value<String?> time,
Value<String?> timeSubtitle,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
typedef $$TestsTableUpdateCompanionBuilder =
TestsCompanion Function({
Value<String> id,
Value<String> name,
Value<String?> color,
Value<String?> cover,
Value<String?> version,
Value<String?> time,
Value<String?> timeSubtitle,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
final class $$TestsTableReferences
extends BaseReferences<_$AppDatabase, $TestsTable, Test> {
$$TestsTableReferences(super.$_db, super.$_table, super.$_typedResult);
static MultiTypedResultKey<$TestQuestionsTable, List<TestQuestion>>
_testQuestionsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.testQuestions,
aliasName: $_aliasNameGenerator(db.tests.id, db.testQuestions.testId),
);
$$TestQuestionsTableProcessedTableManager get testQuestionsRefs {
final manager = $$TestQuestionsTableTableManager(
$_db,
$_db.testQuestions,
).filter((f) => f.testId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_testQuestionsRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$TestPackRelationsTable, List<TestPackRelation>>
_testPackRelationsRefsTable(_$AppDatabase db) =>
MultiTypedResultKey.fromTable(
db.testPackRelations,
aliasName: $_aliasNameGenerator(
db.tests.id,
db.testPackRelations.testId,
),
);
$$TestPackRelationsTableProcessedTableManager get testPackRelationsRefs {
final manager = $$TestPackRelationsTableTableManager(
$_db,
$_db.testPackRelations,
).filter((f) => f.testId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(
_testPackRelationsRefsTable($_db),
);
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
static MultiTypedResultKey<$TestStatisticsTable, List<TestStatistic>>
_testStatisticsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.testStatistics,
aliasName: $_aliasNameGenerator(db.tests.id, db.testStatistics.testId),
);
$$TestStatisticsTableProcessedTableManager get testStatisticsRefs {
final manager = $$TestStatisticsTableTableManager(
$_db,
$_db.testStatistics,
).filter((f) => f.testId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_testStatisticsRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
}
class $$TestsTableFilterComposer extends Composer<_$AppDatabase, $TestsTable> {
$$TestsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get name => $composableBuilder(
column: $table.name,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get color => $composableBuilder(
column: $table.color,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get cover => $composableBuilder(
column: $table.cover,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get version => $composableBuilder(
column: $table.version,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get time => $composableBuilder(
column: $table.time,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get timeSubtitle => $composableBuilder(
column: $table.timeSubtitle,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnFilters(column),
);
Expression<bool> testQuestionsRefs(
Expression<bool> Function($$TestQuestionsTableFilterComposer f) f,
) {
final $$TestQuestionsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.testQuestions,
getReferencedColumn: (t) => t.testId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestQuestionsTableFilterComposer(
$db: $db,
$table: $db.testQuestions,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> testPackRelationsRefs(
Expression<bool> Function($$TestPackRelationsTableFilterComposer f) f,
) {
final $$TestPackRelationsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.testPackRelations,
getReferencedColumn: (t) => t.testId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestPackRelationsTableFilterComposer(
$db: $db,
$table: $db.testPackRelations,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<bool> testStatisticsRefs(
Expression<bool> Function($$TestStatisticsTableFilterComposer f) f,
) {
final $$TestStatisticsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.testStatistics,
getReferencedColumn: (t) => t.testId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestStatisticsTableFilterComposer(
$db: $db,
$table: $db.testStatistics,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$TestsTableOrderingComposer
extends Composer<_$AppDatabase, $TestsTable> {
$$TestsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get name => $composableBuilder(
column: $table.name,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get color => $composableBuilder(
column: $table.color,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get cover => $composableBuilder(
column: $table.cover,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get version => $composableBuilder(
column: $table.version,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get time => $composableBuilder(
column: $table.time,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get timeSubtitle => $composableBuilder(
column: $table.timeSubtitle,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnOrderings(column),
);
}
class $$TestsTableAnnotationComposer
extends Composer<_$AppDatabase, $TestsTable> {
$$TestsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get name =>
$composableBuilder(column: $table.name, builder: (column) => column);
GeneratedColumn<String> get color =>
$composableBuilder(column: $table.color, builder: (column) => column);
GeneratedColumn<String> get cover =>
$composableBuilder(column: $table.cover, builder: (column) => column);
GeneratedColumn<String> get version =>
$composableBuilder(column: $table.version, builder: (column) => column);
GeneratedColumn<String> get time =>
$composableBuilder(column: $table.time, builder: (column) => column);
GeneratedColumn<String> get timeSubtitle => $composableBuilder(
column: $table.timeSubtitle,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
GeneratedColumn<PgDateTime> get deletedAt =>
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
Expression<T> testQuestionsRefs<T extends Object>(
Expression<T> Function($$TestQuestionsTableAnnotationComposer a) f,
) {
final $$TestQuestionsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.testQuestions,
getReferencedColumn: (t) => t.testId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestQuestionsTableAnnotationComposer(
$db: $db,
$table: $db.testQuestions,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> testPackRelationsRefs<T extends Object>(
Expression<T> Function($$TestPackRelationsTableAnnotationComposer a) f,
) {
final $$TestPackRelationsTableAnnotationComposer composer =
$composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.testPackRelations,
getReferencedColumn: (t) => t.testId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestPackRelationsTableAnnotationComposer(
$db: $db,
$table: $db.testPackRelations,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
Expression<T> testStatisticsRefs<T extends Object>(
Expression<T> Function($$TestStatisticsTableAnnotationComposer a) f,
) {
final $$TestStatisticsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.testStatistics,
getReferencedColumn: (t) => t.testId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestStatisticsTableAnnotationComposer(
$db: $db,
$table: $db.testStatistics,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$TestsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$TestsTable,
Test,
$$TestsTableFilterComposer,
$$TestsTableOrderingComposer,
$$TestsTableAnnotationComposer,
$$TestsTableCreateCompanionBuilder,
$$TestsTableUpdateCompanionBuilder,
(Test, $$TestsTableReferences),
Test,
PrefetchHooks Function({
bool testQuestionsRefs,
bool testPackRelationsRefs,
bool testStatisticsRefs,
})
> {
$$TestsTableTableManager(_$AppDatabase db, $TestsTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$TestsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$TestsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$TestsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> name = const Value.absent(),
Value<String?> color = const Value.absent(),
Value<String?> cover = const Value.absent(),
Value<String?> version = const Value.absent(),
Value<String?> time = const Value.absent(),
Value<String?> timeSubtitle = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => TestsCompanion(
id: id,
name: name,
color: color,
cover: cover,
version: version,
time: time,
timeSubtitle: timeSubtitle,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String name,
Value<String?> color = const Value.absent(),
Value<String?> cover = const Value.absent(),
Value<String?> version = const Value.absent(),
Value<String?> time = const Value.absent(),
Value<String?> timeSubtitle = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => TestsCompanion.insert(
id: id,
name: name,
color: color,
cover: cover,
version: version,
time: time,
timeSubtitle: timeSubtitle,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) =>
(e.readTable(table), $$TestsTableReferences(db, table, e)),
)
.toList(),
prefetchHooksCallback:
({
testQuestionsRefs = false,
testPackRelationsRefs = false,
testStatisticsRefs = false,
}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [
if (testQuestionsRefs) db.testQuestions,
if (testPackRelationsRefs) db.testPackRelations,
if (testStatisticsRefs) db.testStatistics,
],
addJoins: null,
getPrefetchedDataCallback: (items) async {
return [
if (testQuestionsRefs)
await $_getPrefetchedData<
Test,
$TestsTable,
TestQuestion
>(
currentTable: table,
referencedTable: $$TestsTableReferences
._testQuestionsRefsTable(db),
managerFromTypedResult: (p0) =>
$$TestsTableReferences(
db,
table,
p0,
).testQuestionsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.testId == item.id,
),
typedResults: items,
),
if (testPackRelationsRefs)
await $_getPrefetchedData<
Test,
$TestsTable,
TestPackRelation
>(
currentTable: table,
referencedTable: $$TestsTableReferences
._testPackRelationsRefsTable(db),
managerFromTypedResult: (p0) =>
$$TestsTableReferences(
db,
table,
p0,
).testPackRelationsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.testId == item.id,
),
typedResults: items,
),
if (testStatisticsRefs)
await $_getPrefetchedData<
Test,
$TestsTable,
TestStatistic
>(
currentTable: table,
referencedTable: $$TestsTableReferences
._testStatisticsRefsTable(db),
managerFromTypedResult: (p0) =>
$$TestsTableReferences(
db,
table,
p0,
).testStatisticsRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.testId == item.id,
),
typedResults: items,
),
];
},
);
},
),
);
}
typedef $$TestsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$TestsTable,
Test,
$$TestsTableFilterComposer,
$$TestsTableOrderingComposer,
$$TestsTableAnnotationComposer,
$$TestsTableCreateCompanionBuilder,
$$TestsTableUpdateCompanionBuilder,
(Test, $$TestsTableReferences),
Test,
PrefetchHooks Function({
bool testQuestionsRefs,
bool testPackRelationsRefs,
bool testStatisticsRefs,
})
>;
typedef $$TestQuestionsTableCreateCompanionBuilder =
TestQuestionsCompanion Function({
Value<String> id,
required String testId,
Value<int> orderIndex,
required String questionType,
required String word,
required String answer,
Value<String> options,
Value<String> uiData,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
typedef $$TestQuestionsTableUpdateCompanionBuilder =
TestQuestionsCompanion Function({
Value<String> id,
Value<String> testId,
Value<int> orderIndex,
Value<String> questionType,
Value<String> word,
Value<String> answer,
Value<String> options,
Value<String> uiData,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
final class $$TestQuestionsTableReferences
extends BaseReferences<_$AppDatabase, $TestQuestionsTable, TestQuestion> {
$$TestQuestionsTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static $TestsTable _testIdTable(_$AppDatabase db) => db.tests.createAlias(
$_aliasNameGenerator(db.testQuestions.testId, db.tests.id),
);
$$TestsTableProcessedTableManager get testId {
final $_column = $_itemColumn<String>('test_id')!;
final manager = $$TestsTableTableManager(
$_db,
$_db.tests,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_testIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$TestQuestionsTableFilterComposer
extends Composer<_$AppDatabase, $TestQuestionsTable> {
$$TestQuestionsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get orderIndex => $composableBuilder(
column: $table.orderIndex,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get questionType => $composableBuilder(
column: $table.questionType,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get word => $composableBuilder(
column: $table.word,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get answer => $composableBuilder(
column: $table.answer,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get options => $composableBuilder(
column: $table.options,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get uiData => $composableBuilder(
column: $table.uiData,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnFilters(column),
);
$$TestsTableFilterComposer get testId {
final $$TestsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.testId,
referencedTable: $db.tests,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestsTableFilterComposer(
$db: $db,
$table: $db.tests,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$TestQuestionsTableOrderingComposer
extends Composer<_$AppDatabase, $TestQuestionsTable> {
$$TestQuestionsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get orderIndex => $composableBuilder(
column: $table.orderIndex,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get questionType => $composableBuilder(
column: $table.questionType,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get word => $composableBuilder(
column: $table.word,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get answer => $composableBuilder(
column: $table.answer,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get options => $composableBuilder(
column: $table.options,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get uiData => $composableBuilder(
column: $table.uiData,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnOrderings(column),
);
$$TestsTableOrderingComposer get testId {
final $$TestsTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.testId,
referencedTable: $db.tests,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestsTableOrderingComposer(
$db: $db,
$table: $db.tests,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$TestQuestionsTableAnnotationComposer
extends Composer<_$AppDatabase, $TestQuestionsTable> {
$$TestQuestionsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<int> get orderIndex => $composableBuilder(
column: $table.orderIndex,
builder: (column) => column,
);
GeneratedColumn<String> get questionType => $composableBuilder(
column: $table.questionType,
builder: (column) => column,
);
GeneratedColumn<String> get word =>
$composableBuilder(column: $table.word, builder: (column) => column);
GeneratedColumn<String> get answer =>
$composableBuilder(column: $table.answer, builder: (column) => column);
GeneratedColumn<String> get options =>
$composableBuilder(column: $table.options, builder: (column) => column);
GeneratedColumn<String> get uiData =>
$composableBuilder(column: $table.uiData, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
GeneratedColumn<PgDateTime> get deletedAt =>
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
$$TestsTableAnnotationComposer get testId {
final $$TestsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.testId,
referencedTable: $db.tests,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestsTableAnnotationComposer(
$db: $db,
$table: $db.tests,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$TestQuestionsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$TestQuestionsTable,
TestQuestion,
$$TestQuestionsTableFilterComposer,
$$TestQuestionsTableOrderingComposer,
$$TestQuestionsTableAnnotationComposer,
$$TestQuestionsTableCreateCompanionBuilder,
$$TestQuestionsTableUpdateCompanionBuilder,
(TestQuestion, $$TestQuestionsTableReferences),
TestQuestion,
PrefetchHooks Function({bool testId})
> {
$$TestQuestionsTableTableManager(_$AppDatabase db, $TestQuestionsTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$TestQuestionsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$TestQuestionsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$TestQuestionsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> testId = const Value.absent(),
Value<int> orderIndex = const Value.absent(),
Value<String> questionType = const Value.absent(),
Value<String> word = const Value.absent(),
Value<String> answer = const Value.absent(),
Value<String> options = const Value.absent(),
Value<String> uiData = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => TestQuestionsCompanion(
id: id,
testId: testId,
orderIndex: orderIndex,
questionType: questionType,
word: word,
answer: answer,
options: options,
uiData: uiData,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String testId,
Value<int> orderIndex = const Value.absent(),
required String questionType,
required String word,
required String answer,
Value<String> options = const Value.absent(),
Value<String> uiData = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => TestQuestionsCompanion.insert(
id: id,
testId: testId,
orderIndex: orderIndex,
questionType: questionType,
word: word,
answer: answer,
options: options,
uiData: uiData,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$TestQuestionsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({testId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (testId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.testId,
referencedTable: $$TestQuestionsTableReferences
._testIdTable(db),
referencedColumn: $$TestQuestionsTableReferences
._testIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$TestQuestionsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$TestQuestionsTable,
TestQuestion,
$$TestQuestionsTableFilterComposer,
$$TestQuestionsTableOrderingComposer,
$$TestQuestionsTableAnnotationComposer,
$$TestQuestionsTableCreateCompanionBuilder,
$$TestQuestionsTableUpdateCompanionBuilder,
(TestQuestion, $$TestQuestionsTableReferences),
TestQuestion,
PrefetchHooks Function({bool testId})
>;
typedef $$TestPackRelationsTableCreateCompanionBuilder =
TestPackRelationsCompanion Function({
required String testId,
required String packId,
Value<int> rowid,
});
typedef $$TestPackRelationsTableUpdateCompanionBuilder =
TestPackRelationsCompanion Function({
Value<String> testId,
Value<String> packId,
Value<int> rowid,
});
final class $$TestPackRelationsTableReferences
extends
BaseReferences<
_$AppDatabase,
$TestPackRelationsTable,
TestPackRelation
> {
$$TestPackRelationsTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static $TestsTable _testIdTable(_$AppDatabase db) => db.tests.createAlias(
$_aliasNameGenerator(db.testPackRelations.testId, db.tests.id),
);
$$TestsTableProcessedTableManager get testId {
final $_column = $_itemColumn<String>('test_id')!;
final manager = $$TestsTableTableManager(
$_db,
$_db.tests,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_testIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
static $CardPacksTable _packIdTable(_$AppDatabase db) =>
db.cardPacks.createAlias(
$_aliasNameGenerator(db.testPackRelations.packId, db.cardPacks.id),
);
$$CardPacksTableProcessedTableManager get packId {
final $_column = $_itemColumn<String>('pack_id')!;
final manager = $$CardPacksTableTableManager(
$_db,
$_db.cardPacks,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_packIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$TestPackRelationsTableFilterComposer
extends Composer<_$AppDatabase, $TestPackRelationsTable> {
$$TestPackRelationsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
$$TestsTableFilterComposer get testId {
final $$TestsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.testId,
referencedTable: $db.tests,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestsTableFilterComposer(
$db: $db,
$table: $db.tests,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$CardPacksTableFilterComposer get packId {
final $$CardPacksTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.packId,
referencedTable: $db.cardPacks,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPacksTableFilterComposer(
$db: $db,
$table: $db.cardPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$TestPackRelationsTableOrderingComposer
extends Composer<_$AppDatabase, $TestPackRelationsTable> {
$$TestPackRelationsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
$$TestsTableOrderingComposer get testId {
final $$TestsTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.testId,
referencedTable: $db.tests,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestsTableOrderingComposer(
$db: $db,
$table: $db.tests,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$CardPacksTableOrderingComposer get packId {
final $$CardPacksTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.packId,
referencedTable: $db.cardPacks,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPacksTableOrderingComposer(
$db: $db,
$table: $db.cardPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$TestPackRelationsTableAnnotationComposer
extends Composer<_$AppDatabase, $TestPackRelationsTable> {
$$TestPackRelationsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
$$TestsTableAnnotationComposer get testId {
final $$TestsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.testId,
referencedTable: $db.tests,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestsTableAnnotationComposer(
$db: $db,
$table: $db.tests,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$CardPacksTableAnnotationComposer get packId {
final $$CardPacksTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.packId,
referencedTable: $db.cardPacks,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$CardPacksTableAnnotationComposer(
$db: $db,
$table: $db.cardPacks,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$TestPackRelationsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$TestPackRelationsTable,
TestPackRelation,
$$TestPackRelationsTableFilterComposer,
$$TestPackRelationsTableOrderingComposer,
$$TestPackRelationsTableAnnotationComposer,
$$TestPackRelationsTableCreateCompanionBuilder,
$$TestPackRelationsTableUpdateCompanionBuilder,
(TestPackRelation, $$TestPackRelationsTableReferences),
TestPackRelation,
PrefetchHooks Function({bool testId, bool packId})
> {
$$TestPackRelationsTableTableManager(
_$AppDatabase db,
$TestPackRelationsTable table,
) : super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$TestPackRelationsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$TestPackRelationsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$TestPackRelationsTableAnnotationComposer(
$db: db,
$table: table,
),
updateCompanionCallback:
({
Value<String> testId = const Value.absent(),
Value<String> packId = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => TestPackRelationsCompanion(
testId: testId,
packId: packId,
rowid: rowid,
),
createCompanionCallback:
({
required String testId,
required String packId,
Value<int> rowid = const Value.absent(),
}) => TestPackRelationsCompanion.insert(
testId: testId,
packId: packId,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$TestPackRelationsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({testId = false, packId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (testId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.testId,
referencedTable:
$$TestPackRelationsTableReferences
._testIdTable(db),
referencedColumn:
$$TestPackRelationsTableReferences
._testIdTable(db)
.id,
)
as T;
}
if (packId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.packId,
referencedTable:
$$TestPackRelationsTableReferences
._packIdTable(db),
referencedColumn:
$$TestPackRelationsTableReferences
._packIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$TestPackRelationsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$TestPackRelationsTable,
TestPackRelation,
$$TestPackRelationsTableFilterComposer,
$$TestPackRelationsTableOrderingComposer,
$$TestPackRelationsTableAnnotationComposer,
$$TestPackRelationsTableCreateCompanionBuilder,
$$TestPackRelationsTableUpdateCompanionBuilder,
(TestPackRelation, $$TestPackRelationsTableReferences),
TestPackRelation,
PrefetchHooks Function({bool testId, bool packId})
>;
typedef $$TestStatisticsTableCreateCompanionBuilder =
TestStatisticsCompanion Function({
Value<String> id,
required String userId,
required String testId,
Value<int> totalQuestions,
Value<int> correctAnswers,
Value<int> incorrectAnswers,
Value<int> skippedAnswers,
Value<double> scorePercentage,
Value<int?> timeSpentSeconds,
Value<String> questionResults,
Value<String> metadata,
Value<PgDateTime> completedAt,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
typedef $$TestStatisticsTableUpdateCompanionBuilder =
TestStatisticsCompanion Function({
Value<String> id,
Value<String> userId,
Value<String> testId,
Value<int> totalQuestions,
Value<int> correctAnswers,
Value<int> incorrectAnswers,
Value<int> skippedAnswers,
Value<double> scorePercentage,
Value<int?> timeSpentSeconds,
Value<String> questionResults,
Value<String> metadata,
Value<PgDateTime> completedAt,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
final class $$TestStatisticsTableReferences
extends BaseReferences<_$AppDatabase, $TestStatisticsTable, TestStatistic> {
$$TestStatisticsTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static $TestsTable _testIdTable(_$AppDatabase db) => db.tests.createAlias(
$_aliasNameGenerator(db.testStatistics.testId, db.tests.id),
);
$$TestsTableProcessedTableManager get testId {
final $_column = $_itemColumn<String>('test_id')!;
final manager = $$TestsTableTableManager(
$_db,
$_db.tests,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_testIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$TestStatisticsTableFilterComposer
extends Composer<_$AppDatabase, $TestStatisticsTable> {
$$TestStatisticsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get userId => $composableBuilder(
column: $table.userId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get totalQuestions => $composableBuilder(
column: $table.totalQuestions,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get correctAnswers => $composableBuilder(
column: $table.correctAnswers,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get incorrectAnswers => $composableBuilder(
column: $table.incorrectAnswers,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get skippedAnswers => $composableBuilder(
column: $table.skippedAnswers,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<double> get scorePercentage => $composableBuilder(
column: $table.scorePercentage,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get timeSpentSeconds => $composableBuilder(
column: $table.timeSpentSeconds,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get questionResults => $composableBuilder(
column: $table.questionResults,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get metadata => $composableBuilder(
column: $table.metadata,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get completedAt => $composableBuilder(
column: $table.completedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
$$TestsTableFilterComposer get testId {
final $$TestsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.testId,
referencedTable: $db.tests,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestsTableFilterComposer(
$db: $db,
$table: $db.tests,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$TestStatisticsTableOrderingComposer
extends Composer<_$AppDatabase, $TestStatisticsTable> {
$$TestStatisticsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get userId => $composableBuilder(
column: $table.userId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get totalQuestions => $composableBuilder(
column: $table.totalQuestions,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get correctAnswers => $composableBuilder(
column: $table.correctAnswers,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get incorrectAnswers => $composableBuilder(
column: $table.incorrectAnswers,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get skippedAnswers => $composableBuilder(
column: $table.skippedAnswers,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<double> get scorePercentage => $composableBuilder(
column: $table.scorePercentage,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get timeSpentSeconds => $composableBuilder(
column: $table.timeSpentSeconds,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get questionResults => $composableBuilder(
column: $table.questionResults,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get metadata => $composableBuilder(
column: $table.metadata,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get completedAt => $composableBuilder(
column: $table.completedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
$$TestsTableOrderingComposer get testId {
final $$TestsTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.testId,
referencedTable: $db.tests,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestsTableOrderingComposer(
$db: $db,
$table: $db.tests,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$TestStatisticsTableAnnotationComposer
extends Composer<_$AppDatabase, $TestStatisticsTable> {
$$TestStatisticsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get userId =>
$composableBuilder(column: $table.userId, builder: (column) => column);
GeneratedColumn<int> get totalQuestions => $composableBuilder(
column: $table.totalQuestions,
builder: (column) => column,
);
GeneratedColumn<int> get correctAnswers => $composableBuilder(
column: $table.correctAnswers,
builder: (column) => column,
);
GeneratedColumn<int> get incorrectAnswers => $composableBuilder(
column: $table.incorrectAnswers,
builder: (column) => column,
);
GeneratedColumn<int> get skippedAnswers => $composableBuilder(
column: $table.skippedAnswers,
builder: (column) => column,
);
GeneratedColumn<double> get scorePercentage => $composableBuilder(
column: $table.scorePercentage,
builder: (column) => column,
);
GeneratedColumn<int> get timeSpentSeconds => $composableBuilder(
column: $table.timeSpentSeconds,
builder: (column) => column,
);
GeneratedColumn<String> get questionResults => $composableBuilder(
column: $table.questionResults,
builder: (column) => column,
);
GeneratedColumn<String> get metadata =>
$composableBuilder(column: $table.metadata, builder: (column) => column);
GeneratedColumn<PgDateTime> get completedAt => $composableBuilder(
column: $table.completedAt,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
$$TestsTableAnnotationComposer get testId {
final $$TestsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.testId,
referencedTable: $db.tests,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$TestsTableAnnotationComposer(
$db: $db,
$table: $db.tests,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$TestStatisticsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$TestStatisticsTable,
TestStatistic,
$$TestStatisticsTableFilterComposer,
$$TestStatisticsTableOrderingComposer,
$$TestStatisticsTableAnnotationComposer,
$$TestStatisticsTableCreateCompanionBuilder,
$$TestStatisticsTableUpdateCompanionBuilder,
(TestStatistic, $$TestStatisticsTableReferences),
TestStatistic,
PrefetchHooks Function({bool testId})
> {
$$TestStatisticsTableTableManager(
_$AppDatabase db,
$TestStatisticsTable table,
) : super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$TestStatisticsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$TestStatisticsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$TestStatisticsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> userId = const Value.absent(),
Value<String> testId = const Value.absent(),
Value<int> totalQuestions = const Value.absent(),
Value<int> correctAnswers = const Value.absent(),
Value<int> incorrectAnswers = const Value.absent(),
Value<int> skippedAnswers = const Value.absent(),
Value<double> scorePercentage = const Value.absent(),
Value<int?> timeSpentSeconds = const Value.absent(),
Value<String> questionResults = const Value.absent(),
Value<String> metadata = const Value.absent(),
Value<PgDateTime> completedAt = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => TestStatisticsCompanion(
id: id,
userId: userId,
testId: testId,
totalQuestions: totalQuestions,
correctAnswers: correctAnswers,
incorrectAnswers: incorrectAnswers,
skippedAnswers: skippedAnswers,
scorePercentage: scorePercentage,
timeSpentSeconds: timeSpentSeconds,
questionResults: questionResults,
metadata: metadata,
completedAt: completedAt,
createdAt: createdAt,
updatedAt: updatedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String userId,
required String testId,
Value<int> totalQuestions = const Value.absent(),
Value<int> correctAnswers = const Value.absent(),
Value<int> incorrectAnswers = const Value.absent(),
Value<int> skippedAnswers = const Value.absent(),
Value<double> scorePercentage = const Value.absent(),
Value<int?> timeSpentSeconds = const Value.absent(),
Value<String> questionResults = const Value.absent(),
Value<String> metadata = const Value.absent(),
Value<PgDateTime> completedAt = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => TestStatisticsCompanion.insert(
id: id,
userId: userId,
testId: testId,
totalQuestions: totalQuestions,
correctAnswers: correctAnswers,
incorrectAnswers: incorrectAnswers,
skippedAnswers: skippedAnswers,
scorePercentage: scorePercentage,
timeSpentSeconds: timeSpentSeconds,
questionResults: questionResults,
metadata: metadata,
completedAt: completedAt,
createdAt: createdAt,
updatedAt: updatedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$TestStatisticsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({testId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (testId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.testId,
referencedTable: $$TestStatisticsTableReferences
._testIdTable(db),
referencedColumn:
$$TestStatisticsTableReferences
._testIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$TestStatisticsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$TestStatisticsTable,
TestStatistic,
$$TestStatisticsTableFilterComposer,
$$TestStatisticsTableOrderingComposer,
$$TestStatisticsTableAnnotationComposer,
$$TestStatisticsTableCreateCompanionBuilder,
$$TestStatisticsTableUpdateCompanionBuilder,
(TestStatistic, $$TestStatisticsTableReferences),
TestStatistic,
PrefetchHooks Function({bool testId})
>;
typedef $$TasksTableCreateCompanionBuilder =
TasksCompanion Function({
Value<String> id,
required String name,
required int minCycleMillis,
required int maxCycleMillis,
required int intervalMillis,
required int timeoutMillis,
Value<String?> status,
Value<String?> description,
Value<PgDateTime?> lastExecution,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
typedef $$TasksTableUpdateCompanionBuilder =
TasksCompanion Function({
Value<String> id,
Value<String> name,
Value<int> minCycleMillis,
Value<int> maxCycleMillis,
Value<int> intervalMillis,
Value<int> timeoutMillis,
Value<String?> status,
Value<String?> description,
Value<PgDateTime?> lastExecution,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
class $$TasksTableFilterComposer extends Composer<_$AppDatabase, $TasksTable> {
$$TasksTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get name => $composableBuilder(
column: $table.name,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get minCycleMillis => $composableBuilder(
column: $table.minCycleMillis,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get maxCycleMillis => $composableBuilder(
column: $table.maxCycleMillis,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get intervalMillis => $composableBuilder(
column: $table.intervalMillis,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get timeoutMillis => $composableBuilder(
column: $table.timeoutMillis,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get status => $composableBuilder(
column: $table.status,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get description => $composableBuilder(
column: $table.description,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get lastExecution => $composableBuilder(
column: $table.lastExecution,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
}
class $$TasksTableOrderingComposer
extends Composer<_$AppDatabase, $TasksTable> {
$$TasksTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get name => $composableBuilder(
column: $table.name,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get minCycleMillis => $composableBuilder(
column: $table.minCycleMillis,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get maxCycleMillis => $composableBuilder(
column: $table.maxCycleMillis,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get intervalMillis => $composableBuilder(
column: $table.intervalMillis,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get timeoutMillis => $composableBuilder(
column: $table.timeoutMillis,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get status => $composableBuilder(
column: $table.status,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get description => $composableBuilder(
column: $table.description,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get lastExecution => $composableBuilder(
column: $table.lastExecution,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
}
class $$TasksTableAnnotationComposer
extends Composer<_$AppDatabase, $TasksTable> {
$$TasksTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get name =>
$composableBuilder(column: $table.name, builder: (column) => column);
GeneratedColumn<int> get minCycleMillis => $composableBuilder(
column: $table.minCycleMillis,
builder: (column) => column,
);
GeneratedColumn<int> get maxCycleMillis => $composableBuilder(
column: $table.maxCycleMillis,
builder: (column) => column,
);
GeneratedColumn<int> get intervalMillis => $composableBuilder(
column: $table.intervalMillis,
builder: (column) => column,
);
GeneratedColumn<int> get timeoutMillis => $composableBuilder(
column: $table.timeoutMillis,
builder: (column) => column,
);
GeneratedColumn<String> get status =>
$composableBuilder(column: $table.status, builder: (column) => column);
GeneratedColumn<String> get description => $composableBuilder(
column: $table.description,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get lastExecution => $composableBuilder(
column: $table.lastExecution,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
}
class $$TasksTableTableManager
extends
RootTableManager<
_$AppDatabase,
$TasksTable,
Task,
$$TasksTableFilterComposer,
$$TasksTableOrderingComposer,
$$TasksTableAnnotationComposer,
$$TasksTableCreateCompanionBuilder,
$$TasksTableUpdateCompanionBuilder,
(Task, BaseReferences<_$AppDatabase, $TasksTable, Task>),
Task,
PrefetchHooks Function()
> {
$$TasksTableTableManager(_$AppDatabase db, $TasksTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$TasksTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$TasksTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$TasksTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> name = const Value.absent(),
Value<int> minCycleMillis = const Value.absent(),
Value<int> maxCycleMillis = const Value.absent(),
Value<int> intervalMillis = const Value.absent(),
Value<int> timeoutMillis = const Value.absent(),
Value<String?> status = const Value.absent(),
Value<String?> description = const Value.absent(),
Value<PgDateTime?> lastExecution = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => TasksCompanion(
id: id,
name: name,
minCycleMillis: minCycleMillis,
maxCycleMillis: maxCycleMillis,
intervalMillis: intervalMillis,
timeoutMillis: timeoutMillis,
status: status,
description: description,
lastExecution: lastExecution,
createdAt: createdAt,
updatedAt: updatedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String name,
required int minCycleMillis,
required int maxCycleMillis,
required int intervalMillis,
required int timeoutMillis,
Value<String?> status = const Value.absent(),
Value<String?> description = const Value.absent(),
Value<PgDateTime?> lastExecution = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => TasksCompanion.insert(
id: id,
name: name,
minCycleMillis: minCycleMillis,
maxCycleMillis: maxCycleMillis,
intervalMillis: intervalMillis,
timeoutMillis: timeoutMillis,
status: status,
description: description,
lastExecution: lastExecution,
createdAt: createdAt,
updatedAt: updatedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
),
);
}
typedef $$TasksTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$TasksTable,
Task,
$$TasksTableFilterComposer,
$$TasksTableOrderingComposer,
$$TasksTableAnnotationComposer,
$$TasksTableCreateCompanionBuilder,
$$TasksTableUpdateCompanionBuilder,
(Task, BaseReferences<_$AppDatabase, $TasksTable, Task>),
Task,
PrefetchHooks Function()
>;
typedef $$UserTasksTableCreateCompanionBuilder =
UserTasksCompanion Function({
Value<String> id,
required String title,
required String description,
required String type,
required String difficulty,
required String status,
Value<List<dynamic>> rewards,
Value<PgDateTime> createdAt,
required PgDateTime expiresAt,
Value<PgDateTime?> completedAt,
Value<String?> proofUrl,
Value<String?> instructions,
Value<List<String>> tags,
Value<String?> imageUrl,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
typedef $$UserTasksTableUpdateCompanionBuilder =
UserTasksCompanion Function({
Value<String> id,
Value<String> title,
Value<String> description,
Value<String> type,
Value<String> difficulty,
Value<String> status,
Value<List<dynamic>> rewards,
Value<PgDateTime> createdAt,
Value<PgDateTime> expiresAt,
Value<PgDateTime?> completedAt,
Value<String?> proofUrl,
Value<String?> instructions,
Value<List<String>> tags,
Value<String?> imageUrl,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
class $$UserTasksTableFilterComposer
extends Composer<_$AppDatabase, $UserTasksTable> {
$$UserTasksTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get title => $composableBuilder(
column: $table.title,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get description => $composableBuilder(
column: $table.description,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get type => $composableBuilder(
column: $table.type,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get difficulty => $composableBuilder(
column: $table.difficulty,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get status => $composableBuilder(
column: $table.status,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<List<dynamic>, List<dynamic>, String>
get rewards => $composableBuilder(
column: $table.rewards,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get expiresAt => $composableBuilder(
column: $table.expiresAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get completedAt => $composableBuilder(
column: $table.completedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get proofUrl => $composableBuilder(
column: $table.proofUrl,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get instructions => $composableBuilder(
column: $table.instructions,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<List<String>, List<String>, String> get tags =>
$composableBuilder(
column: $table.tags,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<String> get imageUrl => $composableBuilder(
column: $table.imageUrl,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
}
class $$UserTasksTableOrderingComposer
extends Composer<_$AppDatabase, $UserTasksTable> {
$$UserTasksTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get title => $composableBuilder(
column: $table.title,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get description => $composableBuilder(
column: $table.description,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get type => $composableBuilder(
column: $table.type,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get difficulty => $composableBuilder(
column: $table.difficulty,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get status => $composableBuilder(
column: $table.status,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get rewards => $composableBuilder(
column: $table.rewards,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get expiresAt => $composableBuilder(
column: $table.expiresAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get completedAt => $composableBuilder(
column: $table.completedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get proofUrl => $composableBuilder(
column: $table.proofUrl,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get instructions => $composableBuilder(
column: $table.instructions,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get tags => $composableBuilder(
column: $table.tags,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get imageUrl => $composableBuilder(
column: $table.imageUrl,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
}
class $$UserTasksTableAnnotationComposer
extends Composer<_$AppDatabase, $UserTasksTable> {
$$UserTasksTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get title =>
$composableBuilder(column: $table.title, builder: (column) => column);
GeneratedColumn<String> get description => $composableBuilder(
column: $table.description,
builder: (column) => column,
);
GeneratedColumn<String> get type =>
$composableBuilder(column: $table.type, builder: (column) => column);
GeneratedColumn<String> get difficulty => $composableBuilder(
column: $table.difficulty,
builder: (column) => column,
);
GeneratedColumn<String> get status =>
$composableBuilder(column: $table.status, builder: (column) => column);
GeneratedColumnWithTypeConverter<List<dynamic>, String> get rewards =>
$composableBuilder(column: $table.rewards, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get expiresAt =>
$composableBuilder(column: $table.expiresAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get completedAt => $composableBuilder(
column: $table.completedAt,
builder: (column) => column,
);
GeneratedColumn<String> get proofUrl =>
$composableBuilder(column: $table.proofUrl, builder: (column) => column);
GeneratedColumn<String> get instructions => $composableBuilder(
column: $table.instructions,
builder: (column) => column,
);
GeneratedColumnWithTypeConverter<List<String>, String> get tags =>
$composableBuilder(column: $table.tags, builder: (column) => column);
GeneratedColumn<String> get imageUrl =>
$composableBuilder(column: $table.imageUrl, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
}
class $$UserTasksTableTableManager
extends
RootTableManager<
_$AppDatabase,
$UserTasksTable,
UserTask,
$$UserTasksTableFilterComposer,
$$UserTasksTableOrderingComposer,
$$UserTasksTableAnnotationComposer,
$$UserTasksTableCreateCompanionBuilder,
$$UserTasksTableUpdateCompanionBuilder,
(UserTask, BaseReferences<_$AppDatabase, $UserTasksTable, UserTask>),
UserTask,
PrefetchHooks Function()
> {
$$UserTasksTableTableManager(_$AppDatabase db, $UserTasksTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$UserTasksTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$UserTasksTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$UserTasksTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> title = const Value.absent(),
Value<String> description = const Value.absent(),
Value<String> type = const Value.absent(),
Value<String> difficulty = const Value.absent(),
Value<String> status = const Value.absent(),
Value<List<dynamic>> rewards = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> expiresAt = const Value.absent(),
Value<PgDateTime?> completedAt = const Value.absent(),
Value<String?> proofUrl = const Value.absent(),
Value<String?> instructions = const Value.absent(),
Value<List<String>> tags = const Value.absent(),
Value<String?> imageUrl = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserTasksCompanion(
id: id,
title: title,
description: description,
type: type,
difficulty: difficulty,
status: status,
rewards: rewards,
createdAt: createdAt,
expiresAt: expiresAt,
completedAt: completedAt,
proofUrl: proofUrl,
instructions: instructions,
tags: tags,
imageUrl: imageUrl,
updatedAt: updatedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String title,
required String description,
required String type,
required String difficulty,
required String status,
Value<List<dynamic>> rewards = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
required PgDateTime expiresAt,
Value<PgDateTime?> completedAt = const Value.absent(),
Value<String?> proofUrl = const Value.absent(),
Value<String?> instructions = const Value.absent(),
Value<List<String>> tags = const Value.absent(),
Value<String?> imageUrl = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserTasksCompanion.insert(
id: id,
title: title,
description: description,
type: type,
difficulty: difficulty,
status: status,
rewards: rewards,
createdAt: createdAt,
expiresAt: expiresAt,
completedAt: completedAt,
proofUrl: proofUrl,
instructions: instructions,
tags: tags,
imageUrl: imageUrl,
updatedAt: updatedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
),
);
}
typedef $$UserTasksTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$UserTasksTable,
UserTask,
$$UserTasksTableFilterComposer,
$$UserTasksTableOrderingComposer,
$$UserTasksTableAnnotationComposer,
$$UserTasksTableCreateCompanionBuilder,
$$UserTasksTableUpdateCompanionBuilder,
(UserTask, BaseReferences<_$AppDatabase, $UserTasksTable, UserTask>),
UserTask,
PrefetchHooks Function()
>;
typedef $$UserTaskProgressesTableCreateCompanionBuilder =
UserTaskProgressesCompanion Function({
Value<String> id,
required String userId,
required String taskId,
Value<Map<String, dynamic>?> progress,
Value<PgDateTime> startedAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
typedef $$UserTaskProgressesTableUpdateCompanionBuilder =
UserTaskProgressesCompanion Function({
Value<String> id,
Value<String> userId,
Value<String> taskId,
Value<Map<String, dynamic>?> progress,
Value<PgDateTime> startedAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
final class $$UserTaskProgressesTableReferences
extends
BaseReferences<
_$AppDatabase,
$UserTaskProgressesTable,
UserTaskProgressesData
> {
$$UserTaskProgressesTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
$_aliasNameGenerator(db.userTaskProgresses.userId, db.users.id),
);
$$UsersTableProcessedTableManager get userId {
final $_column = $_itemColumn<String>('user_id')!;
final manager = $$UsersTableTableManager(
$_db,
$_db.users,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$UserTaskProgressesTableFilterComposer
extends Composer<_$AppDatabase, $UserTaskProgressesTable> {
$$UserTaskProgressesTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get taskId => $composableBuilder(
column: $table.taskId,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<
Map<String, dynamic>?,
Map<String, dynamic>,
String
>
get progress => $composableBuilder(
column: $table.progress,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<PgDateTime> get startedAt => $composableBuilder(
column: $table.startedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
$$UsersTableFilterComposer get userId {
final $$UsersTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableFilterComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserTaskProgressesTableOrderingComposer
extends Composer<_$AppDatabase, $UserTaskProgressesTable> {
$$UserTaskProgressesTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get taskId => $composableBuilder(
column: $table.taskId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get progress => $composableBuilder(
column: $table.progress,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get startedAt => $composableBuilder(
column: $table.startedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
$$UsersTableOrderingComposer get userId {
final $$UsersTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableOrderingComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserTaskProgressesTableAnnotationComposer
extends Composer<_$AppDatabase, $UserTaskProgressesTable> {
$$UserTaskProgressesTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get taskId =>
$composableBuilder(column: $table.taskId, builder: (column) => column);
GeneratedColumnWithTypeConverter<Map<String, dynamic>?, String>
get progress =>
$composableBuilder(column: $table.progress, builder: (column) => column);
GeneratedColumn<PgDateTime> get startedAt =>
$composableBuilder(column: $table.startedAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
$$UsersTableAnnotationComposer get userId {
final $$UsersTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableAnnotationComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserTaskProgressesTableTableManager
extends
RootTableManager<
_$AppDatabase,
$UserTaskProgressesTable,
UserTaskProgressesData,
$$UserTaskProgressesTableFilterComposer,
$$UserTaskProgressesTableOrderingComposer,
$$UserTaskProgressesTableAnnotationComposer,
$$UserTaskProgressesTableCreateCompanionBuilder,
$$UserTaskProgressesTableUpdateCompanionBuilder,
(UserTaskProgressesData, $$UserTaskProgressesTableReferences),
UserTaskProgressesData,
PrefetchHooks Function({bool userId})
> {
$$UserTaskProgressesTableTableManager(
_$AppDatabase db,
$UserTaskProgressesTable table,
) : super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$UserTaskProgressesTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$UserTaskProgressesTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$UserTaskProgressesTableAnnotationComposer(
$db: db,
$table: table,
),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> userId = const Value.absent(),
Value<String> taskId = const Value.absent(),
Value<Map<String, dynamic>?> progress = const Value.absent(),
Value<PgDateTime> startedAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserTaskProgressesCompanion(
id: id,
userId: userId,
taskId: taskId,
progress: progress,
startedAt: startedAt,
updatedAt: updatedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String userId,
required String taskId,
Value<Map<String, dynamic>?> progress = const Value.absent(),
Value<PgDateTime> startedAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserTaskProgressesCompanion.insert(
id: id,
userId: userId,
taskId: taskId,
progress: progress,
startedAt: startedAt,
updatedAt: updatedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$UserTaskProgressesTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({userId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (userId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.userId,
referencedTable:
$$UserTaskProgressesTableReferences
._userIdTable(db),
referencedColumn:
$$UserTaskProgressesTableReferences
._userIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$UserTaskProgressesTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$UserTaskProgressesTable,
UserTaskProgressesData,
$$UserTaskProgressesTableFilterComposer,
$$UserTaskProgressesTableOrderingComposer,
$$UserTaskProgressesTableAnnotationComposer,
$$UserTaskProgressesTableCreateCompanionBuilder,
$$UserTaskProgressesTableUpdateCompanionBuilder,
(UserTaskProgressesData, $$UserTaskProgressesTableReferences),
UserTaskProgressesData,
PrefetchHooks Function({bool userId})
>;
typedef $$UserTaskResultsTableCreateCompanionBuilder =
UserTaskResultsCompanion Function({
Value<String> id,
required String userId,
required String taskId,
Value<Map<String, dynamic>?> results,
Value<PgDateTime> completedAt,
Value<PgDateTime> createdAt,
Value<int> rowid,
});
typedef $$UserTaskResultsTableUpdateCompanionBuilder =
UserTaskResultsCompanion Function({
Value<String> id,
Value<String> userId,
Value<String> taskId,
Value<Map<String, dynamic>?> results,
Value<PgDateTime> completedAt,
Value<PgDateTime> createdAt,
Value<int> rowid,
});
final class $$UserTaskResultsTableReferences
extends
BaseReferences<_$AppDatabase, $UserTaskResultsTable, UserTaskResult> {
$$UserTaskResultsTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
$_aliasNameGenerator(db.userTaskResults.userId, db.users.id),
);
$$UsersTableProcessedTableManager get userId {
final $_column = $_itemColumn<String>('user_id')!;
final manager = $$UsersTableTableManager(
$_db,
$_db.users,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$UserTaskResultsTableFilterComposer
extends Composer<_$AppDatabase, $UserTaskResultsTable> {
$$UserTaskResultsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get taskId => $composableBuilder(
column: $table.taskId,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<
Map<String, dynamic>?,
Map<String, dynamic>,
String
>
get results => $composableBuilder(
column: $table.results,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<PgDateTime> get completedAt => $composableBuilder(
column: $table.completedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
$$UsersTableFilterComposer get userId {
final $$UsersTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableFilterComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserTaskResultsTableOrderingComposer
extends Composer<_$AppDatabase, $UserTaskResultsTable> {
$$UserTaskResultsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get taskId => $composableBuilder(
column: $table.taskId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get results => $composableBuilder(
column: $table.results,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get completedAt => $composableBuilder(
column: $table.completedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
$$UsersTableOrderingComposer get userId {
final $$UsersTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableOrderingComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserTaskResultsTableAnnotationComposer
extends Composer<_$AppDatabase, $UserTaskResultsTable> {
$$UserTaskResultsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get taskId =>
$composableBuilder(column: $table.taskId, builder: (column) => column);
GeneratedColumnWithTypeConverter<Map<String, dynamic>?, String> get results =>
$composableBuilder(column: $table.results, builder: (column) => column);
GeneratedColumn<PgDateTime> get completedAt => $composableBuilder(
column: $table.completedAt,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
$$UsersTableAnnotationComposer get userId {
final $$UsersTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableAnnotationComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserTaskResultsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$UserTaskResultsTable,
UserTaskResult,
$$UserTaskResultsTableFilterComposer,
$$UserTaskResultsTableOrderingComposer,
$$UserTaskResultsTableAnnotationComposer,
$$UserTaskResultsTableCreateCompanionBuilder,
$$UserTaskResultsTableUpdateCompanionBuilder,
(UserTaskResult, $$UserTaskResultsTableReferences),
UserTaskResult,
PrefetchHooks Function({bool userId})
> {
$$UserTaskResultsTableTableManager(
_$AppDatabase db,
$UserTaskResultsTable table,
) : super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$UserTaskResultsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$UserTaskResultsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$UserTaskResultsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> userId = const Value.absent(),
Value<String> taskId = const Value.absent(),
Value<Map<String, dynamic>?> results = const Value.absent(),
Value<PgDateTime> completedAt = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserTaskResultsCompanion(
id: id,
userId: userId,
taskId: taskId,
results: results,
completedAt: completedAt,
createdAt: createdAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String userId,
required String taskId,
Value<Map<String, dynamic>?> results = const Value.absent(),
Value<PgDateTime> completedAt = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserTaskResultsCompanion.insert(
id: id,
userId: userId,
taskId: taskId,
results: results,
completedAt: completedAt,
createdAt: createdAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$UserTaskResultsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({userId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (userId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.userId,
referencedTable:
$$UserTaskResultsTableReferences
._userIdTable(db),
referencedColumn:
$$UserTaskResultsTableReferences
._userIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$UserTaskResultsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$UserTaskResultsTable,
UserTaskResult,
$$UserTaskResultsTableFilterComposer,
$$UserTaskResultsTableOrderingComposer,
$$UserTaskResultsTableAnnotationComposer,
$$UserTaskResultsTableCreateCompanionBuilder,
$$UserTaskResultsTableUpdateCompanionBuilder,
(UserTaskResult, $$UserTaskResultsTableReferences),
UserTaskResult,
PrefetchHooks Function({bool userId})
>;
typedef $$PromoCodesCampaignsTableCreateCompanionBuilder =
PromoCodesCampaignsCompanion Function({
Value<String> id,
required String template,
Value<String?> name,
Value<List<dynamic>> products,
required int activationsPerCode,
required int activationsPerUser,
required int generationSize,
required PgDateTime start,
required PgDateTime finish,
required String status,
Value<List<String>> tags,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
typedef $$PromoCodesCampaignsTableUpdateCompanionBuilder =
PromoCodesCampaignsCompanion Function({
Value<String> id,
Value<String> template,
Value<String?> name,
Value<List<dynamic>> products,
Value<int> activationsPerCode,
Value<int> activationsPerUser,
Value<int> generationSize,
Value<PgDateTime> start,
Value<PgDateTime> finish,
Value<String> status,
Value<List<String>> tags,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
final class $$PromoCodesCampaignsTableReferences
extends
BaseReferences<
_$AppDatabase,
$PromoCodesCampaignsTable,
PromoCodesCampaign
> {
$$PromoCodesCampaignsTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static MultiTypedResultKey<$PromoCodesTable, List<PromoCode>>
_promoCodesRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.promoCodes,
aliasName: $_aliasNameGenerator(
db.promoCodesCampaigns.id,
db.promoCodes.campaignId,
),
);
$$PromoCodesTableProcessedTableManager get promoCodesRefs {
final manager = $$PromoCodesTableTableManager(
$_db,
$_db.promoCodes,
).filter((f) => f.campaignId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_promoCodesRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
}
class $$PromoCodesCampaignsTableFilterComposer
extends Composer<_$AppDatabase, $PromoCodesCampaignsTable> {
$$PromoCodesCampaignsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get template => $composableBuilder(
column: $table.template,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get name => $composableBuilder(
column: $table.name,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<List<dynamic>, List<dynamic>, String>
get products => $composableBuilder(
column: $table.products,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<int> get activationsPerCode => $composableBuilder(
column: $table.activationsPerCode,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get activationsPerUser => $composableBuilder(
column: $table.activationsPerUser,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get generationSize => $composableBuilder(
column: $table.generationSize,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get start => $composableBuilder(
column: $table.start,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get finish => $composableBuilder(
column: $table.finish,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get status => $composableBuilder(
column: $table.status,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<List<String>, List<String>, String> get tags =>
$composableBuilder(
column: $table.tags,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnFilters(column),
);
Expression<bool> promoCodesRefs(
Expression<bool> Function($$PromoCodesTableFilterComposer f) f,
) {
final $$PromoCodesTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.promoCodes,
getReferencedColumn: (t) => t.campaignId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$PromoCodesTableFilterComposer(
$db: $db,
$table: $db.promoCodes,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$PromoCodesCampaignsTableOrderingComposer
extends Composer<_$AppDatabase, $PromoCodesCampaignsTable> {
$$PromoCodesCampaignsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get template => $composableBuilder(
column: $table.template,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get name => $composableBuilder(
column: $table.name,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get products => $composableBuilder(
column: $table.products,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get activationsPerCode => $composableBuilder(
column: $table.activationsPerCode,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get activationsPerUser => $composableBuilder(
column: $table.activationsPerUser,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get generationSize => $composableBuilder(
column: $table.generationSize,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get start => $composableBuilder(
column: $table.start,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get finish => $composableBuilder(
column: $table.finish,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get status => $composableBuilder(
column: $table.status,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get tags => $composableBuilder(
column: $table.tags,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnOrderings(column),
);
}
class $$PromoCodesCampaignsTableAnnotationComposer
extends Composer<_$AppDatabase, $PromoCodesCampaignsTable> {
$$PromoCodesCampaignsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get template =>
$composableBuilder(column: $table.template, builder: (column) => column);
GeneratedColumn<String> get name =>
$composableBuilder(column: $table.name, builder: (column) => column);
GeneratedColumnWithTypeConverter<List<dynamic>, String> get products =>
$composableBuilder(column: $table.products, builder: (column) => column);
GeneratedColumn<int> get activationsPerCode => $composableBuilder(
column: $table.activationsPerCode,
builder: (column) => column,
);
GeneratedColumn<int> get activationsPerUser => $composableBuilder(
column: $table.activationsPerUser,
builder: (column) => column,
);
GeneratedColumn<int> get generationSize => $composableBuilder(
column: $table.generationSize,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get start =>
$composableBuilder(column: $table.start, builder: (column) => column);
GeneratedColumn<PgDateTime> get finish =>
$composableBuilder(column: $table.finish, builder: (column) => column);
GeneratedColumn<String> get status =>
$composableBuilder(column: $table.status, builder: (column) => column);
GeneratedColumnWithTypeConverter<List<String>, String> get tags =>
$composableBuilder(column: $table.tags, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
GeneratedColumn<PgDateTime> get deletedAt =>
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
Expression<T> promoCodesRefs<T extends Object>(
Expression<T> Function($$PromoCodesTableAnnotationComposer a) f,
) {
final $$PromoCodesTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.promoCodes,
getReferencedColumn: (t) => t.campaignId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$PromoCodesTableAnnotationComposer(
$db: $db,
$table: $db.promoCodes,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$PromoCodesCampaignsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$PromoCodesCampaignsTable,
PromoCodesCampaign,
$$PromoCodesCampaignsTableFilterComposer,
$$PromoCodesCampaignsTableOrderingComposer,
$$PromoCodesCampaignsTableAnnotationComposer,
$$PromoCodesCampaignsTableCreateCompanionBuilder,
$$PromoCodesCampaignsTableUpdateCompanionBuilder,
(PromoCodesCampaign, $$PromoCodesCampaignsTableReferences),
PromoCodesCampaign,
PrefetchHooks Function({bool promoCodesRefs})
> {
$$PromoCodesCampaignsTableTableManager(
_$AppDatabase db,
$PromoCodesCampaignsTable table,
) : super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$PromoCodesCampaignsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$PromoCodesCampaignsTableOrderingComposer(
$db: db,
$table: table,
),
createComputedFieldComposer: () =>
$$PromoCodesCampaignsTableAnnotationComposer(
$db: db,
$table: table,
),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> template = const Value.absent(),
Value<String?> name = const Value.absent(),
Value<List<dynamic>> products = const Value.absent(),
Value<int> activationsPerCode = const Value.absent(),
Value<int> activationsPerUser = const Value.absent(),
Value<int> generationSize = const Value.absent(),
Value<PgDateTime> start = const Value.absent(),
Value<PgDateTime> finish = const Value.absent(),
Value<String> status = const Value.absent(),
Value<List<String>> tags = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => PromoCodesCampaignsCompanion(
id: id,
template: template,
name: name,
products: products,
activationsPerCode: activationsPerCode,
activationsPerUser: activationsPerUser,
generationSize: generationSize,
start: start,
finish: finish,
status: status,
tags: tags,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String template,
Value<String?> name = const Value.absent(),
Value<List<dynamic>> products = const Value.absent(),
required int activationsPerCode,
required int activationsPerUser,
required int generationSize,
required PgDateTime start,
required PgDateTime finish,
required String status,
Value<List<String>> tags = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => PromoCodesCampaignsCompanion.insert(
id: id,
template: template,
name: name,
products: products,
activationsPerCode: activationsPerCode,
activationsPerUser: activationsPerUser,
generationSize: generationSize,
start: start,
finish: finish,
status: status,
tags: tags,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$PromoCodesCampaignsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({promoCodesRefs = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [if (promoCodesRefs) db.promoCodes],
addJoins: null,
getPrefetchedDataCallback: (items) async {
return [
if (promoCodesRefs)
await $_getPrefetchedData<
PromoCodesCampaign,
$PromoCodesCampaignsTable,
PromoCode
>(
currentTable: table,
referencedTable: $$PromoCodesCampaignsTableReferences
._promoCodesRefsTable(db),
managerFromTypedResult: (p0) =>
$$PromoCodesCampaignsTableReferences(
db,
table,
p0,
).promoCodesRefs,
referencedItemsForCurrentItem: (item, referencedItems) =>
referencedItems.where((e) => e.campaignId == item.id),
typedResults: items,
),
];
},
);
},
),
);
}
typedef $$PromoCodesCampaignsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$PromoCodesCampaignsTable,
PromoCodesCampaign,
$$PromoCodesCampaignsTableFilterComposer,
$$PromoCodesCampaignsTableOrderingComposer,
$$PromoCodesCampaignsTableAnnotationComposer,
$$PromoCodesCampaignsTableCreateCompanionBuilder,
$$PromoCodesCampaignsTableUpdateCompanionBuilder,
(PromoCodesCampaign, $$PromoCodesCampaignsTableReferences),
PromoCodesCampaign,
PrefetchHooks Function({bool promoCodesRefs})
>;
typedef $$PromoCodesTableCreateCompanionBuilder =
PromoCodesCompanion Function({
Value<String> id,
required String campaignId,
required String code,
Value<int> activations,
Value<String?> userId,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
typedef $$PromoCodesTableUpdateCompanionBuilder =
PromoCodesCompanion Function({
Value<String> id,
Value<String> campaignId,
Value<String> code,
Value<int> activations,
Value<String?> userId,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
final class $$PromoCodesTableReferences
extends BaseReferences<_$AppDatabase, $PromoCodesTable, PromoCode> {
$$PromoCodesTableReferences(super.$_db, super.$_table, super.$_typedResult);
static $PromoCodesCampaignsTable _campaignIdTable(_$AppDatabase db) =>
db.promoCodesCampaigns.createAlias(
$_aliasNameGenerator(
db.promoCodes.campaignId,
db.promoCodesCampaigns.id,
),
);
$$PromoCodesCampaignsTableProcessedTableManager get campaignId {
final $_column = $_itemColumn<String>('campaign_id')!;
final manager = $$PromoCodesCampaignsTableTableManager(
$_db,
$_db.promoCodesCampaigns,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_campaignIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
$_aliasNameGenerator(db.promoCodes.userId, db.users.id),
);
$$UsersTableProcessedTableManager? get userId {
final $_column = $_itemColumn<String>('user_id');
if ($_column == null) return null;
final manager = $$UsersTableTableManager(
$_db,
$_db.users,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$PromoCodesTableFilterComposer
extends Composer<_$AppDatabase, $PromoCodesTable> {
$$PromoCodesTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get code => $composableBuilder(
column: $table.code,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get activations => $composableBuilder(
column: $table.activations,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnFilters(column),
);
$$PromoCodesCampaignsTableFilterComposer get campaignId {
final $$PromoCodesCampaignsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.campaignId,
referencedTable: $db.promoCodesCampaigns,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$PromoCodesCampaignsTableFilterComposer(
$db: $db,
$table: $db.promoCodesCampaigns,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$UsersTableFilterComposer get userId {
final $$UsersTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableFilterComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$PromoCodesTableOrderingComposer
extends Composer<_$AppDatabase, $PromoCodesTable> {
$$PromoCodesTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get code => $composableBuilder(
column: $table.code,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get activations => $composableBuilder(
column: $table.activations,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnOrderings(column),
);
$$PromoCodesCampaignsTableOrderingComposer get campaignId {
final $$PromoCodesCampaignsTableOrderingComposer composer =
$composerBuilder(
composer: this,
getCurrentColumn: (t) => t.campaignId,
referencedTable: $db.promoCodesCampaigns,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$PromoCodesCampaignsTableOrderingComposer(
$db: $db,
$table: $db.promoCodesCampaigns,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$UsersTableOrderingComposer get userId {
final $$UsersTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableOrderingComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$PromoCodesTableAnnotationComposer
extends Composer<_$AppDatabase, $PromoCodesTable> {
$$PromoCodesTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get code =>
$composableBuilder(column: $table.code, builder: (column) => column);
GeneratedColumn<int> get activations => $composableBuilder(
column: $table.activations,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
GeneratedColumn<PgDateTime> get deletedAt =>
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
$$PromoCodesCampaignsTableAnnotationComposer get campaignId {
final $$PromoCodesCampaignsTableAnnotationComposer composer =
$composerBuilder(
composer: this,
getCurrentColumn: (t) => t.campaignId,
referencedTable: $db.promoCodesCampaigns,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$PromoCodesCampaignsTableAnnotationComposer(
$db: $db,
$table: $db.promoCodesCampaigns,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$UsersTableAnnotationComposer get userId {
final $$UsersTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableAnnotationComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$PromoCodesTableTableManager
extends
RootTableManager<
_$AppDatabase,
$PromoCodesTable,
PromoCode,
$$PromoCodesTableFilterComposer,
$$PromoCodesTableOrderingComposer,
$$PromoCodesTableAnnotationComposer,
$$PromoCodesTableCreateCompanionBuilder,
$$PromoCodesTableUpdateCompanionBuilder,
(PromoCode, $$PromoCodesTableReferences),
PromoCode,
PrefetchHooks Function({bool campaignId, bool userId})
> {
$$PromoCodesTableTableManager(_$AppDatabase db, $PromoCodesTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$PromoCodesTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$PromoCodesTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$PromoCodesTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> campaignId = const Value.absent(),
Value<String> code = const Value.absent(),
Value<int> activations = const Value.absent(),
Value<String?> userId = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => PromoCodesCompanion(
id: id,
campaignId: campaignId,
code: code,
activations: activations,
userId: userId,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String campaignId,
required String code,
Value<int> activations = const Value.absent(),
Value<String?> userId = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => PromoCodesCompanion.insert(
id: id,
campaignId: campaignId,
code: code,
activations: activations,
userId: userId,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$PromoCodesTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({campaignId = false, userId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (campaignId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.campaignId,
referencedTable: $$PromoCodesTableReferences
._campaignIdTable(db),
referencedColumn: $$PromoCodesTableReferences
._campaignIdTable(db)
.id,
)
as T;
}
if (userId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.userId,
referencedTable: $$PromoCodesTableReferences
._userIdTable(db),
referencedColumn: $$PromoCodesTableReferences
._userIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$PromoCodesTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$PromoCodesTable,
PromoCode,
$$PromoCodesTableFilterComposer,
$$PromoCodesTableOrderingComposer,
$$PromoCodesTableAnnotationComposer,
$$PromoCodesTableCreateCompanionBuilder,
$$PromoCodesTableUpdateCompanionBuilder,
(PromoCode, $$PromoCodesTableReferences),
PromoCode,
PrefetchHooks Function({bool campaignId, bool userId})
>;
typedef $$DiscountCampaignsTableCreateCompanionBuilder =
DiscountCampaignsCompanion Function({
Value<String> id,
Value<String?> name,
required PgDateTime start,
required PgDateTime finish,
required String status,
Value<List<String>> tags,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
typedef $$DiscountCampaignsTableUpdateCompanionBuilder =
DiscountCampaignsCompanion Function({
Value<String> id,
Value<String?> name,
Value<PgDateTime> start,
Value<PgDateTime> finish,
Value<String> status,
Value<List<String>> tags,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
final class $$DiscountCampaignsTableReferences
extends
BaseReferences<
_$AppDatabase,
$DiscountCampaignsTable,
DiscountCampaign
> {
$$DiscountCampaignsTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static MultiTypedResultKey<$DiscountsTable, List<Discount>>
_discountsRefsTable(_$AppDatabase db) => MultiTypedResultKey.fromTable(
db.discounts,
aliasName: $_aliasNameGenerator(
db.discountCampaigns.id,
db.discounts.campaignId,
),
);
$$DiscountsTableProcessedTableManager get discountsRefs {
final manager = $$DiscountsTableTableManager(
$_db,
$_db.discounts,
).filter((f) => f.campaignId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(_discountsRefsTable($_db));
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
}
class $$DiscountCampaignsTableFilterComposer
extends Composer<_$AppDatabase, $DiscountCampaignsTable> {
$$DiscountCampaignsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get name => $composableBuilder(
column: $table.name,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get start => $composableBuilder(
column: $table.start,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get finish => $composableBuilder(
column: $table.finish,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get status => $composableBuilder(
column: $table.status,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<List<String>, List<String>, String> get tags =>
$composableBuilder(
column: $table.tags,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnFilters(column),
);
Expression<bool> discountsRefs(
Expression<bool> Function($$DiscountsTableFilterComposer f) f,
) {
final $$DiscountsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.discounts,
getReferencedColumn: (t) => t.campaignId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$DiscountsTableFilterComposer(
$db: $db,
$table: $db.discounts,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$DiscountCampaignsTableOrderingComposer
extends Composer<_$AppDatabase, $DiscountCampaignsTable> {
$$DiscountCampaignsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get name => $composableBuilder(
column: $table.name,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get start => $composableBuilder(
column: $table.start,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get finish => $composableBuilder(
column: $table.finish,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get status => $composableBuilder(
column: $table.status,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get tags => $composableBuilder(
column: $table.tags,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnOrderings(column),
);
}
class $$DiscountCampaignsTableAnnotationComposer
extends Composer<_$AppDatabase, $DiscountCampaignsTable> {
$$DiscountCampaignsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get name =>
$composableBuilder(column: $table.name, builder: (column) => column);
GeneratedColumn<PgDateTime> get start =>
$composableBuilder(column: $table.start, builder: (column) => column);
GeneratedColumn<PgDateTime> get finish =>
$composableBuilder(column: $table.finish, builder: (column) => column);
GeneratedColumn<String> get status =>
$composableBuilder(column: $table.status, builder: (column) => column);
GeneratedColumnWithTypeConverter<List<String>, String> get tags =>
$composableBuilder(column: $table.tags, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
GeneratedColumn<PgDateTime> get deletedAt =>
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
Expression<T> discountsRefs<T extends Object>(
Expression<T> Function($$DiscountsTableAnnotationComposer a) f,
) {
final $$DiscountsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.discounts,
getReferencedColumn: (t) => t.campaignId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$DiscountsTableAnnotationComposer(
$db: $db,
$table: $db.discounts,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$DiscountCampaignsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$DiscountCampaignsTable,
DiscountCampaign,
$$DiscountCampaignsTableFilterComposer,
$$DiscountCampaignsTableOrderingComposer,
$$DiscountCampaignsTableAnnotationComposer,
$$DiscountCampaignsTableCreateCompanionBuilder,
$$DiscountCampaignsTableUpdateCompanionBuilder,
(DiscountCampaign, $$DiscountCampaignsTableReferences),
DiscountCampaign,
PrefetchHooks Function({bool discountsRefs})
> {
$$DiscountCampaignsTableTableManager(
_$AppDatabase db,
$DiscountCampaignsTable table,
) : super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$DiscountCampaignsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$DiscountCampaignsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$DiscountCampaignsTableAnnotationComposer(
$db: db,
$table: table,
),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String?> name = const Value.absent(),
Value<PgDateTime> start = const Value.absent(),
Value<PgDateTime> finish = const Value.absent(),
Value<String> status = const Value.absent(),
Value<List<String>> tags = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => DiscountCampaignsCompanion(
id: id,
name: name,
start: start,
finish: finish,
status: status,
tags: tags,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String?> name = const Value.absent(),
required PgDateTime start,
required PgDateTime finish,
required String status,
Value<List<String>> tags = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => DiscountCampaignsCompanion.insert(
id: id,
name: name,
start: start,
finish: finish,
status: status,
tags: tags,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$DiscountCampaignsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({discountsRefs = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [if (discountsRefs) db.discounts],
addJoins: null,
getPrefetchedDataCallback: (items) async {
return [
if (discountsRefs)
await $_getPrefetchedData<
DiscountCampaign,
$DiscountCampaignsTable,
Discount
>(
currentTable: table,
referencedTable: $$DiscountCampaignsTableReferences
._discountsRefsTable(db),
managerFromTypedResult: (p0) =>
$$DiscountCampaignsTableReferences(
db,
table,
p0,
).discountsRefs,
referencedItemsForCurrentItem: (item, referencedItems) =>
referencedItems.where((e) => e.campaignId == item.id),
typedResults: items,
),
];
},
);
},
),
);
}
typedef $$DiscountCampaignsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$DiscountCampaignsTable,
DiscountCampaign,
$$DiscountCampaignsTableFilterComposer,
$$DiscountCampaignsTableOrderingComposer,
$$DiscountCampaignsTableAnnotationComposer,
$$DiscountCampaignsTableCreateCompanionBuilder,
$$DiscountCampaignsTableUpdateCompanionBuilder,
(DiscountCampaign, $$DiscountCampaignsTableReferences),
DiscountCampaign,
PrefetchHooks Function({bool discountsRefs})
>;
typedef $$DiscountsTableCreateCompanionBuilder =
DiscountsCompanion Function({
Value<String> id,
required String campaignId,
required double discountPercent,
Value<List<dynamic>> products,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
typedef $$DiscountsTableUpdateCompanionBuilder =
DiscountsCompanion Function({
Value<String> id,
Value<String> campaignId,
Value<double> discountPercent,
Value<List<dynamic>> products,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
final class $$DiscountsTableReferences
extends BaseReferences<_$AppDatabase, $DiscountsTable, Discount> {
$$DiscountsTableReferences(super.$_db, super.$_table, super.$_typedResult);
static $DiscountCampaignsTable _campaignIdTable(_$AppDatabase db) =>
db.discountCampaigns.createAlias(
$_aliasNameGenerator(db.discounts.campaignId, db.discountCampaigns.id),
);
$$DiscountCampaignsTableProcessedTableManager get campaignId {
final $_column = $_itemColumn<String>('campaign_id')!;
final manager = $$DiscountCampaignsTableTableManager(
$_db,
$_db.discountCampaigns,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_campaignIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
static MultiTypedResultKey<$DiscountUserDatasTable, List<DiscountUserData>>
_discountUserDatasRefsTable(_$AppDatabase db) =>
MultiTypedResultKey.fromTable(
db.discountUserDatas,
aliasName: $_aliasNameGenerator(
db.discounts.id,
db.discountUserDatas.discountId,
),
);
$$DiscountUserDatasTableProcessedTableManager get discountUserDatasRefs {
final manager = $$DiscountUserDatasTableTableManager(
$_db,
$_db.discountUserDatas,
).filter((f) => f.discountId.id.sqlEquals($_itemColumn<String>('id')!));
final cache = $_typedResult.readTableOrNull(
_discountUserDatasRefsTable($_db),
);
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: cache),
);
}
}
class $$DiscountsTableFilterComposer
extends Composer<_$AppDatabase, $DiscountsTable> {
$$DiscountsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<double> get discountPercent => $composableBuilder(
column: $table.discountPercent,
builder: (column) => ColumnFilters(column),
);
ColumnWithTypeConverterFilters<List<dynamic>, List<dynamic>, String>
get products => $composableBuilder(
column: $table.products,
builder: (column) => ColumnWithTypeConverterFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnFilters(column),
);
$$DiscountCampaignsTableFilterComposer get campaignId {
final $$DiscountCampaignsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.campaignId,
referencedTable: $db.discountCampaigns,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$DiscountCampaignsTableFilterComposer(
$db: $db,
$table: $db.discountCampaigns,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
Expression<bool> discountUserDatasRefs(
Expression<bool> Function($$DiscountUserDatasTableFilterComposer f) f,
) {
final $$DiscountUserDatasTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.discountUserDatas,
getReferencedColumn: (t) => t.discountId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$DiscountUserDatasTableFilterComposer(
$db: $db,
$table: $db.discountUserDatas,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$DiscountsTableOrderingComposer
extends Composer<_$AppDatabase, $DiscountsTable> {
$$DiscountsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<double> get discountPercent => $composableBuilder(
column: $table.discountPercent,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get products => $composableBuilder(
column: $table.products,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnOrderings(column),
);
$$DiscountCampaignsTableOrderingComposer get campaignId {
final $$DiscountCampaignsTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.campaignId,
referencedTable: $db.discountCampaigns,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$DiscountCampaignsTableOrderingComposer(
$db: $db,
$table: $db.discountCampaigns,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$DiscountsTableAnnotationComposer
extends Composer<_$AppDatabase, $DiscountsTable> {
$$DiscountsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<double> get discountPercent => $composableBuilder(
column: $table.discountPercent,
builder: (column) => column,
);
GeneratedColumnWithTypeConverter<List<dynamic>, String> get products =>
$composableBuilder(column: $table.products, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
GeneratedColumn<PgDateTime> get deletedAt =>
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
$$DiscountCampaignsTableAnnotationComposer get campaignId {
final $$DiscountCampaignsTableAnnotationComposer composer =
$composerBuilder(
composer: this,
getCurrentColumn: (t) => t.campaignId,
referencedTable: $db.discountCampaigns,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$DiscountCampaignsTableAnnotationComposer(
$db: $db,
$table: $db.discountCampaigns,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
Expression<T> discountUserDatasRefs<T extends Object>(
Expression<T> Function($$DiscountUserDatasTableAnnotationComposer a) f,
) {
final $$DiscountUserDatasTableAnnotationComposer composer =
$composerBuilder(
composer: this,
getCurrentColumn: (t) => t.id,
referencedTable: $db.discountUserDatas,
getReferencedColumn: (t) => t.discountId,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$DiscountUserDatasTableAnnotationComposer(
$db: $db,
$table: $db.discountUserDatas,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return f(composer);
}
}
class $$DiscountsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$DiscountsTable,
Discount,
$$DiscountsTableFilterComposer,
$$DiscountsTableOrderingComposer,
$$DiscountsTableAnnotationComposer,
$$DiscountsTableCreateCompanionBuilder,
$$DiscountsTableUpdateCompanionBuilder,
(Discount, $$DiscountsTableReferences),
Discount,
PrefetchHooks Function({bool campaignId, bool discountUserDatasRefs})
> {
$$DiscountsTableTableManager(_$AppDatabase db, $DiscountsTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$DiscountsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$DiscountsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$DiscountsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> campaignId = const Value.absent(),
Value<double> discountPercent = const Value.absent(),
Value<List<dynamic>> products = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => DiscountsCompanion(
id: id,
campaignId: campaignId,
discountPercent: discountPercent,
products: products,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String campaignId,
required double discountPercent,
Value<List<dynamic>> products = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => DiscountsCompanion.insert(
id: id,
campaignId: campaignId,
discountPercent: discountPercent,
products: products,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$DiscountsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback:
({campaignId = false, discountUserDatasRefs = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [
if (discountUserDatasRefs) db.discountUserDatas,
],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (campaignId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.campaignId,
referencedTable: $$DiscountsTableReferences
._campaignIdTable(db),
referencedColumn: $$DiscountsTableReferences
._campaignIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [
if (discountUserDatasRefs)
await $_getPrefetchedData<
Discount,
$DiscountsTable,
DiscountUserData
>(
currentTable: table,
referencedTable: $$DiscountsTableReferences
._discountUserDatasRefsTable(db),
managerFromTypedResult: (p0) =>
$$DiscountsTableReferences(
db,
table,
p0,
).discountUserDatasRefs,
referencedItemsForCurrentItem:
(item, referencedItems) => referencedItems.where(
(e) => e.discountId == item.id,
),
typedResults: items,
),
];
},
);
},
),
);
}
typedef $$DiscountsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$DiscountsTable,
Discount,
$$DiscountsTableFilterComposer,
$$DiscountsTableOrderingComposer,
$$DiscountsTableAnnotationComposer,
$$DiscountsTableCreateCompanionBuilder,
$$DiscountsTableUpdateCompanionBuilder,
(Discount, $$DiscountsTableReferences),
Discount,
PrefetchHooks Function({bool campaignId, bool discountUserDatasRefs})
>;
typedef $$DiscountUserDatasTableCreateCompanionBuilder =
DiscountUserDatasCompanion Function({
required String discountId,
required String userId,
Value<PgDateTime> grantedAt,
Value<int> rowid,
});
typedef $$DiscountUserDatasTableUpdateCompanionBuilder =
DiscountUserDatasCompanion Function({
Value<String> discountId,
Value<String> userId,
Value<PgDateTime> grantedAt,
Value<int> rowid,
});
final class $$DiscountUserDatasTableReferences
extends
BaseReferences<
_$AppDatabase,
$DiscountUserDatasTable,
DiscountUserData
> {
$$DiscountUserDatasTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static $DiscountsTable _discountIdTable(_$AppDatabase db) =>
db.discounts.createAlias(
$_aliasNameGenerator(db.discountUserDatas.discountId, db.discounts.id),
);
$$DiscountsTableProcessedTableManager get discountId {
final $_column = $_itemColumn<String>('discount_id')!;
final manager = $$DiscountsTableTableManager(
$_db,
$_db.discounts,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_discountIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
$_aliasNameGenerator(db.discountUserDatas.userId, db.users.id),
);
$$UsersTableProcessedTableManager get userId {
final $_column = $_itemColumn<String>('user_id')!;
final manager = $$UsersTableTableManager(
$_db,
$_db.users,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$DiscountUserDatasTableFilterComposer
extends Composer<_$AppDatabase, $DiscountUserDatasTable> {
$$DiscountUserDatasTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<PgDateTime> get grantedAt => $composableBuilder(
column: $table.grantedAt,
builder: (column) => ColumnFilters(column),
);
$$DiscountsTableFilterComposer get discountId {
final $$DiscountsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.discountId,
referencedTable: $db.discounts,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$DiscountsTableFilterComposer(
$db: $db,
$table: $db.discounts,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$UsersTableFilterComposer get userId {
final $$UsersTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableFilterComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$DiscountUserDatasTableOrderingComposer
extends Composer<_$AppDatabase, $DiscountUserDatasTable> {
$$DiscountUserDatasTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<PgDateTime> get grantedAt => $composableBuilder(
column: $table.grantedAt,
builder: (column) => ColumnOrderings(column),
);
$$DiscountsTableOrderingComposer get discountId {
final $$DiscountsTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.discountId,
referencedTable: $db.discounts,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$DiscountsTableOrderingComposer(
$db: $db,
$table: $db.discounts,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$UsersTableOrderingComposer get userId {
final $$UsersTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableOrderingComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$DiscountUserDatasTableAnnotationComposer
extends Composer<_$AppDatabase, $DiscountUserDatasTable> {
$$DiscountUserDatasTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<PgDateTime> get grantedAt =>
$composableBuilder(column: $table.grantedAt, builder: (column) => column);
$$DiscountsTableAnnotationComposer get discountId {
final $$DiscountsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.discountId,
referencedTable: $db.discounts,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$DiscountsTableAnnotationComposer(
$db: $db,
$table: $db.discounts,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$UsersTableAnnotationComposer get userId {
final $$UsersTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableAnnotationComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$DiscountUserDatasTableTableManager
extends
RootTableManager<
_$AppDatabase,
$DiscountUserDatasTable,
DiscountUserData,
$$DiscountUserDatasTableFilterComposer,
$$DiscountUserDatasTableOrderingComposer,
$$DiscountUserDatasTableAnnotationComposer,
$$DiscountUserDatasTableCreateCompanionBuilder,
$$DiscountUserDatasTableUpdateCompanionBuilder,
(DiscountUserData, $$DiscountUserDatasTableReferences),
DiscountUserData,
PrefetchHooks Function({bool discountId, bool userId})
> {
$$DiscountUserDatasTableTableManager(
_$AppDatabase db,
$DiscountUserDatasTable table,
) : super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$DiscountUserDatasTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$DiscountUserDatasTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$DiscountUserDatasTableAnnotationComposer(
$db: db,
$table: table,
),
updateCompanionCallback:
({
Value<String> discountId = const Value.absent(),
Value<String> userId = const Value.absent(),
Value<PgDateTime> grantedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => DiscountUserDatasCompanion(
discountId: discountId,
userId: userId,
grantedAt: grantedAt,
rowid: rowid,
),
createCompanionCallback:
({
required String discountId,
required String userId,
Value<PgDateTime> grantedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => DiscountUserDatasCompanion.insert(
discountId: discountId,
userId: userId,
grantedAt: grantedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$DiscountUserDatasTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({discountId = false, userId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (discountId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.discountId,
referencedTable:
$$DiscountUserDatasTableReferences
._discountIdTable(db),
referencedColumn:
$$DiscountUserDatasTableReferences
._discountIdTable(db)
.id,
)
as T;
}
if (userId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.userId,
referencedTable:
$$DiscountUserDatasTableReferences
._userIdTable(db),
referencedColumn:
$$DiscountUserDatasTableReferences
._userIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$DiscountUserDatasTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$DiscountUserDatasTable,
DiscountUserData,
$$DiscountUserDatasTableFilterComposer,
$$DiscountUserDatasTableOrderingComposer,
$$DiscountUserDatasTableAnnotationComposer,
$$DiscountUserDatasTableCreateCompanionBuilder,
$$DiscountUserDatasTableUpdateCompanionBuilder,
(DiscountUserData, $$DiscountUserDatasTableReferences),
DiscountUserData,
PrefetchHooks Function({bool discountId, bool userId})
>;
typedef $$StudySessionsTableCreateCompanionBuilder =
StudySessionsCompanion Function({
Value<String> id,
required String userId,
Value<String?> sessionId,
required PgDateTime startTime,
Value<PgDateTime?> endTime,
Value<int> wordsLearned,
Value<int> testsCompleted,
Value<double> accuracy,
Value<String?> packId,
Value<String?> testId,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
typedef $$StudySessionsTableUpdateCompanionBuilder =
StudySessionsCompanion Function({
Value<String> id,
Value<String> userId,
Value<String?> sessionId,
Value<PgDateTime> startTime,
Value<PgDateTime?> endTime,
Value<int> wordsLearned,
Value<int> testsCompleted,
Value<double> accuracy,
Value<String?> packId,
Value<String?> testId,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
final class $$StudySessionsTableReferences
extends BaseReferences<_$AppDatabase, $StudySessionsTable, StudySession> {
$$StudySessionsTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
$_aliasNameGenerator(db.studySessions.userId, db.users.id),
);
$$UsersTableProcessedTableManager get userId {
final $_column = $_itemColumn<String>('user_id')!;
final manager = $$UsersTableTableManager(
$_db,
$_db.users,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$StudySessionsTableFilterComposer
extends Composer<_$AppDatabase, $StudySessionsTable> {
$$StudySessionsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get sessionId => $composableBuilder(
column: $table.sessionId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get startTime => $composableBuilder(
column: $table.startTime,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get endTime => $composableBuilder(
column: $table.endTime,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get wordsLearned => $composableBuilder(
column: $table.wordsLearned,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get testsCompleted => $composableBuilder(
column: $table.testsCompleted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<double> get accuracy => $composableBuilder(
column: $table.accuracy,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get packId => $composableBuilder(
column: $table.packId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get testId => $composableBuilder(
column: $table.testId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnFilters(column),
);
$$UsersTableFilterComposer get userId {
final $$UsersTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableFilterComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$StudySessionsTableOrderingComposer
extends Composer<_$AppDatabase, $StudySessionsTable> {
$$StudySessionsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get sessionId => $composableBuilder(
column: $table.sessionId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get startTime => $composableBuilder(
column: $table.startTime,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get endTime => $composableBuilder(
column: $table.endTime,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get wordsLearned => $composableBuilder(
column: $table.wordsLearned,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get testsCompleted => $composableBuilder(
column: $table.testsCompleted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<double> get accuracy => $composableBuilder(
column: $table.accuracy,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get packId => $composableBuilder(
column: $table.packId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get testId => $composableBuilder(
column: $table.testId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnOrderings(column),
);
$$UsersTableOrderingComposer get userId {
final $$UsersTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableOrderingComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$StudySessionsTableAnnotationComposer
extends Composer<_$AppDatabase, $StudySessionsTable> {
$$StudySessionsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get sessionId =>
$composableBuilder(column: $table.sessionId, builder: (column) => column);
GeneratedColumn<PgDateTime> get startTime =>
$composableBuilder(column: $table.startTime, builder: (column) => column);
GeneratedColumn<PgDateTime> get endTime =>
$composableBuilder(column: $table.endTime, builder: (column) => column);
GeneratedColumn<int> get wordsLearned => $composableBuilder(
column: $table.wordsLearned,
builder: (column) => column,
);
GeneratedColumn<int> get testsCompleted => $composableBuilder(
column: $table.testsCompleted,
builder: (column) => column,
);
GeneratedColumn<double> get accuracy =>
$composableBuilder(column: $table.accuracy, builder: (column) => column);
GeneratedColumn<String> get packId =>
$composableBuilder(column: $table.packId, builder: (column) => column);
GeneratedColumn<String> get testId =>
$composableBuilder(column: $table.testId, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
GeneratedColumn<PgDateTime> get deletedAt =>
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
$$UsersTableAnnotationComposer get userId {
final $$UsersTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableAnnotationComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$StudySessionsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$StudySessionsTable,
StudySession,
$$StudySessionsTableFilterComposer,
$$StudySessionsTableOrderingComposer,
$$StudySessionsTableAnnotationComposer,
$$StudySessionsTableCreateCompanionBuilder,
$$StudySessionsTableUpdateCompanionBuilder,
(StudySession, $$StudySessionsTableReferences),
StudySession,
PrefetchHooks Function({bool userId})
> {
$$StudySessionsTableTableManager(_$AppDatabase db, $StudySessionsTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$StudySessionsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$StudySessionsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$StudySessionsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> userId = const Value.absent(),
Value<String?> sessionId = const Value.absent(),
Value<PgDateTime> startTime = const Value.absent(),
Value<PgDateTime?> endTime = const Value.absent(),
Value<int> wordsLearned = const Value.absent(),
Value<int> testsCompleted = const Value.absent(),
Value<double> accuracy = const Value.absent(),
Value<String?> packId = const Value.absent(),
Value<String?> testId = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => StudySessionsCompanion(
id: id,
userId: userId,
sessionId: sessionId,
startTime: startTime,
endTime: endTime,
wordsLearned: wordsLearned,
testsCompleted: testsCompleted,
accuracy: accuracy,
packId: packId,
testId: testId,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String userId,
Value<String?> sessionId = const Value.absent(),
required PgDateTime startTime,
Value<PgDateTime?> endTime = const Value.absent(),
Value<int> wordsLearned = const Value.absent(),
Value<int> testsCompleted = const Value.absent(),
Value<double> accuracy = const Value.absent(),
Value<String?> packId = const Value.absent(),
Value<String?> testId = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => StudySessionsCompanion.insert(
id: id,
userId: userId,
sessionId: sessionId,
startTime: startTime,
endTime: endTime,
wordsLearned: wordsLearned,
testsCompleted: testsCompleted,
accuracy: accuracy,
packId: packId,
testId: testId,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$StudySessionsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({userId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (userId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.userId,
referencedTable: $$StudySessionsTableReferences
._userIdTable(db),
referencedColumn: $$StudySessionsTableReferences
._userIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$StudySessionsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$StudySessionsTable,
StudySession,
$$StudySessionsTableFilterComposer,
$$StudySessionsTableOrderingComposer,
$$StudySessionsTableAnnotationComposer,
$$StudySessionsTableCreateCompanionBuilder,
$$StudySessionsTableUpdateCompanionBuilder,
(StudySession, $$StudySessionsTableReferences),
StudySession,
PrefetchHooks Function({bool userId})
>;
typedef $$WordStatisticsTableCreateCompanionBuilder =
WordStatisticsCompanion Function({
Value<String> id,
required String userId,
required String cardId,
Value<int> correctAnswers,
Value<int> incorrectAnswers,
Value<double> mastery,
Value<PgDateTime?> lastReviewed,
Value<PgDateTime?> nextReview,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
typedef $$WordStatisticsTableUpdateCompanionBuilder =
WordStatisticsCompanion Function({
Value<String> id,
Value<String> userId,
Value<String> cardId,
Value<int> correctAnswers,
Value<int> incorrectAnswers,
Value<double> mastery,
Value<PgDateTime?> lastReviewed,
Value<PgDateTime?> nextReview,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<bool> isDeleted,
Value<PgDateTime?> deletedAt,
Value<int> rowid,
});
final class $$WordStatisticsTableReferences
extends BaseReferences<_$AppDatabase, $WordStatisticsTable, WordStatistic> {
$$WordStatisticsTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
$_aliasNameGenerator(db.wordStatistics.userId, db.users.id),
);
$$UsersTableProcessedTableManager get userId {
final $_column = $_itemColumn<String>('user_id')!;
final manager = $$UsersTableTableManager(
$_db,
$_db.users,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
static $GameCardsTable _cardIdTable(_$AppDatabase db) =>
db.gameCards.createAlias(
$_aliasNameGenerator(db.wordStatistics.cardId, db.gameCards.id),
);
$$GameCardsTableProcessedTableManager get cardId {
final $_column = $_itemColumn<String>('card_id')!;
final manager = $$GameCardsTableTableManager(
$_db,
$_db.gameCards,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_cardIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$WordStatisticsTableFilterComposer
extends Composer<_$AppDatabase, $WordStatisticsTable> {
$$WordStatisticsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get correctAnswers => $composableBuilder(
column: $table.correctAnswers,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<int> get incorrectAnswers => $composableBuilder(
column: $table.incorrectAnswers,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<double> get mastery => $composableBuilder(
column: $table.mastery,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get lastReviewed => $composableBuilder(
column: $table.lastReviewed,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get nextReview => $composableBuilder(
column: $table.nextReview,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnFilters(column),
);
$$UsersTableFilterComposer get userId {
final $$UsersTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableFilterComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$GameCardsTableFilterComposer get cardId {
final $$GameCardsTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableFilterComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$WordStatisticsTableOrderingComposer
extends Composer<_$AppDatabase, $WordStatisticsTable> {
$$WordStatisticsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get correctAnswers => $composableBuilder(
column: $table.correctAnswers,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<int> get incorrectAnswers => $composableBuilder(
column: $table.incorrectAnswers,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<double> get mastery => $composableBuilder(
column: $table.mastery,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get lastReviewed => $composableBuilder(
column: $table.lastReviewed,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get nextReview => $composableBuilder(
column: $table.nextReview,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<bool> get isDeleted => $composableBuilder(
column: $table.isDeleted,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get deletedAt => $composableBuilder(
column: $table.deletedAt,
builder: (column) => ColumnOrderings(column),
);
$$UsersTableOrderingComposer get userId {
final $$UsersTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableOrderingComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$GameCardsTableOrderingComposer get cardId {
final $$GameCardsTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableOrderingComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$WordStatisticsTableAnnotationComposer
extends Composer<_$AppDatabase, $WordStatisticsTable> {
$$WordStatisticsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<int> get correctAnswers => $composableBuilder(
column: $table.correctAnswers,
builder: (column) => column,
);
GeneratedColumn<int> get incorrectAnswers => $composableBuilder(
column: $table.incorrectAnswers,
builder: (column) => column,
);
GeneratedColumn<double> get mastery =>
$composableBuilder(column: $table.mastery, builder: (column) => column);
GeneratedColumn<PgDateTime> get lastReviewed => $composableBuilder(
column: $table.lastReviewed,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get nextReview => $composableBuilder(
column: $table.nextReview,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
GeneratedColumn<bool> get isDeleted =>
$composableBuilder(column: $table.isDeleted, builder: (column) => column);
GeneratedColumn<PgDateTime> get deletedAt =>
$composableBuilder(column: $table.deletedAt, builder: (column) => column);
$$UsersTableAnnotationComposer get userId {
final $$UsersTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableAnnotationComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
$$GameCardsTableAnnotationComposer get cardId {
final $$GameCardsTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.cardId,
referencedTable: $db.gameCards,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$GameCardsTableAnnotationComposer(
$db: $db,
$table: $db.gameCards,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$WordStatisticsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$WordStatisticsTable,
WordStatistic,
$$WordStatisticsTableFilterComposer,
$$WordStatisticsTableOrderingComposer,
$$WordStatisticsTableAnnotationComposer,
$$WordStatisticsTableCreateCompanionBuilder,
$$WordStatisticsTableUpdateCompanionBuilder,
(WordStatistic, $$WordStatisticsTableReferences),
WordStatistic,
PrefetchHooks Function({bool userId, bool cardId})
> {
$$WordStatisticsTableTableManager(
_$AppDatabase db,
$WordStatisticsTable table,
) : super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$WordStatisticsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$WordStatisticsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$WordStatisticsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> userId = const Value.absent(),
Value<String> cardId = const Value.absent(),
Value<int> correctAnswers = const Value.absent(),
Value<int> incorrectAnswers = const Value.absent(),
Value<double> mastery = const Value.absent(),
Value<PgDateTime?> lastReviewed = const Value.absent(),
Value<PgDateTime?> nextReview = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => WordStatisticsCompanion(
id: id,
userId: userId,
cardId: cardId,
correctAnswers: correctAnswers,
incorrectAnswers: incorrectAnswers,
mastery: mastery,
lastReviewed: lastReviewed,
nextReview: nextReview,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String userId,
required String cardId,
Value<int> correctAnswers = const Value.absent(),
Value<int> incorrectAnswers = const Value.absent(),
Value<double> mastery = const Value.absent(),
Value<PgDateTime?> lastReviewed = const Value.absent(),
Value<PgDateTime?> nextReview = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<bool> isDeleted = const Value.absent(),
Value<PgDateTime?> deletedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => WordStatisticsCompanion.insert(
id: id,
userId: userId,
cardId: cardId,
correctAnswers: correctAnswers,
incorrectAnswers: incorrectAnswers,
mastery: mastery,
lastReviewed: lastReviewed,
nextReview: nextReview,
createdAt: createdAt,
updatedAt: updatedAt,
isDeleted: isDeleted,
deletedAt: deletedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$WordStatisticsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({userId = false, cardId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (userId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.userId,
referencedTable: $$WordStatisticsTableReferences
._userIdTable(db),
referencedColumn:
$$WordStatisticsTableReferences
._userIdTable(db)
.id,
)
as T;
}
if (cardId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.cardId,
referencedTable: $$WordStatisticsTableReferences
._cardIdTable(db),
referencedColumn:
$$WordStatisticsTableReferences
._cardIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$WordStatisticsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$WordStatisticsTable,
WordStatistic,
$$WordStatisticsTableFilterComposer,
$$WordStatisticsTableOrderingComposer,
$$WordStatisticsTableAnnotationComposer,
$$WordStatisticsTableCreateCompanionBuilder,
$$WordStatisticsTableUpdateCompanionBuilder,
(WordStatistic, $$WordStatisticsTableReferences),
WordStatistic,
PrefetchHooks Function({bool userId, bool cardId})
>;
typedef $$UserAchievementsTableCreateCompanionBuilder =
UserAchievementsCompanion Function({
Value<String> id,
required String userId,
required String achievementId,
Value<PgDateTime> unlockedAt,
Value<double> progress,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
typedef $$UserAchievementsTableUpdateCompanionBuilder =
UserAchievementsCompanion Function({
Value<String> id,
Value<String> userId,
Value<String> achievementId,
Value<PgDateTime> unlockedAt,
Value<double> progress,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
final class $$UserAchievementsTableReferences
extends
BaseReferences<_$AppDatabase, $UserAchievementsTable, UserAchievement> {
$$UserAchievementsTableReferences(
super.$_db,
super.$_table,
super.$_typedResult,
);
static $UsersTable _userIdTable(_$AppDatabase db) => db.users.createAlias(
$_aliasNameGenerator(db.userAchievements.userId, db.users.id),
);
$$UsersTableProcessedTableManager get userId {
final $_column = $_itemColumn<String>('user_id')!;
final manager = $$UsersTableTableManager(
$_db,
$_db.users,
).filter((f) => f.id.sqlEquals($_column));
final item = $_typedResult.readTableOrNull(_userIdTable($_db));
if (item == null) return manager;
return ProcessedTableManager(
manager.$state.copyWith(prefetchedData: [item]),
);
}
}
class $$UserAchievementsTableFilterComposer
extends Composer<_$AppDatabase, $UserAchievementsTable> {
$$UserAchievementsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get achievementId => $composableBuilder(
column: $table.achievementId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get unlockedAt => $composableBuilder(
column: $table.unlockedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<double> get progress => $composableBuilder(
column: $table.progress,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
$$UsersTableFilterComposer get userId {
final $$UsersTableFilterComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableFilterComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserAchievementsTableOrderingComposer
extends Composer<_$AppDatabase, $UserAchievementsTable> {
$$UserAchievementsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get achievementId => $composableBuilder(
column: $table.achievementId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get unlockedAt => $composableBuilder(
column: $table.unlockedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<double> get progress => $composableBuilder(
column: $table.progress,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
$$UsersTableOrderingComposer get userId {
final $$UsersTableOrderingComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableOrderingComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserAchievementsTableAnnotationComposer
extends Composer<_$AppDatabase, $UserAchievementsTable> {
$$UserAchievementsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get achievementId => $composableBuilder(
column: $table.achievementId,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get unlockedAt => $composableBuilder(
column: $table.unlockedAt,
builder: (column) => column,
);
GeneratedColumn<double> get progress =>
$composableBuilder(column: $table.progress, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
$$UsersTableAnnotationComposer get userId {
final $$UsersTableAnnotationComposer composer = $composerBuilder(
composer: this,
getCurrentColumn: (t) => t.userId,
referencedTable: $db.users,
getReferencedColumn: (t) => t.id,
builder:
(
joinBuilder, {
$addJoinBuilderToRootComposer,
$removeJoinBuilderFromRootComposer,
}) => $$UsersTableAnnotationComposer(
$db: $db,
$table: $db.users,
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
joinBuilder: joinBuilder,
$removeJoinBuilderFromRootComposer:
$removeJoinBuilderFromRootComposer,
),
);
return composer;
}
}
class $$UserAchievementsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$UserAchievementsTable,
UserAchievement,
$$UserAchievementsTableFilterComposer,
$$UserAchievementsTableOrderingComposer,
$$UserAchievementsTableAnnotationComposer,
$$UserAchievementsTableCreateCompanionBuilder,
$$UserAchievementsTableUpdateCompanionBuilder,
(UserAchievement, $$UserAchievementsTableReferences),
UserAchievement,
PrefetchHooks Function({bool userId})
> {
$$UserAchievementsTableTableManager(
_$AppDatabase db,
$UserAchievementsTable table,
) : super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$UserAchievementsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$UserAchievementsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$UserAchievementsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> userId = const Value.absent(),
Value<String> achievementId = const Value.absent(),
Value<PgDateTime> unlockedAt = const Value.absent(),
Value<double> progress = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserAchievementsCompanion(
id: id,
userId: userId,
achievementId: achievementId,
unlockedAt: unlockedAt,
progress: progress,
createdAt: createdAt,
updatedAt: updatedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String userId,
required String achievementId,
Value<PgDateTime> unlockedAt = const Value.absent(),
Value<double> progress = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => UserAchievementsCompanion.insert(
id: id,
userId: userId,
achievementId: achievementId,
unlockedAt: unlockedAt,
progress: progress,
createdAt: createdAt,
updatedAt: updatedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map(
(e) => (
e.readTable(table),
$$UserAchievementsTableReferences(db, table, e),
),
)
.toList(),
prefetchHooksCallback: ({userId = false}) {
return PrefetchHooks(
db: db,
explicitlyWatchedTables: [],
addJoins:
<
T extends TableManagerState<
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic,
dynamic
>
>(state) {
if (userId) {
state =
state.withJoin(
currentTable: table,
currentColumn: table.userId,
referencedTable:
$$UserAchievementsTableReferences
._userIdTable(db),
referencedColumn:
$$UserAchievementsTableReferences
._userIdTable(db)
.id,
)
as T;
}
return state;
},
getPrefetchedDataCallback: (items) async {
return [];
},
);
},
),
);
}
typedef $$UserAchievementsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$UserAchievementsTable,
UserAchievement,
$$UserAchievementsTableFilterComposer,
$$UserAchievementsTableOrderingComposer,
$$UserAchievementsTableAnnotationComposer,
$$UserAchievementsTableCreateCompanionBuilder,
$$UserAchievementsTableUpdateCompanionBuilder,
(UserAchievement, $$UserAchievementsTableReferences),
UserAchievement,
PrefetchHooks Function({bool userId})
>;
typedef $$ShareRequestsTableCreateCompanionBuilder =
ShareRequestsCompanion Function({
Value<String> id,
required String telegramUserId,
Value<String?> telegramUsername,
Value<String?> sharedCardId,
Value<PgDateTime> requestedAt,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
typedef $$ShareRequestsTableUpdateCompanionBuilder =
ShareRequestsCompanion Function({
Value<String> id,
Value<String> telegramUserId,
Value<String?> telegramUsername,
Value<String?> sharedCardId,
Value<PgDateTime> requestedAt,
Value<PgDateTime> createdAt,
Value<PgDateTime> updatedAt,
Value<int> rowid,
});
class $$ShareRequestsTableFilterComposer
extends Composer<_$AppDatabase, $ShareRequestsTable> {
$$ShareRequestsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get telegramUserId => $composableBuilder(
column: $table.telegramUserId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get telegramUsername => $composableBuilder(
column: $table.telegramUsername,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get sharedCardId => $composableBuilder(
column: $table.sharedCardId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get requestedAt => $composableBuilder(
column: $table.requestedAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnFilters(column),
);
}
class $$ShareRequestsTableOrderingComposer
extends Composer<_$AppDatabase, $ShareRequestsTable> {
$$ShareRequestsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get telegramUserId => $composableBuilder(
column: $table.telegramUserId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get telegramUsername => $composableBuilder(
column: $table.telegramUsername,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get sharedCardId => $composableBuilder(
column: $table.sharedCardId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get requestedAt => $composableBuilder(
column: $table.requestedAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get updatedAt => $composableBuilder(
column: $table.updatedAt,
builder: (column) => ColumnOrderings(column),
);
}
class $$ShareRequestsTableAnnotationComposer
extends Composer<_$AppDatabase, $ShareRequestsTable> {
$$ShareRequestsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get telegramUserId => $composableBuilder(
column: $table.telegramUserId,
builder: (column) => column,
);
GeneratedColumn<String> get telegramUsername => $composableBuilder(
column: $table.telegramUsername,
builder: (column) => column,
);
GeneratedColumn<String> get sharedCardId => $composableBuilder(
column: $table.sharedCardId,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get requestedAt => $composableBuilder(
column: $table.requestedAt,
builder: (column) => column,
);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
GeneratedColumn<PgDateTime> get updatedAt =>
$composableBuilder(column: $table.updatedAt, builder: (column) => column);
}
class $$ShareRequestsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$ShareRequestsTable,
ShareRequest,
$$ShareRequestsTableFilterComposer,
$$ShareRequestsTableOrderingComposer,
$$ShareRequestsTableAnnotationComposer,
$$ShareRequestsTableCreateCompanionBuilder,
$$ShareRequestsTableUpdateCompanionBuilder,
(
ShareRequest,
BaseReferences<_$AppDatabase, $ShareRequestsTable, ShareRequest>,
),
ShareRequest,
PrefetchHooks Function()
> {
$$ShareRequestsTableTableManager(_$AppDatabase db, $ShareRequestsTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$ShareRequestsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$ShareRequestsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$ShareRequestsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> telegramUserId = const Value.absent(),
Value<String?> telegramUsername = const Value.absent(),
Value<String?> sharedCardId = const Value.absent(),
Value<PgDateTime> requestedAt = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => ShareRequestsCompanion(
id: id,
telegramUserId: telegramUserId,
telegramUsername: telegramUsername,
sharedCardId: sharedCardId,
requestedAt: requestedAt,
createdAt: createdAt,
updatedAt: updatedAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String telegramUserId,
Value<String?> telegramUsername = const Value.absent(),
Value<String?> sharedCardId = const Value.absent(),
Value<PgDateTime> requestedAt = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<PgDateTime> updatedAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => ShareRequestsCompanion.insert(
id: id,
telegramUserId: telegramUserId,
telegramUsername: telegramUsername,
sharedCardId: sharedCardId,
requestedAt: requestedAt,
createdAt: createdAt,
updatedAt: updatedAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
),
);
}
typedef $$ShareRequestsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$ShareRequestsTable,
ShareRequest,
$$ShareRequestsTableFilterComposer,
$$ShareRequestsTableOrderingComposer,
$$ShareRequestsTableAnnotationComposer,
$$ShareRequestsTableCreateCompanionBuilder,
$$ShareRequestsTableUpdateCompanionBuilder,
(
ShareRequest,
BaseReferences<_$AppDatabase, $ShareRequestsTable, ShareRequest>,
),
ShareRequest,
PrefetchHooks Function()
>;
typedef $$AuditLogsTableCreateCompanionBuilder =
AuditLogsCompanion Function({
Value<String> id,
required String table,
required String recordId,
required String action,
Value<String?> userId,
Value<String?> oldData,
Value<String?> newData,
Value<String?> ipAddress,
Value<String?> userAgent,
Value<PgDateTime> createdAt,
Value<int> rowid,
});
typedef $$AuditLogsTableUpdateCompanionBuilder =
AuditLogsCompanion Function({
Value<String> id,
Value<String> table,
Value<String> recordId,
Value<String> action,
Value<String?> userId,
Value<String?> oldData,
Value<String?> newData,
Value<String?> ipAddress,
Value<String?> userAgent,
Value<PgDateTime> createdAt,
Value<int> rowid,
});
class $$AuditLogsTableFilterComposer
extends Composer<_$AppDatabase, $AuditLogsTable> {
$$AuditLogsTableFilterComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnFilters<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get table => $composableBuilder(
column: $table.table,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get recordId => $composableBuilder(
column: $table.recordId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get action => $composableBuilder(
column: $table.action,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get userId => $composableBuilder(
column: $table.userId,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get oldData => $composableBuilder(
column: $table.oldData,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get newData => $composableBuilder(
column: $table.newData,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get ipAddress => $composableBuilder(
column: $table.ipAddress,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<String> get userAgent => $composableBuilder(
column: $table.userAgent,
builder: (column) => ColumnFilters(column),
);
ColumnFilters<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnFilters(column),
);
}
class $$AuditLogsTableOrderingComposer
extends Composer<_$AppDatabase, $AuditLogsTable> {
$$AuditLogsTableOrderingComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
ColumnOrderings<String> get id => $composableBuilder(
column: $table.id,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get table => $composableBuilder(
column: $table.table,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get recordId => $composableBuilder(
column: $table.recordId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get action => $composableBuilder(
column: $table.action,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get userId => $composableBuilder(
column: $table.userId,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get oldData => $composableBuilder(
column: $table.oldData,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get newData => $composableBuilder(
column: $table.newData,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get ipAddress => $composableBuilder(
column: $table.ipAddress,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<String> get userAgent => $composableBuilder(
column: $table.userAgent,
builder: (column) => ColumnOrderings(column),
);
ColumnOrderings<PgDateTime> get createdAt => $composableBuilder(
column: $table.createdAt,
builder: (column) => ColumnOrderings(column),
);
}
class $$AuditLogsTableAnnotationComposer
extends Composer<_$AppDatabase, $AuditLogsTable> {
$$AuditLogsTableAnnotationComposer({
required super.$db,
required super.$table,
super.joinBuilder,
super.$addJoinBuilderToRootComposer,
super.$removeJoinBuilderFromRootComposer,
});
GeneratedColumn<String> get id =>
$composableBuilder(column: $table.id, builder: (column) => column);
GeneratedColumn<String> get table =>
$composableBuilder(column: $table.table, builder: (column) => column);
GeneratedColumn<String> get recordId =>
$composableBuilder(column: $table.recordId, builder: (column) => column);
GeneratedColumn<String> get action =>
$composableBuilder(column: $table.action, builder: (column) => column);
GeneratedColumn<String> get userId =>
$composableBuilder(column: $table.userId, builder: (column) => column);
GeneratedColumn<String> get oldData =>
$composableBuilder(column: $table.oldData, builder: (column) => column);
GeneratedColumn<String> get newData =>
$composableBuilder(column: $table.newData, builder: (column) => column);
GeneratedColumn<String> get ipAddress =>
$composableBuilder(column: $table.ipAddress, builder: (column) => column);
GeneratedColumn<String> get userAgent =>
$composableBuilder(column: $table.userAgent, builder: (column) => column);
GeneratedColumn<PgDateTime> get createdAt =>
$composableBuilder(column: $table.createdAt, builder: (column) => column);
}
class $$AuditLogsTableTableManager
extends
RootTableManager<
_$AppDatabase,
$AuditLogsTable,
AuditLog,
$$AuditLogsTableFilterComposer,
$$AuditLogsTableOrderingComposer,
$$AuditLogsTableAnnotationComposer,
$$AuditLogsTableCreateCompanionBuilder,
$$AuditLogsTableUpdateCompanionBuilder,
(AuditLog, BaseReferences<_$AppDatabase, $AuditLogsTable, AuditLog>),
AuditLog,
PrefetchHooks Function()
> {
$$AuditLogsTableTableManager(_$AppDatabase db, $AuditLogsTable table)
: super(
TableManagerState(
db: db,
table: table,
createFilteringComposer: () =>
$$AuditLogsTableFilterComposer($db: db, $table: table),
createOrderingComposer: () =>
$$AuditLogsTableOrderingComposer($db: db, $table: table),
createComputedFieldComposer: () =>
$$AuditLogsTableAnnotationComposer($db: db, $table: table),
updateCompanionCallback:
({
Value<String> id = const Value.absent(),
Value<String> table = const Value.absent(),
Value<String> recordId = const Value.absent(),
Value<String> action = const Value.absent(),
Value<String?> userId = const Value.absent(),
Value<String?> oldData = const Value.absent(),
Value<String?> newData = const Value.absent(),
Value<String?> ipAddress = const Value.absent(),
Value<String?> userAgent = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => AuditLogsCompanion(
id: id,
table: table,
recordId: recordId,
action: action,
userId: userId,
oldData: oldData,
newData: newData,
ipAddress: ipAddress,
userAgent: userAgent,
createdAt: createdAt,
rowid: rowid,
),
createCompanionCallback:
({
Value<String> id = const Value.absent(),
required String table,
required String recordId,
required String action,
Value<String?> userId = const Value.absent(),
Value<String?> oldData = const Value.absent(),
Value<String?> newData = const Value.absent(),
Value<String?> ipAddress = const Value.absent(),
Value<String?> userAgent = const Value.absent(),
Value<PgDateTime> createdAt = const Value.absent(),
Value<int> rowid = const Value.absent(),
}) => AuditLogsCompanion.insert(
id: id,
table: table,
recordId: recordId,
action: action,
userId: userId,
oldData: oldData,
newData: newData,
ipAddress: ipAddress,
userAgent: userAgent,
createdAt: createdAt,
rowid: rowid,
),
withReferenceMapper: (p0) => p0
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
.toList(),
prefetchHooksCallback: null,
),
);
}
typedef $$AuditLogsTableProcessedTableManager =
ProcessedTableManager<
_$AppDatabase,
$AuditLogsTable,
AuditLog,
$$AuditLogsTableFilterComposer,
$$AuditLogsTableOrderingComposer,
$$AuditLogsTableAnnotationComposer,
$$AuditLogsTableCreateCompanionBuilder,
$$AuditLogsTableUpdateCompanionBuilder,
(AuditLog, BaseReferences<_$AppDatabase, $AuditLogsTable, AuditLog>),
AuditLog,
PrefetchHooks Function()
>;
class $AppDatabaseManager {
final _$AppDatabase _db;
$AppDatabaseManager(this._db);
$$UsersTableTableManager get users =>
$$UsersTableTableManager(_db, _db.users);
$$UserDatasTableTableManager get userDatas =>
$$UserDatasTableTableManager(_db, _db.userDatas);
$$TokensTableTableManager get tokens =>
$$TokensTableTableManager(_db, _db.tokens);
$$RefreshTokensTableTableManager get refreshTokens =>
$$RefreshTokensTableTableManager(_db, _db.refreshTokens);
$$TelegramAuthCodesTableTableManager get telegramAuthCodes =>
$$TelegramAuthCodesTableTableManager(_db, _db.telegramAuthCodes);
$$CardPacksTableTableManager get cardPacks =>
$$CardPacksTableTableManager(_db, _db.cardPacks);
$$GameCardsTableTableManager get gameCards =>
$$GameCardsTableTableManager(_db, _db.gameCards);
$$VoiceModelsTableTableManager get voiceModels =>
$$VoiceModelsTableTableManager(_db, _db.voiceModels);
$$UserPacksTableTableManager get userPacks =>
$$UserPacksTableTableManager(_db, _db.userPacks);
$$PreviewCardsTableTableManager get previewCards =>
$$PreviewCardsTableTableManager(_db, _db.previewCards);
$$CardPackCardsTableTableManager get cardPackCards =>
$$CardPackCardsTableTableManager(_db, _db.cardPackCards);
$$CardVoicesTableTableManager get cardVoices =>
$$CardVoicesTableTableManager(_db, _db.cardVoices);
$$SubscriptionPlansTableTableManager get subscriptionPlans =>
$$SubscriptionPlansTableTableManager(_db, _db.subscriptionPlans);
$$UserSubscriptionsTableTableManager get userSubscriptions =>
$$UserSubscriptionsTableTableManager(_db, _db.userSubscriptions);
$$PaymentsTableTableManager get payments =>
$$PaymentsTableTableManager(_db, _db.payments);
$$TestsTableTableManager get tests =>
$$TestsTableTableManager(_db, _db.tests);
$$TestQuestionsTableTableManager get testQuestions =>
$$TestQuestionsTableTableManager(_db, _db.testQuestions);
$$TestPackRelationsTableTableManager get testPackRelations =>
$$TestPackRelationsTableTableManager(_db, _db.testPackRelations);
$$TestStatisticsTableTableManager get testStatistics =>
$$TestStatisticsTableTableManager(_db, _db.testStatistics);
$$TasksTableTableManager get tasks =>
$$TasksTableTableManager(_db, _db.tasks);
$$UserTasksTableTableManager get userTasks =>
$$UserTasksTableTableManager(_db, _db.userTasks);
$$UserTaskProgressesTableTableManager get userTaskProgresses =>
$$UserTaskProgressesTableTableManager(_db, _db.userTaskProgresses);
$$UserTaskResultsTableTableManager get userTaskResults =>
$$UserTaskResultsTableTableManager(_db, _db.userTaskResults);
$$PromoCodesCampaignsTableTableManager get promoCodesCampaigns =>
$$PromoCodesCampaignsTableTableManager(_db, _db.promoCodesCampaigns);
$$PromoCodesTableTableManager get promoCodes =>
$$PromoCodesTableTableManager(_db, _db.promoCodes);
$$DiscountCampaignsTableTableManager get discountCampaigns =>
$$DiscountCampaignsTableTableManager(_db, _db.discountCampaigns);
$$DiscountsTableTableManager get discounts =>
$$DiscountsTableTableManager(_db, _db.discounts);
$$DiscountUserDatasTableTableManager get discountUserDatas =>
$$DiscountUserDatasTableTableManager(_db, _db.discountUserDatas);
$$StudySessionsTableTableManager get studySessions =>
$$StudySessionsTableTableManager(_db, _db.studySessions);
$$WordStatisticsTableTableManager get wordStatistics =>
$$WordStatisticsTableTableManager(_db, _db.wordStatistics);
$$UserAchievementsTableTableManager get userAchievements =>
$$UserAchievementsTableTableManager(_db, _db.userAchievements);
$$ShareRequestsTableTableManager get shareRequests =>
$$ShareRequestsTableTableManager(_db, _db.shareRequests);
$$AuditLogsTableTableManager get auditLogs =>
$$AuditLogsTableTableManager(_db, _db.auditLogs);
}