2023-04-09 14:39:41 +12:00
|
|
|
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
|
|
|
|
part of 'database.dart';
|
|
|
|
|
|
|
|
// **************************************************************************
|
|
|
|
// MoorGenerator
|
|
|
|
// **************************************************************************
|
|
|
|
|
|
|
|
// ignore_for_file: type=lint
|
|
|
|
class Setting extends DataClass implements Insertable<Setting> {
|
|
|
|
final bool alarm;
|
|
|
|
final bool vibrate;
|
|
|
|
final String sound;
|
|
|
|
final bool notify;
|
|
|
|
final bool images;
|
|
|
|
final bool showUnit;
|
|
|
|
final String? lightColor;
|
|
|
|
final String? darkColor;
|
|
|
|
final bool steps;
|
|
|
|
final String date;
|
|
|
|
final bool showDate;
|
|
|
|
final String theme;
|
|
|
|
final bool showSets;
|
|
|
|
final bool noSound;
|
|
|
|
final bool backup;
|
|
|
|
Setting(
|
|
|
|
{required this.alarm,
|
|
|
|
required this.vibrate,
|
|
|
|
required this.sound,
|
|
|
|
required this.notify,
|
|
|
|
required this.images,
|
|
|
|
required this.showUnit,
|
|
|
|
this.lightColor,
|
|
|
|
this.darkColor,
|
|
|
|
required this.steps,
|
|
|
|
required this.date,
|
|
|
|
required this.showDate,
|
|
|
|
required this.theme,
|
|
|
|
required this.showSets,
|
|
|
|
required this.noSound,
|
|
|
|
required this.backup});
|
|
|
|
factory Setting.fromData(Map<String, dynamic> data, GeneratedDatabase db,
|
|
|
|
{String? prefix}) {
|
|
|
|
final effectivePrefix = prefix ?? '';
|
|
|
|
return Setting(
|
|
|
|
alarm: const BoolType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}alarm'])!,
|
|
|
|
vibrate: const BoolType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}vibrate'])!,
|
|
|
|
sound: const StringType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}sound'])!,
|
|
|
|
notify: const BoolType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}notify'])!,
|
|
|
|
images: const BoolType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}images'])!,
|
|
|
|
showUnit: const BoolType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}show_unit'])!,
|
|
|
|
lightColor: const StringType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}light_color']),
|
|
|
|
darkColor: const StringType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}dark_color']),
|
|
|
|
steps: const BoolType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}steps'])!,
|
|
|
|
date: const StringType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}date'])!,
|
|
|
|
showDate: const BoolType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}show_date'])!,
|
|
|
|
theme: const StringType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}theme'])!,
|
|
|
|
showSets: const BoolType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}show_sets'])!,
|
|
|
|
noSound: const BoolType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}no_sound'])!,
|
|
|
|
backup: const BoolType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}backup'])!,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
@override
|
|
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
|
|
final map = <String, Expression>{};
|
|
|
|
map['alarm'] = Variable<bool>(alarm);
|
|
|
|
map['vibrate'] = Variable<bool>(vibrate);
|
|
|
|
map['sound'] = Variable<String>(sound);
|
|
|
|
map['notify'] = Variable<bool>(notify);
|
|
|
|
map['images'] = Variable<bool>(images);
|
|
|
|
map['show_unit'] = Variable<bool>(showUnit);
|
|
|
|
if (!nullToAbsent || lightColor != null) {
|
|
|
|
map['light_color'] = Variable<String?>(lightColor);
|
|
|
|
}
|
|
|
|
if (!nullToAbsent || darkColor != null) {
|
|
|
|
map['dark_color'] = Variable<String?>(darkColor);
|
|
|
|
}
|
|
|
|
map['steps'] = Variable<bool>(steps);
|
|
|
|
map['date'] = Variable<String>(date);
|
|
|
|
map['show_date'] = Variable<bool>(showDate);
|
|
|
|
map['theme'] = Variable<String>(theme);
|
|
|
|
map['show_sets'] = Variable<bool>(showSets);
|
|
|
|
map['no_sound'] = Variable<bool>(noSound);
|
|
|
|
map['backup'] = Variable<bool>(backup);
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingsCompanion toCompanion(bool nullToAbsent) {
|
|
|
|
return SettingsCompanion(
|
|
|
|
alarm: Value(alarm),
|
|
|
|
vibrate: Value(vibrate),
|
|
|
|
sound: Value(sound),
|
|
|
|
notify: Value(notify),
|
|
|
|
images: Value(images),
|
|
|
|
showUnit: Value(showUnit),
|
|
|
|
lightColor: lightColor == null && nullToAbsent
|
|
|
|
? const Value.absent()
|
|
|
|
: Value(lightColor),
|
|
|
|
darkColor: darkColor == null && nullToAbsent
|
|
|
|
? const Value.absent()
|
|
|
|
: Value(darkColor),
|
|
|
|
steps: Value(steps),
|
|
|
|
date: Value(date),
|
|
|
|
showDate: Value(showDate),
|
|
|
|
theme: Value(theme),
|
|
|
|
showSets: Value(showSets),
|
|
|
|
noSound: Value(noSound),
|
|
|
|
backup: Value(backup),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
factory Setting.fromJson(Map<String, dynamic> json,
|
|
|
|
{ValueSerializer? serializer}) {
|
|
|
|
serializer ??= moorRuntimeOptions.defaultSerializer;
|
|
|
|
return Setting(
|
|
|
|
alarm: serializer.fromJson<bool>(json['alarm']),
|
|
|
|
vibrate: serializer.fromJson<bool>(json['vibrate']),
|
|
|
|
sound: serializer.fromJson<String>(json['sound']),
|
|
|
|
notify: serializer.fromJson<bool>(json['notify']),
|
|
|
|
images: serializer.fromJson<bool>(json['images']),
|
|
|
|
showUnit: serializer.fromJson<bool>(json['showUnit']),
|
|
|
|
lightColor: serializer.fromJson<String?>(json['lightColor']),
|
|
|
|
darkColor: serializer.fromJson<String?>(json['darkColor']),
|
|
|
|
steps: serializer.fromJson<bool>(json['steps']),
|
|
|
|
date: serializer.fromJson<String>(json['date']),
|
|
|
|
showDate: serializer.fromJson<bool>(json['showDate']),
|
|
|
|
theme: serializer.fromJson<String>(json['theme']),
|
|
|
|
showSets: serializer.fromJson<bool>(json['showSets']),
|
|
|
|
noSound: serializer.fromJson<bool>(json['noSound']),
|
|
|
|
backup: serializer.fromJson<bool>(json['backup']),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
@override
|
|
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
|
|
serializer ??= moorRuntimeOptions.defaultSerializer;
|
|
|
|
return <String, dynamic>{
|
|
|
|
'alarm': serializer.toJson<bool>(alarm),
|
|
|
|
'vibrate': serializer.toJson<bool>(vibrate),
|
|
|
|
'sound': serializer.toJson<String>(sound),
|
|
|
|
'notify': serializer.toJson<bool>(notify),
|
|
|
|
'images': serializer.toJson<bool>(images),
|
|
|
|
'showUnit': serializer.toJson<bool>(showUnit),
|
|
|
|
'lightColor': serializer.toJson<String?>(lightColor),
|
|
|
|
'darkColor': serializer.toJson<String?>(darkColor),
|
|
|
|
'steps': serializer.toJson<bool>(steps),
|
|
|
|
'date': serializer.toJson<String>(date),
|
|
|
|
'showDate': serializer.toJson<bool>(showDate),
|
|
|
|
'theme': serializer.toJson<String>(theme),
|
|
|
|
'showSets': serializer.toJson<bool>(showSets),
|
|
|
|
'noSound': serializer.toJson<bool>(noSound),
|
|
|
|
'backup': serializer.toJson<bool>(backup),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
Setting copyWith(
|
|
|
|
{bool? alarm,
|
|
|
|
bool? vibrate,
|
|
|
|
String? sound,
|
|
|
|
bool? notify,
|
|
|
|
bool? images,
|
|
|
|
bool? showUnit,
|
|
|
|
String? lightColor,
|
|
|
|
String? darkColor,
|
|
|
|
bool? steps,
|
|
|
|
String? date,
|
|
|
|
bool? showDate,
|
|
|
|
String? theme,
|
|
|
|
bool? showSets,
|
|
|
|
bool? noSound,
|
|
|
|
bool? backup}) =>
|
|
|
|
Setting(
|
|
|
|
alarm: alarm ?? this.alarm,
|
|
|
|
vibrate: vibrate ?? this.vibrate,
|
|
|
|
sound: sound ?? this.sound,
|
|
|
|
notify: notify ?? this.notify,
|
|
|
|
images: images ?? this.images,
|
|
|
|
showUnit: showUnit ?? this.showUnit,
|
|
|
|
lightColor: lightColor ?? this.lightColor,
|
|
|
|
darkColor: darkColor ?? this.darkColor,
|
|
|
|
steps: steps ?? this.steps,
|
|
|
|
date: date ?? this.date,
|
|
|
|
showDate: showDate ?? this.showDate,
|
|
|
|
theme: theme ?? this.theme,
|
|
|
|
showSets: showSets ?? this.showSets,
|
|
|
|
noSound: noSound ?? this.noSound,
|
|
|
|
backup: backup ?? this.backup,
|
|
|
|
);
|
|
|
|
@override
|
|
|
|
String toString() {
|
|
|
|
return (StringBuffer('Setting(')
|
|
|
|
..write('alarm: $alarm, ')
|
|
|
|
..write('vibrate: $vibrate, ')
|
|
|
|
..write('sound: $sound, ')
|
|
|
|
..write('notify: $notify, ')
|
|
|
|
..write('images: $images, ')
|
|
|
|
..write('showUnit: $showUnit, ')
|
|
|
|
..write('lightColor: $lightColor, ')
|
|
|
|
..write('darkColor: $darkColor, ')
|
|
|
|
..write('steps: $steps, ')
|
|
|
|
..write('date: $date, ')
|
|
|
|
..write('showDate: $showDate, ')
|
|
|
|
..write('theme: $theme, ')
|
|
|
|
..write('showSets: $showSets, ')
|
|
|
|
..write('noSound: $noSound, ')
|
|
|
|
..write('backup: $backup')
|
|
|
|
..write(')'))
|
|
|
|
.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get hashCode => Object.hash(
|
|
|
|
alarm,
|
|
|
|
vibrate,
|
|
|
|
sound,
|
|
|
|
notify,
|
|
|
|
images,
|
|
|
|
showUnit,
|
|
|
|
lightColor,
|
|
|
|
darkColor,
|
|
|
|
steps,
|
|
|
|
date,
|
|
|
|
showDate,
|
|
|
|
theme,
|
|
|
|
showSets,
|
|
|
|
noSound,
|
|
|
|
backup);
|
|
|
|
@override
|
|
|
|
bool operator ==(Object other) =>
|
|
|
|
identical(this, other) ||
|
|
|
|
(other is Setting &&
|
|
|
|
other.alarm == this.alarm &&
|
|
|
|
other.vibrate == this.vibrate &&
|
|
|
|
other.sound == this.sound &&
|
|
|
|
other.notify == this.notify &&
|
|
|
|
other.images == this.images &&
|
|
|
|
other.showUnit == this.showUnit &&
|
|
|
|
other.lightColor == this.lightColor &&
|
|
|
|
other.darkColor == this.darkColor &&
|
|
|
|
other.steps == this.steps &&
|
|
|
|
other.date == this.date &&
|
|
|
|
other.showDate == this.showDate &&
|
|
|
|
other.theme == this.theme &&
|
|
|
|
other.showSets == this.showSets &&
|
|
|
|
other.noSound == this.noSound &&
|
|
|
|
other.backup == this.backup);
|
|
|
|
}
|
|
|
|
|
|
|
|
class SettingsCompanion extends UpdateCompanion<Setting> {
|
|
|
|
final Value<bool> alarm;
|
|
|
|
final Value<bool> vibrate;
|
|
|
|
final Value<String> sound;
|
|
|
|
final Value<bool> notify;
|
|
|
|
final Value<bool> images;
|
|
|
|
final Value<bool> showUnit;
|
|
|
|
final Value<String?> lightColor;
|
|
|
|
final Value<String?> darkColor;
|
|
|
|
final Value<bool> steps;
|
|
|
|
final Value<String> date;
|
|
|
|
final Value<bool> showDate;
|
|
|
|
final Value<String> theme;
|
|
|
|
final Value<bool> showSets;
|
|
|
|
final Value<bool> noSound;
|
|
|
|
final Value<bool> backup;
|
|
|
|
const SettingsCompanion({
|
|
|
|
this.alarm = const Value.absent(),
|
|
|
|
this.vibrate = const Value.absent(),
|
|
|
|
this.sound = const Value.absent(),
|
|
|
|
this.notify = const Value.absent(),
|
|
|
|
this.images = const Value.absent(),
|
|
|
|
this.showUnit = const Value.absent(),
|
|
|
|
this.lightColor = const Value.absent(),
|
|
|
|
this.darkColor = const Value.absent(),
|
|
|
|
this.steps = const Value.absent(),
|
|
|
|
this.date = const Value.absent(),
|
|
|
|
this.showDate = const Value.absent(),
|
|
|
|
this.theme = const Value.absent(),
|
|
|
|
this.showSets = const Value.absent(),
|
|
|
|
this.noSound = const Value.absent(),
|
|
|
|
this.backup = const Value.absent(),
|
|
|
|
});
|
|
|
|
SettingsCompanion.insert({
|
|
|
|
required bool alarm,
|
|
|
|
required bool vibrate,
|
|
|
|
required String sound,
|
|
|
|
required bool notify,
|
|
|
|
required bool images,
|
|
|
|
required bool showUnit,
|
|
|
|
this.lightColor = const Value.absent(),
|
|
|
|
this.darkColor = const Value.absent(),
|
|
|
|
required bool steps,
|
|
|
|
required String date,
|
|
|
|
required bool showDate,
|
|
|
|
required String theme,
|
|
|
|
required bool showSets,
|
|
|
|
required bool noSound,
|
|
|
|
required bool backup,
|
|
|
|
}) : alarm = Value(alarm),
|
|
|
|
vibrate = Value(vibrate),
|
|
|
|
sound = Value(sound),
|
|
|
|
notify = Value(notify),
|
|
|
|
images = Value(images),
|
|
|
|
showUnit = Value(showUnit),
|
|
|
|
steps = Value(steps),
|
|
|
|
date = Value(date),
|
|
|
|
showDate = Value(showDate),
|
|
|
|
theme = Value(theme),
|
|
|
|
showSets = Value(showSets),
|
|
|
|
noSound = Value(noSound),
|
|
|
|
backup = Value(backup);
|
|
|
|
static Insertable<Setting> custom({
|
|
|
|
Expression<bool>? alarm,
|
|
|
|
Expression<bool>? vibrate,
|
|
|
|
Expression<String>? sound,
|
|
|
|
Expression<bool>? notify,
|
|
|
|
Expression<bool>? images,
|
|
|
|
Expression<bool>? showUnit,
|
|
|
|
Expression<String?>? lightColor,
|
|
|
|
Expression<String?>? darkColor,
|
|
|
|
Expression<bool>? steps,
|
|
|
|
Expression<String>? date,
|
|
|
|
Expression<bool>? showDate,
|
|
|
|
Expression<String>? theme,
|
|
|
|
Expression<bool>? showSets,
|
|
|
|
Expression<bool>? noSound,
|
|
|
|
Expression<bool>? backup,
|
|
|
|
}) {
|
|
|
|
return RawValuesInsertable({
|
|
|
|
if (alarm != null) 'alarm': alarm,
|
|
|
|
if (vibrate != null) 'vibrate': vibrate,
|
|
|
|
if (sound != null) 'sound': sound,
|
|
|
|
if (notify != null) 'notify': notify,
|
|
|
|
if (images != null) 'images': images,
|
|
|
|
if (showUnit != null) 'show_unit': showUnit,
|
|
|
|
if (lightColor != null) 'light_color': lightColor,
|
|
|
|
if (darkColor != null) 'dark_color': darkColor,
|
|
|
|
if (steps != null) 'steps': steps,
|
|
|
|
if (date != null) 'date': date,
|
|
|
|
if (showDate != null) 'show_date': showDate,
|
|
|
|
if (theme != null) 'theme': theme,
|
|
|
|
if (showSets != null) 'show_sets': showSets,
|
|
|
|
if (noSound != null) 'no_sound': noSound,
|
|
|
|
if (backup != null) 'backup': backup,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
SettingsCompanion copyWith(
|
|
|
|
{Value<bool>? alarm,
|
|
|
|
Value<bool>? vibrate,
|
|
|
|
Value<String>? sound,
|
|
|
|
Value<bool>? notify,
|
|
|
|
Value<bool>? images,
|
|
|
|
Value<bool>? showUnit,
|
|
|
|
Value<String?>? lightColor,
|
|
|
|
Value<String?>? darkColor,
|
|
|
|
Value<bool>? steps,
|
|
|
|
Value<String>? date,
|
|
|
|
Value<bool>? showDate,
|
|
|
|
Value<String>? theme,
|
|
|
|
Value<bool>? showSets,
|
|
|
|
Value<bool>? noSound,
|
|
|
|
Value<bool>? backup}) {
|
|
|
|
return SettingsCompanion(
|
|
|
|
alarm: alarm ?? this.alarm,
|
|
|
|
vibrate: vibrate ?? this.vibrate,
|
|
|
|
sound: sound ?? this.sound,
|
|
|
|
notify: notify ?? this.notify,
|
|
|
|
images: images ?? this.images,
|
|
|
|
showUnit: showUnit ?? this.showUnit,
|
|
|
|
lightColor: lightColor ?? this.lightColor,
|
|
|
|
darkColor: darkColor ?? this.darkColor,
|
|
|
|
steps: steps ?? this.steps,
|
|
|
|
date: date ?? this.date,
|
|
|
|
showDate: showDate ?? this.showDate,
|
|
|
|
theme: theme ?? this.theme,
|
|
|
|
showSets: showSets ?? this.showSets,
|
|
|
|
noSound: noSound ?? this.noSound,
|
|
|
|
backup: backup ?? this.backup,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
|
|
final map = <String, Expression>{};
|
|
|
|
if (alarm.present) {
|
|
|
|
map['alarm'] = Variable<bool>(alarm.value);
|
|
|
|
}
|
|
|
|
if (vibrate.present) {
|
|
|
|
map['vibrate'] = Variable<bool>(vibrate.value);
|
|
|
|
}
|
|
|
|
if (sound.present) {
|
|
|
|
map['sound'] = Variable<String>(sound.value);
|
|
|
|
}
|
|
|
|
if (notify.present) {
|
|
|
|
map['notify'] = Variable<bool>(notify.value);
|
|
|
|
}
|
|
|
|
if (images.present) {
|
|
|
|
map['images'] = Variable<bool>(images.value);
|
|
|
|
}
|
|
|
|
if (showUnit.present) {
|
|
|
|
map['show_unit'] = Variable<bool>(showUnit.value);
|
|
|
|
}
|
|
|
|
if (lightColor.present) {
|
|
|
|
map['light_color'] = Variable<String?>(lightColor.value);
|
|
|
|
}
|
|
|
|
if (darkColor.present) {
|
|
|
|
map['dark_color'] = Variable<String?>(darkColor.value);
|
|
|
|
}
|
|
|
|
if (steps.present) {
|
|
|
|
map['steps'] = Variable<bool>(steps.value);
|
|
|
|
}
|
|
|
|
if (date.present) {
|
|
|
|
map['date'] = Variable<String>(date.value);
|
|
|
|
}
|
|
|
|
if (showDate.present) {
|
|
|
|
map['show_date'] = Variable<bool>(showDate.value);
|
|
|
|
}
|
|
|
|
if (theme.present) {
|
|
|
|
map['theme'] = Variable<String>(theme.value);
|
|
|
|
}
|
|
|
|
if (showSets.present) {
|
|
|
|
map['show_sets'] = Variable<bool>(showSets.value);
|
|
|
|
}
|
|
|
|
if (noSound.present) {
|
|
|
|
map['no_sound'] = Variable<bool>(noSound.value);
|
|
|
|
}
|
|
|
|
if (backup.present) {
|
|
|
|
map['backup'] = Variable<bool>(backup.value);
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() {
|
|
|
|
return (StringBuffer('SettingsCompanion(')
|
|
|
|
..write('alarm: $alarm, ')
|
|
|
|
..write('vibrate: $vibrate, ')
|
|
|
|
..write('sound: $sound, ')
|
|
|
|
..write('notify: $notify, ')
|
|
|
|
..write('images: $images, ')
|
|
|
|
..write('showUnit: $showUnit, ')
|
|
|
|
..write('lightColor: $lightColor, ')
|
|
|
|
..write('darkColor: $darkColor, ')
|
|
|
|
..write('steps: $steps, ')
|
|
|
|
..write('date: $date, ')
|
|
|
|
..write('showDate: $showDate, ')
|
|
|
|
..write('theme: $theme, ')
|
|
|
|
..write('showSets: $showSets, ')
|
|
|
|
..write('noSound: $noSound, ')
|
|
|
|
..write('backup: $backup')
|
|
|
|
..write(')'))
|
|
|
|
.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class $SettingsTable extends Settings with TableInfo<$SettingsTable, Setting> {
|
|
|
|
@override
|
|
|
|
final GeneratedDatabase attachedDatabase;
|
|
|
|
final String? _alias;
|
|
|
|
$SettingsTable(this.attachedDatabase, [this._alias]);
|
|
|
|
final VerificationMeta _alarmMeta = const VerificationMeta('alarm');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<bool?> alarm = GeneratedColumn<bool?>(
|
|
|
|
'alarm', aliasedName, false,
|
|
|
|
type: const BoolType(),
|
|
|
|
requiredDuringInsert: true,
|
|
|
|
defaultConstraints: 'CHECK (alarm IN (0, 1))');
|
|
|
|
final VerificationMeta _vibrateMeta = const VerificationMeta('vibrate');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<bool?> vibrate = GeneratedColumn<bool?>(
|
|
|
|
'vibrate', aliasedName, false,
|
|
|
|
type: const BoolType(),
|
|
|
|
requiredDuringInsert: true,
|
|
|
|
defaultConstraints: 'CHECK (vibrate IN (0, 1))');
|
|
|
|
final VerificationMeta _soundMeta = const VerificationMeta('sound');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<String?> sound = GeneratedColumn<String?>(
|
|
|
|
'sound', aliasedName, false,
|
|
|
|
type: const StringType(), requiredDuringInsert: true);
|
|
|
|
final VerificationMeta _notifyMeta = const VerificationMeta('notify');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<bool?> notify = GeneratedColumn<bool?>(
|
|
|
|
'notify', aliasedName, false,
|
|
|
|
type: const BoolType(),
|
|
|
|
requiredDuringInsert: true,
|
|
|
|
defaultConstraints: 'CHECK (notify IN (0, 1))');
|
|
|
|
final VerificationMeta _imagesMeta = const VerificationMeta('images');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<bool?> images = GeneratedColumn<bool?>(
|
|
|
|
'images', aliasedName, false,
|
|
|
|
type: const BoolType(),
|
|
|
|
requiredDuringInsert: true,
|
|
|
|
defaultConstraints: 'CHECK (images IN (0, 1))');
|
|
|
|
final VerificationMeta _showUnitMeta = const VerificationMeta('showUnit');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<bool?> showUnit = GeneratedColumn<bool?>(
|
|
|
|
'show_unit', aliasedName, false,
|
|
|
|
type: const BoolType(),
|
|
|
|
requiredDuringInsert: true,
|
|
|
|
defaultConstraints: 'CHECK (show_unit IN (0, 1))');
|
|
|
|
final VerificationMeta _lightColorMeta = const VerificationMeta('lightColor');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<String?> lightColor = GeneratedColumn<String?>(
|
|
|
|
'light_color', aliasedName, true,
|
|
|
|
type: const StringType(), requiredDuringInsert: false);
|
|
|
|
final VerificationMeta _darkColorMeta = const VerificationMeta('darkColor');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<String?> darkColor = GeneratedColumn<String?>(
|
|
|
|
'dark_color', aliasedName, true,
|
|
|
|
type: const StringType(), requiredDuringInsert: false);
|
|
|
|
final VerificationMeta _stepsMeta = const VerificationMeta('steps');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<bool?> steps = GeneratedColumn<bool?>(
|
|
|
|
'steps', aliasedName, false,
|
|
|
|
type: const BoolType(),
|
|
|
|
requiredDuringInsert: true,
|
|
|
|
defaultConstraints: 'CHECK (steps IN (0, 1))');
|
|
|
|
final VerificationMeta _dateMeta = const VerificationMeta('date');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<String?> date = GeneratedColumn<String?>(
|
|
|
|
'date', aliasedName, false,
|
|
|
|
type: const StringType(), requiredDuringInsert: true);
|
|
|
|
final VerificationMeta _showDateMeta = const VerificationMeta('showDate');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<bool?> showDate = GeneratedColumn<bool?>(
|
|
|
|
'show_date', aliasedName, false,
|
|
|
|
type: const BoolType(),
|
|
|
|
requiredDuringInsert: true,
|
|
|
|
defaultConstraints: 'CHECK (show_date IN (0, 1))');
|
|
|
|
final VerificationMeta _themeMeta = const VerificationMeta('theme');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<String?> theme = GeneratedColumn<String?>(
|
|
|
|
'theme', aliasedName, false,
|
|
|
|
type: const StringType(), requiredDuringInsert: true);
|
|
|
|
final VerificationMeta _showSetsMeta = const VerificationMeta('showSets');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<bool?> showSets = GeneratedColumn<bool?>(
|
|
|
|
'show_sets', aliasedName, false,
|
|
|
|
type: const BoolType(),
|
|
|
|
requiredDuringInsert: true,
|
|
|
|
defaultConstraints: 'CHECK (show_sets IN (0, 1))');
|
|
|
|
final VerificationMeta _noSoundMeta = const VerificationMeta('noSound');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<bool?> noSound = GeneratedColumn<bool?>(
|
|
|
|
'no_sound', aliasedName, false,
|
|
|
|
type: const BoolType(),
|
|
|
|
requiredDuringInsert: true,
|
|
|
|
defaultConstraints: 'CHECK (no_sound IN (0, 1))');
|
|
|
|
final VerificationMeta _backupMeta = const VerificationMeta('backup');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<bool?> backup = GeneratedColumn<bool?>(
|
|
|
|
'backup', aliasedName, false,
|
|
|
|
type: const BoolType(),
|
|
|
|
requiredDuringInsert: true,
|
|
|
|
defaultConstraints: 'CHECK (backup IN (0, 1))');
|
|
|
|
@override
|
|
|
|
List<GeneratedColumn> get $columns => [
|
|
|
|
alarm,
|
|
|
|
vibrate,
|
|
|
|
sound,
|
|
|
|
notify,
|
|
|
|
images,
|
|
|
|
showUnit,
|
|
|
|
lightColor,
|
|
|
|
darkColor,
|
|
|
|
steps,
|
|
|
|
date,
|
|
|
|
showDate,
|
|
|
|
theme,
|
|
|
|
showSets,
|
|
|
|
noSound,
|
|
|
|
backup
|
|
|
|
];
|
|
|
|
@override
|
|
|
|
String get aliasedName => _alias ?? 'settings';
|
|
|
|
@override
|
|
|
|
String get actualTableName => 'settings';
|
|
|
|
@override
|
|
|
|
VerificationContext validateIntegrity(Insertable<Setting> instance,
|
|
|
|
{bool isInserting = false}) {
|
|
|
|
final context = VerificationContext();
|
|
|
|
final data = instance.toColumns(true);
|
|
|
|
if (data.containsKey('alarm')) {
|
|
|
|
context.handle(
|
|
|
|
_alarmMeta, alarm.isAcceptableOrUnknown(data['alarm']!, _alarmMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_alarmMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('vibrate')) {
|
|
|
|
context.handle(_vibrateMeta,
|
|
|
|
vibrate.isAcceptableOrUnknown(data['vibrate']!, _vibrateMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_vibrateMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('sound')) {
|
|
|
|
context.handle(
|
|
|
|
_soundMeta, sound.isAcceptableOrUnknown(data['sound']!, _soundMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_soundMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('notify')) {
|
|
|
|
context.handle(_notifyMeta,
|
|
|
|
notify.isAcceptableOrUnknown(data['notify']!, _notifyMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_notifyMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('images')) {
|
|
|
|
context.handle(_imagesMeta,
|
|
|
|
images.isAcceptableOrUnknown(data['images']!, _imagesMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_imagesMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('show_unit')) {
|
|
|
|
context.handle(_showUnitMeta,
|
|
|
|
showUnit.isAcceptableOrUnknown(data['show_unit']!, _showUnitMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_showUnitMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('light_color')) {
|
|
|
|
context.handle(
|
|
|
|
_lightColorMeta,
|
|
|
|
lightColor.isAcceptableOrUnknown(
|
|
|
|
data['light_color']!, _lightColorMeta));
|
|
|
|
}
|
|
|
|
if (data.containsKey('dark_color')) {
|
|
|
|
context.handle(_darkColorMeta,
|
|
|
|
darkColor.isAcceptableOrUnknown(data['dark_color']!, _darkColorMeta));
|
|
|
|
}
|
|
|
|
if (data.containsKey('steps')) {
|
|
|
|
context.handle(
|
|
|
|
_stepsMeta, steps.isAcceptableOrUnknown(data['steps']!, _stepsMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_stepsMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('date')) {
|
|
|
|
context.handle(
|
|
|
|
_dateMeta, date.isAcceptableOrUnknown(data['date']!, _dateMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_dateMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('show_date')) {
|
|
|
|
context.handle(_showDateMeta,
|
|
|
|
showDate.isAcceptableOrUnknown(data['show_date']!, _showDateMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_showDateMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('theme')) {
|
|
|
|
context.handle(
|
|
|
|
_themeMeta, theme.isAcceptableOrUnknown(data['theme']!, _themeMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_themeMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('show_sets')) {
|
|
|
|
context.handle(_showSetsMeta,
|
|
|
|
showSets.isAcceptableOrUnknown(data['show_sets']!, _showSetsMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_showSetsMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('no_sound')) {
|
|
|
|
context.handle(_noSoundMeta,
|
|
|
|
noSound.isAcceptableOrUnknown(data['no_sound']!, _noSoundMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_noSoundMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('backup')) {
|
|
|
|
context.handle(_backupMeta,
|
|
|
|
backup.isAcceptableOrUnknown(data['backup']!, _backupMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_backupMeta);
|
|
|
|
}
|
|
|
|
return context;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Set<GeneratedColumn> get $primaryKey => <GeneratedColumn>{};
|
|
|
|
@override
|
|
|
|
Setting map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
|
|
return Setting.fromData(data, attachedDatabase,
|
|
|
|
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
$SettingsTable createAlias(String alias) {
|
|
|
|
return $SettingsTable(attachedDatabase, alias);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-11 11:41:10 +12:00
|
|
|
class GymSet extends DataClass implements Insertable<GymSet> {
|
|
|
|
final int id;
|
|
|
|
final String name;
|
|
|
|
final int reps;
|
|
|
|
final int weight;
|
|
|
|
final int sets;
|
|
|
|
final int minutes;
|
|
|
|
final int seconds;
|
|
|
|
final bool hidden;
|
|
|
|
final String created;
|
|
|
|
final String unit;
|
|
|
|
final String image;
|
|
|
|
final String? steps;
|
|
|
|
GymSet(
|
|
|
|
{required this.id,
|
|
|
|
required this.name,
|
|
|
|
required this.reps,
|
|
|
|
required this.weight,
|
|
|
|
required this.sets,
|
|
|
|
required this.minutes,
|
|
|
|
required this.seconds,
|
|
|
|
required this.hidden,
|
|
|
|
required this.created,
|
|
|
|
required this.unit,
|
|
|
|
required this.image,
|
|
|
|
this.steps});
|
|
|
|
factory GymSet.fromData(Map<String, dynamic> data, GeneratedDatabase db,
|
|
|
|
{String? prefix}) {
|
|
|
|
final effectivePrefix = prefix ?? '';
|
|
|
|
return GymSet(
|
|
|
|
id: const IntType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}id'])!,
|
|
|
|
name: const StringType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}name'])!,
|
|
|
|
reps: const IntType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}reps'])!,
|
|
|
|
weight: const IntType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}weight'])!,
|
|
|
|
sets: const IntType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}sets'])!,
|
|
|
|
minutes: const IntType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}minutes'])!,
|
|
|
|
seconds: const IntType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}seconds'])!,
|
|
|
|
hidden: const BoolType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}hidden'])!,
|
|
|
|
created: const StringType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}created'])!,
|
|
|
|
unit: const StringType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}unit'])!,
|
|
|
|
image: const StringType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}image'])!,
|
|
|
|
steps: const StringType()
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}steps']),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
@override
|
|
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
|
|
final map = <String, Expression>{};
|
|
|
|
map['id'] = Variable<int>(id);
|
|
|
|
map['name'] = Variable<String>(name);
|
|
|
|
map['reps'] = Variable<int>(reps);
|
|
|
|
map['weight'] = Variable<int>(weight);
|
|
|
|
map['sets'] = Variable<int>(sets);
|
|
|
|
map['minutes'] = Variable<int>(minutes);
|
|
|
|
map['seconds'] = Variable<int>(seconds);
|
|
|
|
map['hidden'] = Variable<bool>(hidden);
|
|
|
|
map['created'] = Variable<String>(created);
|
|
|
|
map['unit'] = Variable<String>(unit);
|
|
|
|
map['image'] = Variable<String>(image);
|
|
|
|
if (!nullToAbsent || steps != null) {
|
|
|
|
map['steps'] = Variable<String?>(steps);
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
GymSetsCompanion toCompanion(bool nullToAbsent) {
|
|
|
|
return GymSetsCompanion(
|
|
|
|
id: Value(id),
|
|
|
|
name: Value(name),
|
|
|
|
reps: Value(reps),
|
|
|
|
weight: Value(weight),
|
|
|
|
sets: Value(sets),
|
|
|
|
minutes: Value(minutes),
|
|
|
|
seconds: Value(seconds),
|
|
|
|
hidden: Value(hidden),
|
|
|
|
created: Value(created),
|
|
|
|
unit: Value(unit),
|
|
|
|
image: Value(image),
|
|
|
|
steps:
|
|
|
|
steps == null && nullToAbsent ? const Value.absent() : Value(steps),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
factory GymSet.fromJson(Map<String, dynamic> json,
|
|
|
|
{ValueSerializer? serializer}) {
|
|
|
|
serializer ??= moorRuntimeOptions.defaultSerializer;
|
|
|
|
return GymSet(
|
|
|
|
id: serializer.fromJson<int>(json['id']),
|
|
|
|
name: serializer.fromJson<String>(json['name']),
|
|
|
|
reps: serializer.fromJson<int>(json['reps']),
|
|
|
|
weight: serializer.fromJson<int>(json['weight']),
|
|
|
|
sets: serializer.fromJson<int>(json['sets']),
|
|
|
|
minutes: serializer.fromJson<int>(json['minutes']),
|
|
|
|
seconds: serializer.fromJson<int>(json['seconds']),
|
|
|
|
hidden: serializer.fromJson<bool>(json['hidden']),
|
|
|
|
created: serializer.fromJson<String>(json['created']),
|
|
|
|
unit: serializer.fromJson<String>(json['unit']),
|
|
|
|
image: serializer.fromJson<String>(json['image']),
|
|
|
|
steps: serializer.fromJson<String?>(json['steps']),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
@override
|
|
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
|
|
serializer ??= moorRuntimeOptions.defaultSerializer;
|
|
|
|
return <String, dynamic>{
|
|
|
|
'id': serializer.toJson<int>(id),
|
|
|
|
'name': serializer.toJson<String>(name),
|
|
|
|
'reps': serializer.toJson<int>(reps),
|
|
|
|
'weight': serializer.toJson<int>(weight),
|
|
|
|
'sets': serializer.toJson<int>(sets),
|
|
|
|
'minutes': serializer.toJson<int>(minutes),
|
|
|
|
'seconds': serializer.toJson<int>(seconds),
|
|
|
|
'hidden': serializer.toJson<bool>(hidden),
|
|
|
|
'created': serializer.toJson<String>(created),
|
|
|
|
'unit': serializer.toJson<String>(unit),
|
|
|
|
'image': serializer.toJson<String>(image),
|
|
|
|
'steps': serializer.toJson<String?>(steps),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
GymSet copyWith(
|
|
|
|
{int? id,
|
|
|
|
String? name,
|
|
|
|
int? reps,
|
|
|
|
int? weight,
|
|
|
|
int? sets,
|
|
|
|
int? minutes,
|
|
|
|
int? seconds,
|
|
|
|
bool? hidden,
|
|
|
|
String? created,
|
|
|
|
String? unit,
|
|
|
|
String? image,
|
|
|
|
String? steps}) =>
|
|
|
|
GymSet(
|
|
|
|
id: id ?? this.id,
|
|
|
|
name: name ?? this.name,
|
|
|
|
reps: reps ?? this.reps,
|
|
|
|
weight: weight ?? this.weight,
|
|
|
|
sets: sets ?? this.sets,
|
|
|
|
minutes: minutes ?? this.minutes,
|
|
|
|
seconds: seconds ?? this.seconds,
|
|
|
|
hidden: hidden ?? this.hidden,
|
|
|
|
created: created ?? this.created,
|
|
|
|
unit: unit ?? this.unit,
|
|
|
|
image: image ?? this.image,
|
|
|
|
steps: steps ?? this.steps,
|
|
|
|
);
|
|
|
|
@override
|
|
|
|
String toString() {
|
|
|
|
return (StringBuffer('GymSet(')
|
|
|
|
..write('id: $id, ')
|
|
|
|
..write('name: $name, ')
|
|
|
|
..write('reps: $reps, ')
|
|
|
|
..write('weight: $weight, ')
|
|
|
|
..write('sets: $sets, ')
|
|
|
|
..write('minutes: $minutes, ')
|
|
|
|
..write('seconds: $seconds, ')
|
|
|
|
..write('hidden: $hidden, ')
|
|
|
|
..write('created: $created, ')
|
|
|
|
..write('unit: $unit, ')
|
|
|
|
..write('image: $image, ')
|
|
|
|
..write('steps: $steps')
|
|
|
|
..write(')'))
|
|
|
|
.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get hashCode => Object.hash(id, name, reps, weight, sets, minutes,
|
|
|
|
seconds, hidden, created, unit, image, steps);
|
|
|
|
@override
|
|
|
|
bool operator ==(Object other) =>
|
|
|
|
identical(this, other) ||
|
|
|
|
(other is GymSet &&
|
|
|
|
other.id == this.id &&
|
|
|
|
other.name == this.name &&
|
|
|
|
other.reps == this.reps &&
|
|
|
|
other.weight == this.weight &&
|
|
|
|
other.sets == this.sets &&
|
|
|
|
other.minutes == this.minutes &&
|
|
|
|
other.seconds == this.seconds &&
|
|
|
|
other.hidden == this.hidden &&
|
|
|
|
other.created == this.created &&
|
|
|
|
other.unit == this.unit &&
|
|
|
|
other.image == this.image &&
|
|
|
|
other.steps == this.steps);
|
|
|
|
}
|
|
|
|
|
|
|
|
class GymSetsCompanion extends UpdateCompanion<GymSet> {
|
|
|
|
final Value<int> id;
|
|
|
|
final Value<String> name;
|
|
|
|
final Value<int> reps;
|
|
|
|
final Value<int> weight;
|
|
|
|
final Value<int> sets;
|
|
|
|
final Value<int> minutes;
|
|
|
|
final Value<int> seconds;
|
|
|
|
final Value<bool> hidden;
|
|
|
|
final Value<String> created;
|
|
|
|
final Value<String> unit;
|
|
|
|
final Value<String> image;
|
|
|
|
final Value<String?> steps;
|
|
|
|
const GymSetsCompanion({
|
|
|
|
this.id = const Value.absent(),
|
|
|
|
this.name = const Value.absent(),
|
|
|
|
this.reps = const Value.absent(),
|
|
|
|
this.weight = const Value.absent(),
|
|
|
|
this.sets = const Value.absent(),
|
|
|
|
this.minutes = const Value.absent(),
|
|
|
|
this.seconds = const Value.absent(),
|
|
|
|
this.hidden = const Value.absent(),
|
|
|
|
this.created = const Value.absent(),
|
|
|
|
this.unit = const Value.absent(),
|
|
|
|
this.image = const Value.absent(),
|
|
|
|
this.steps = const Value.absent(),
|
|
|
|
});
|
|
|
|
GymSetsCompanion.insert({
|
|
|
|
this.id = const Value.absent(),
|
|
|
|
required String name,
|
|
|
|
required int reps,
|
|
|
|
required int weight,
|
|
|
|
this.sets = const Value.absent(),
|
|
|
|
this.minutes = const Value.absent(),
|
|
|
|
this.seconds = const Value.absent(),
|
|
|
|
this.hidden = const Value.absent(),
|
|
|
|
required String created,
|
|
|
|
this.unit = const Value.absent(),
|
|
|
|
required String image,
|
|
|
|
this.steps = const Value.absent(),
|
|
|
|
}) : name = Value(name),
|
|
|
|
reps = Value(reps),
|
|
|
|
weight = Value(weight),
|
|
|
|
created = Value(created),
|
|
|
|
image = Value(image);
|
|
|
|
static Insertable<GymSet> custom({
|
|
|
|
Expression<int>? id,
|
|
|
|
Expression<String>? name,
|
|
|
|
Expression<int>? reps,
|
|
|
|
Expression<int>? weight,
|
|
|
|
Expression<int>? sets,
|
|
|
|
Expression<int>? minutes,
|
|
|
|
Expression<int>? seconds,
|
|
|
|
Expression<bool>? hidden,
|
|
|
|
Expression<String>? created,
|
|
|
|
Expression<String>? unit,
|
|
|
|
Expression<String>? image,
|
|
|
|
Expression<String?>? steps,
|
|
|
|
}) {
|
|
|
|
return RawValuesInsertable({
|
|
|
|
if (id != null) 'id': id,
|
|
|
|
if (name != null) 'name': name,
|
|
|
|
if (reps != null) 'reps': reps,
|
|
|
|
if (weight != null) 'weight': weight,
|
|
|
|
if (sets != null) 'sets': sets,
|
|
|
|
if (minutes != null) 'minutes': minutes,
|
|
|
|
if (seconds != null) 'seconds': seconds,
|
|
|
|
if (hidden != null) 'hidden': hidden,
|
|
|
|
if (created != null) 'created': created,
|
|
|
|
if (unit != null) 'unit': unit,
|
|
|
|
if (image != null) 'image': image,
|
|
|
|
if (steps != null) 'steps': steps,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
GymSetsCompanion copyWith(
|
|
|
|
{Value<int>? id,
|
|
|
|
Value<String>? name,
|
|
|
|
Value<int>? reps,
|
|
|
|
Value<int>? weight,
|
|
|
|
Value<int>? sets,
|
|
|
|
Value<int>? minutes,
|
|
|
|
Value<int>? seconds,
|
|
|
|
Value<bool>? hidden,
|
|
|
|
Value<String>? created,
|
|
|
|
Value<String>? unit,
|
|
|
|
Value<String>? image,
|
|
|
|
Value<String?>? steps}) {
|
|
|
|
return GymSetsCompanion(
|
|
|
|
id: id ?? this.id,
|
|
|
|
name: name ?? this.name,
|
|
|
|
reps: reps ?? this.reps,
|
|
|
|
weight: weight ?? this.weight,
|
|
|
|
sets: sets ?? this.sets,
|
|
|
|
minutes: minutes ?? this.minutes,
|
|
|
|
seconds: seconds ?? this.seconds,
|
|
|
|
hidden: hidden ?? this.hidden,
|
|
|
|
created: created ?? this.created,
|
|
|
|
unit: unit ?? this.unit,
|
|
|
|
image: image ?? this.image,
|
|
|
|
steps: steps ?? this.steps,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
|
|
final map = <String, Expression>{};
|
|
|
|
if (id.present) {
|
|
|
|
map['id'] = Variable<int>(id.value);
|
|
|
|
}
|
|
|
|
if (name.present) {
|
|
|
|
map['name'] = Variable<String>(name.value);
|
|
|
|
}
|
|
|
|
if (reps.present) {
|
|
|
|
map['reps'] = Variable<int>(reps.value);
|
|
|
|
}
|
|
|
|
if (weight.present) {
|
|
|
|
map['weight'] = Variable<int>(weight.value);
|
|
|
|
}
|
|
|
|
if (sets.present) {
|
|
|
|
map['sets'] = Variable<int>(sets.value);
|
|
|
|
}
|
|
|
|
if (minutes.present) {
|
|
|
|
map['minutes'] = Variable<int>(minutes.value);
|
|
|
|
}
|
|
|
|
if (seconds.present) {
|
|
|
|
map['seconds'] = Variable<int>(seconds.value);
|
|
|
|
}
|
|
|
|
if (hidden.present) {
|
|
|
|
map['hidden'] = Variable<bool>(hidden.value);
|
|
|
|
}
|
|
|
|
if (created.present) {
|
|
|
|
map['created'] = Variable<String>(created.value);
|
|
|
|
}
|
|
|
|
if (unit.present) {
|
|
|
|
map['unit'] = Variable<String>(unit.value);
|
|
|
|
}
|
|
|
|
if (image.present) {
|
|
|
|
map['image'] = Variable<String>(image.value);
|
|
|
|
}
|
|
|
|
if (steps.present) {
|
|
|
|
map['steps'] = Variable<String?>(steps.value);
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
String toString() {
|
|
|
|
return (StringBuffer('GymSetsCompanion(')
|
|
|
|
..write('id: $id, ')
|
|
|
|
..write('name: $name, ')
|
|
|
|
..write('reps: $reps, ')
|
|
|
|
..write('weight: $weight, ')
|
|
|
|
..write('sets: $sets, ')
|
|
|
|
..write('minutes: $minutes, ')
|
|
|
|
..write('seconds: $seconds, ')
|
|
|
|
..write('hidden: $hidden, ')
|
|
|
|
..write('created: $created, ')
|
|
|
|
..write('unit: $unit, ')
|
|
|
|
..write('image: $image, ')
|
|
|
|
..write('steps: $steps')
|
|
|
|
..write(')'))
|
|
|
|
.toString();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class $GymSetsTable extends GymSets with TableInfo<$GymSetsTable, GymSet> {
|
|
|
|
@override
|
|
|
|
final GeneratedDatabase attachedDatabase;
|
|
|
|
final String? _alias;
|
|
|
|
$GymSetsTable(this.attachedDatabase, [this._alias]);
|
|
|
|
final VerificationMeta _idMeta = const VerificationMeta('id');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<int?> id = GeneratedColumn<int?>(
|
|
|
|
'id', aliasedName, false,
|
|
|
|
type: const IntType(),
|
|
|
|
requiredDuringInsert: false,
|
|
|
|
defaultConstraints: 'PRIMARY KEY AUTOINCREMENT');
|
|
|
|
final VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<String?> name = GeneratedColumn<String?>(
|
|
|
|
'name', aliasedName, false,
|
|
|
|
type: const StringType(), requiredDuringInsert: true);
|
|
|
|
final VerificationMeta _repsMeta = const VerificationMeta('reps');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<int?> reps = GeneratedColumn<int?>(
|
|
|
|
'reps', aliasedName, false,
|
|
|
|
type: const IntType(), requiredDuringInsert: true);
|
|
|
|
final VerificationMeta _weightMeta = const VerificationMeta('weight');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<int?> weight = GeneratedColumn<int?>(
|
|
|
|
'weight', aliasedName, false,
|
|
|
|
type: const IntType(), requiredDuringInsert: true);
|
|
|
|
final VerificationMeta _setsMeta = const VerificationMeta('sets');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<int?> sets = GeneratedColumn<int?>(
|
|
|
|
'sets', aliasedName, false,
|
|
|
|
type: const IntType(),
|
|
|
|
requiredDuringInsert: false,
|
|
|
|
defaultValue: const Constant(3));
|
|
|
|
final VerificationMeta _minutesMeta = const VerificationMeta('minutes');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<int?> minutes = GeneratedColumn<int?>(
|
|
|
|
'minutes', aliasedName, false,
|
|
|
|
type: const IntType(),
|
|
|
|
requiredDuringInsert: false,
|
|
|
|
defaultValue: const Constant(3));
|
|
|
|
final VerificationMeta _secondsMeta = const VerificationMeta('seconds');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<int?> seconds = GeneratedColumn<int?>(
|
|
|
|
'seconds', aliasedName, false,
|
|
|
|
type: const IntType(),
|
|
|
|
requiredDuringInsert: false,
|
|
|
|
defaultValue: const Constant(30));
|
|
|
|
final VerificationMeta _hiddenMeta = const VerificationMeta('hidden');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<bool?> hidden = GeneratedColumn<bool?>(
|
|
|
|
'hidden', aliasedName, false,
|
|
|
|
type: const BoolType(),
|
|
|
|
requiredDuringInsert: false,
|
|
|
|
defaultConstraints: 'CHECK (hidden IN (0, 1))',
|
|
|
|
defaultValue: const Constant(false));
|
|
|
|
final VerificationMeta _createdMeta = const VerificationMeta('created');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<String?> created = GeneratedColumn<String?>(
|
|
|
|
'created', aliasedName, false,
|
|
|
|
type: const StringType(), requiredDuringInsert: true);
|
|
|
|
final VerificationMeta _unitMeta = const VerificationMeta('unit');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<String?> unit = GeneratedColumn<String?>(
|
|
|
|
'unit', aliasedName, false,
|
|
|
|
type: const StringType(),
|
|
|
|
requiredDuringInsert: false,
|
|
|
|
defaultValue: const Constant('kg'));
|
|
|
|
final VerificationMeta _imageMeta = const VerificationMeta('image');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<String?> image = GeneratedColumn<String?>(
|
|
|
|
'image', aliasedName, false,
|
|
|
|
type: const StringType(), requiredDuringInsert: true);
|
|
|
|
final VerificationMeta _stepsMeta = const VerificationMeta('steps');
|
|
|
|
@override
|
|
|
|
late final GeneratedColumn<String?> steps = GeneratedColumn<String?>(
|
|
|
|
'steps', aliasedName, true,
|
|
|
|
type: const StringType(), requiredDuringInsert: false);
|
|
|
|
@override
|
|
|
|
List<GeneratedColumn> get $columns => [
|
|
|
|
id,
|
|
|
|
name,
|
|
|
|
reps,
|
|
|
|
weight,
|
|
|
|
sets,
|
|
|
|
minutes,
|
|
|
|
seconds,
|
|
|
|
hidden,
|
|
|
|
created,
|
|
|
|
unit,
|
|
|
|
image,
|
|
|
|
steps
|
|
|
|
];
|
|
|
|
@override
|
|
|
|
String get aliasedName => _alias ?? 'gym_sets';
|
|
|
|
@override
|
|
|
|
String get actualTableName => 'gym_sets';
|
|
|
|
@override
|
|
|
|
VerificationContext validateIntegrity(Insertable<GymSet> 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('reps')) {
|
|
|
|
context.handle(
|
|
|
|
_repsMeta, reps.isAcceptableOrUnknown(data['reps']!, _repsMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_repsMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('weight')) {
|
|
|
|
context.handle(_weightMeta,
|
|
|
|
weight.isAcceptableOrUnknown(data['weight']!, _weightMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_weightMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('sets')) {
|
|
|
|
context.handle(
|
|
|
|
_setsMeta, sets.isAcceptableOrUnknown(data['sets']!, _setsMeta));
|
|
|
|
}
|
|
|
|
if (data.containsKey('minutes')) {
|
|
|
|
context.handle(_minutesMeta,
|
|
|
|
minutes.isAcceptableOrUnknown(data['minutes']!, _minutesMeta));
|
|
|
|
}
|
|
|
|
if (data.containsKey('seconds')) {
|
|
|
|
context.handle(_secondsMeta,
|
|
|
|
seconds.isAcceptableOrUnknown(data['seconds']!, _secondsMeta));
|
|
|
|
}
|
|
|
|
if (data.containsKey('hidden')) {
|
|
|
|
context.handle(_hiddenMeta,
|
|
|
|
hidden.isAcceptableOrUnknown(data['hidden']!, _hiddenMeta));
|
|
|
|
}
|
|
|
|
if (data.containsKey('created')) {
|
|
|
|
context.handle(_createdMeta,
|
|
|
|
created.isAcceptableOrUnknown(data['created']!, _createdMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_createdMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('unit')) {
|
|
|
|
context.handle(
|
|
|
|
_unitMeta, unit.isAcceptableOrUnknown(data['unit']!, _unitMeta));
|
|
|
|
}
|
|
|
|
if (data.containsKey('image')) {
|
|
|
|
context.handle(
|
|
|
|
_imageMeta, image.isAcceptableOrUnknown(data['image']!, _imageMeta));
|
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_imageMeta);
|
|
|
|
}
|
|
|
|
if (data.containsKey('steps')) {
|
|
|
|
context.handle(
|
|
|
|
_stepsMeta, steps.isAcceptableOrUnknown(data['steps']!, _stepsMeta));
|
|
|
|
}
|
|
|
|
return context;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
|
|
@override
|
|
|
|
GymSet map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
|
|
return GymSet.fromData(data, attachedDatabase,
|
|
|
|
prefix: tablePrefix != null ? '$tablePrefix.' : null);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
$GymSetsTable createAlias(String alias) {
|
|
|
|
return $GymSetsTable(attachedDatabase, alias);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-04-09 14:39:41 +12:00
|
|
|
abstract class _$MyDatabase extends GeneratedDatabase {
|
|
|
|
_$MyDatabase(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e);
|
|
|
|
late final $SettingsTable settings = $SettingsTable(this);
|
2023-04-11 11:41:10 +12:00
|
|
|
late final $GymSetsTable gymSets = $GymSetsTable(this);
|
2023-04-09 14:39:41 +12:00
|
|
|
@override
|
|
|
|
Iterable<TableInfo> get allTables => allSchemaEntities.whereType<TableInfo>();
|
|
|
|
@override
|
2023-04-11 11:41:10 +12:00
|
|
|
List<DatabaseSchemaEntity> get allSchemaEntities => [settings, gymSets];
|
2023-04-09 14:39:41 +12:00
|
|
|
}
|