mucke/lib/system/datasources/moor_music_data_source.g.dart

916 lines
29 KiB
Dart
Raw Normal View History

2020-03-24 22:17:03 +01:00
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'moor_music_data_source.dart';
// **************************************************************************
// MoorGenerator
// **************************************************************************
// ignore_for_file: unnecessary_brace_in_string_interps, unnecessary_this
class MoorAlbum extends DataClass implements Insertable<MoorAlbum> {
2020-06-28 10:40:53 +02:00
final int id;
2020-03-24 22:17:03 +01:00
final String title;
final String artist;
final String albumArtPath;
final int year;
2020-06-28 10:40:53 +02:00
final bool present;
2020-03-24 22:17:03 +01:00
MoorAlbum(
2020-06-28 10:40:53 +02:00
{@required this.id,
@required this.title,
2020-03-24 22:17:03 +01:00
@required this.artist,
this.albumArtPath,
2020-06-28 10:40:53 +02:00
this.year,
@required this.present});
2020-03-24 22:17:03 +01:00
factory MoorAlbum.fromData(Map<String, dynamic> data, GeneratedDatabase db,
{String prefix}) {
final effectivePrefix = prefix ?? '';
final intType = db.typeSystem.forDartType<int>();
2020-06-28 10:40:53 +02:00
final stringType = db.typeSystem.forDartType<String>();
final boolType = db.typeSystem.forDartType<bool>();
2020-03-24 22:17:03 +01:00
return MoorAlbum(
2020-06-28 10:40:53 +02:00
id: intType.mapFromDatabaseResponse(data['${effectivePrefix}id']),
2020-03-24 22:17:03 +01:00
title:
stringType.mapFromDatabaseResponse(data['${effectivePrefix}title']),
artist:
stringType.mapFromDatabaseResponse(data['${effectivePrefix}artist']),
albumArtPath: stringType
.mapFromDatabaseResponse(data['${effectivePrefix}album_art_path']),
year: intType.mapFromDatabaseResponse(data['${effectivePrefix}year']),
2020-06-28 10:40:53 +02:00
present:
boolType.mapFromDatabaseResponse(data['${effectivePrefix}present']),
2020-03-24 22:17:03 +01:00
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
2020-06-28 10:40:53 +02:00
if (!nullToAbsent || id != null) {
map['id'] = Variable<int>(id);
}
if (!nullToAbsent || title != null) {
map['title'] = Variable<String>(title);
}
if (!nullToAbsent || artist != null) {
map['artist'] = Variable<String>(artist);
}
if (!nullToAbsent || albumArtPath != null) {
map['album_art_path'] = Variable<String>(albumArtPath);
}
if (!nullToAbsent || year != null) {
map['year'] = Variable<int>(year);
}
2020-06-28 10:40:53 +02:00
if (!nullToAbsent || present != null) {
map['present'] = Variable<bool>(present);
}
return map;
}
2020-06-28 10:40:53 +02:00
AlbumsCompanion toCompanion(bool nullToAbsent) {
return AlbumsCompanion(
id: id == null && nullToAbsent ? const Value.absent() : Value(id),
title:
title == null && nullToAbsent ? const Value.absent() : Value(title),
artist:
artist == null && nullToAbsent ? const Value.absent() : Value(artist),
albumArtPath: albumArtPath == null && nullToAbsent
? const Value.absent()
: Value(albumArtPath),
year: year == null && nullToAbsent ? const Value.absent() : Value(year),
present: present == null && nullToAbsent
? const Value.absent()
: Value(present),
);
}
2020-03-24 22:17:03 +01:00
factory MoorAlbum.fromJson(Map<String, dynamic> json,
{ValueSerializer serializer}) {
serializer ??= moorRuntimeOptions.defaultSerializer;
return MoorAlbum(
2020-06-28 10:40:53 +02:00
id: serializer.fromJson<int>(json['id']),
2020-03-24 22:17:03 +01:00
title: serializer.fromJson<String>(json['title']),
artist: serializer.fromJson<String>(json['artist']),
albumArtPath: serializer.fromJson<String>(json['albumArtPath']),
year: serializer.fromJson<int>(json['year']),
2020-06-28 10:40:53 +02:00
present: serializer.fromJson<bool>(json['present']),
2020-03-24 22:17:03 +01:00
);
}
@override
Map<String, dynamic> toJson({ValueSerializer serializer}) {
serializer ??= moorRuntimeOptions.defaultSerializer;
return <String, dynamic>{
2020-06-28 10:40:53 +02:00
'id': serializer.toJson<int>(id),
2020-03-24 22:17:03 +01:00
'title': serializer.toJson<String>(title),
'artist': serializer.toJson<String>(artist),
'albumArtPath': serializer.toJson<String>(albumArtPath),
'year': serializer.toJson<int>(year),
2020-06-28 10:40:53 +02:00
'present': serializer.toJson<bool>(present),
2020-03-24 22:17:03 +01:00
};
}
MoorAlbum copyWith(
2020-06-28 10:40:53 +02:00
{int id,
String title,
String artist,
String albumArtPath,
int year,
bool present}) =>
2020-03-24 22:17:03 +01:00
MoorAlbum(
2020-06-28 10:40:53 +02:00
id: id ?? this.id,
2020-03-24 22:17:03 +01:00
title: title ?? this.title,
artist: artist ?? this.artist,
albumArtPath: albumArtPath ?? this.albumArtPath,
year: year ?? this.year,
2020-06-28 10:40:53 +02:00
present: present ?? this.present,
2020-03-24 22:17:03 +01:00
);
@override
String toString() {
return (StringBuffer('MoorAlbum(')
2020-06-28 10:40:53 +02:00
..write('id: $id, ')
2020-03-24 22:17:03 +01:00
..write('title: $title, ')
..write('artist: $artist, ')
..write('albumArtPath: $albumArtPath, ')
2020-06-28 10:40:53 +02:00
..write('year: $year, ')
..write('present: $present')
2020-03-24 22:17:03 +01:00
..write(')'))
.toString();
}
@override
2020-06-28 10:40:53 +02:00
int get hashCode => $mrjf($mrjc(
id.hashCode,
$mrjc(
title.hashCode,
$mrjc(
artist.hashCode,
$mrjc(albumArtPath.hashCode,
$mrjc(year.hashCode, present.hashCode))))));
2020-03-24 22:17:03 +01:00
@override
bool operator ==(dynamic other) =>
identical(this, other) ||
(other is MoorAlbum &&
2020-06-28 10:40:53 +02:00
other.id == this.id &&
2020-03-24 22:17:03 +01:00
other.title == this.title &&
other.artist == this.artist &&
other.albumArtPath == this.albumArtPath &&
2020-06-28 10:40:53 +02:00
other.year == this.year &&
other.present == this.present);
2020-03-24 22:17:03 +01:00
}
class AlbumsCompanion extends UpdateCompanion<MoorAlbum> {
2020-06-28 10:40:53 +02:00
final Value<int> id;
2020-03-24 22:17:03 +01:00
final Value<String> title;
final Value<String> artist;
final Value<String> albumArtPath;
final Value<int> year;
2020-06-28 10:40:53 +02:00
final Value<bool> present;
2020-03-24 22:17:03 +01:00
const AlbumsCompanion({
2020-06-28 10:40:53 +02:00
this.id = const Value.absent(),
2020-03-24 22:17:03 +01:00
this.title = const Value.absent(),
this.artist = const Value.absent(),
this.albumArtPath = const Value.absent(),
this.year = const Value.absent(),
2020-06-28 10:40:53 +02:00
this.present = const Value.absent(),
2020-03-24 22:17:03 +01:00
});
AlbumsCompanion.insert({
2020-06-28 10:40:53 +02:00
this.id = const Value.absent(),
2020-03-24 22:17:03 +01:00
@required String title,
@required String artist,
this.albumArtPath = const Value.absent(),
this.year = const Value.absent(),
2020-06-28 10:40:53 +02:00
this.present = const Value.absent(),
2020-03-24 22:17:03 +01:00
}) : title = Value(title),
artist = Value(artist);
static Insertable<MoorAlbum> custom({
2020-06-28 10:40:53 +02:00
Expression<int> id,
Expression<String> title,
Expression<String> artist,
Expression<String> albumArtPath,
Expression<int> year,
2020-06-28 10:40:53 +02:00
Expression<bool> present,
}) {
return RawValuesInsertable({
2020-06-28 10:40:53 +02:00
if (id != null) 'id': id,
if (title != null) 'title': title,
if (artist != null) 'artist': artist,
if (albumArtPath != null) 'album_art_path': albumArtPath,
if (year != null) 'year': year,
2020-06-28 10:40:53 +02:00
if (present != null) 'present': present,
});
}
2020-03-24 22:17:03 +01:00
AlbumsCompanion copyWith(
2020-06-28 10:40:53 +02:00
{Value<int> id,
Value<String> title,
2020-03-24 22:17:03 +01:00
Value<String> artist,
Value<String> albumArtPath,
2020-06-28 10:40:53 +02:00
Value<int> year,
Value<bool> present}) {
2020-03-24 22:17:03 +01:00
return AlbumsCompanion(
2020-06-28 10:40:53 +02:00
id: id ?? this.id,
2020-03-24 22:17:03 +01:00
title: title ?? this.title,
artist: artist ?? this.artist,
albumArtPath: albumArtPath ?? this.albumArtPath,
year: year ?? this.year,
2020-06-28 10:40:53 +02:00
present: present ?? this.present,
2020-03-24 22:17:03 +01:00
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
2020-06-28 10:40:53 +02:00
if (id.present) {
map['id'] = Variable<int>(id.value);
}
if (title.present) {
map['title'] = Variable<String>(title.value);
}
if (artist.present) {
map['artist'] = Variable<String>(artist.value);
}
if (albumArtPath.present) {
map['album_art_path'] = Variable<String>(albumArtPath.value);
}
if (year.present) {
map['year'] = Variable<int>(year.value);
}
2020-06-28 10:40:53 +02:00
if (present.present) {
map['present'] = Variable<bool>(present.value);
}
return map;
}
2020-03-24 22:17:03 +01:00
}
class $AlbumsTable extends Albums with TableInfo<$AlbumsTable, MoorAlbum> {
final GeneratedDatabase _db;
final String _alias;
$AlbumsTable(this._db, [this._alias]);
2020-06-28 10:40:53 +02:00
final VerificationMeta _idMeta = const VerificationMeta('id');
GeneratedIntColumn _id;
@override
GeneratedIntColumn get id => _id ??= _constructId();
GeneratedIntColumn _constructId() {
return GeneratedIntColumn('id', $tableName, false,
hasAutoIncrement: true, declaredAsPrimaryKey: true);
}
2020-03-24 22:17:03 +01:00
final VerificationMeta _titleMeta = const VerificationMeta('title');
GeneratedTextColumn _title;
@override
GeneratedTextColumn get title => _title ??= _constructTitle();
GeneratedTextColumn _constructTitle() {
return GeneratedTextColumn(
'title',
$tableName,
false,
);
}
final VerificationMeta _artistMeta = const VerificationMeta('artist');
GeneratedTextColumn _artist;
@override
GeneratedTextColumn get artist => _artist ??= _constructArtist();
GeneratedTextColumn _constructArtist() {
return GeneratedTextColumn(
'artist',
$tableName,
false,
);
}
final VerificationMeta _albumArtPathMeta =
const VerificationMeta('albumArtPath');
GeneratedTextColumn _albumArtPath;
@override
GeneratedTextColumn get albumArtPath =>
_albumArtPath ??= _constructAlbumArtPath();
GeneratedTextColumn _constructAlbumArtPath() {
return GeneratedTextColumn(
'album_art_path',
$tableName,
true,
);
}
final VerificationMeta _yearMeta = const VerificationMeta('year');
GeneratedIntColumn _year;
@override
GeneratedIntColumn get year => _year ??= _constructYear();
GeneratedIntColumn _constructYear() {
return GeneratedIntColumn(
'year',
$tableName,
true,
);
}
2020-06-28 10:40:53 +02:00
final VerificationMeta _presentMeta = const VerificationMeta('present');
GeneratedBoolColumn _present;
@override
GeneratedBoolColumn get present => _present ??= _constructPresent();
GeneratedBoolColumn _constructPresent() {
return GeneratedBoolColumn('present', $tableName, false,
defaultValue: const Constant(true));
}
2020-03-24 22:17:03 +01:00
@override
2020-06-28 10:40:53 +02:00
List<GeneratedColumn> get $columns =>
[id, title, artist, albumArtPath, year, present];
2020-03-24 22:17:03 +01:00
@override
$AlbumsTable get asDslTable => this;
@override
String get $tableName => _alias ?? 'albums';
@override
final String actualTableName = 'albums';
@override
VerificationContext validateIntegrity(Insertable<MoorAlbum> instance,
2020-03-24 22:17:03 +01:00
{bool isInserting = false}) {
final context = VerificationContext();
final data = instance.toColumns(true);
2020-06-28 10:40:53 +02:00
if (data.containsKey('id')) {
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id'], _idMeta));
}
if (data.containsKey('title')) {
2020-03-24 22:17:03 +01:00
context.handle(
_titleMeta, title.isAcceptableOrUnknown(data['title'], _titleMeta));
2020-03-24 22:17:03 +01:00
} else if (isInserting) {
context.missing(_titleMeta);
}
if (data.containsKey('artist')) {
context.handle(_artistMeta,
artist.isAcceptableOrUnknown(data['artist'], _artistMeta));
2020-03-24 22:17:03 +01:00
} else if (isInserting) {
context.missing(_artistMeta);
}
if (data.containsKey('album_art_path')) {
2020-03-24 22:17:03 +01:00
context.handle(
_albumArtPathMeta,
albumArtPath.isAcceptableOrUnknown(
data['album_art_path'], _albumArtPathMeta));
2020-03-24 22:17:03 +01:00
}
if (data.containsKey('year')) {
2020-03-24 22:17:03 +01:00
context.handle(
_yearMeta, year.isAcceptableOrUnknown(data['year'], _yearMeta));
2020-03-24 22:17:03 +01:00
}
2020-06-28 10:40:53 +02:00
if (data.containsKey('present')) {
context.handle(_presentMeta,
present.isAcceptableOrUnknown(data['present'], _presentMeta));
}
2020-03-24 22:17:03 +01:00
return context;
}
@override
2020-06-28 10:40:53 +02:00
Set<GeneratedColumn> get $primaryKey => {id};
2020-03-24 22:17:03 +01:00
@override
MoorAlbum map(Map<String, dynamic> data, {String tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : null;
return MoorAlbum.fromData(data, _db, prefix: effectivePrefix);
}
@override
$AlbumsTable createAlias(String alias) {
return $AlbumsTable(_db, alias);
}
}
class MoorSong extends DataClass implements Insertable<MoorSong> {
final String title;
2020-06-28 10:40:53 +02:00
final String albumTitle;
final int albumId;
final String artist;
final String path;
2020-04-11 14:27:49 +02:00
final int duration;
final String albumArtPath;
final int trackNumber;
2020-06-28 10:40:53 +02:00
final bool present;
MoorSong(
{@required this.title,
2020-06-28 10:40:53 +02:00
@required this.albumTitle,
@required this.albumId,
@required this.artist,
@required this.path,
2020-04-11 14:27:49 +02:00
this.duration,
this.albumArtPath,
2020-06-28 10:40:53 +02:00
this.trackNumber,
@required this.present});
factory MoorSong.fromData(Map<String, dynamic> data, GeneratedDatabase db,
{String prefix}) {
final effectivePrefix = prefix ?? '';
final stringType = db.typeSystem.forDartType<String>();
final intType = db.typeSystem.forDartType<int>();
2020-06-28 10:40:53 +02:00
final boolType = db.typeSystem.forDartType<bool>();
return MoorSong(
title:
stringType.mapFromDatabaseResponse(data['${effectivePrefix}title']),
2020-06-28 10:40:53 +02:00
albumTitle: stringType
.mapFromDatabaseResponse(data['${effectivePrefix}album_title']),
albumId:
intType.mapFromDatabaseResponse(data['${effectivePrefix}album_id']),
artist:
stringType.mapFromDatabaseResponse(data['${effectivePrefix}artist']),
path: stringType.mapFromDatabaseResponse(data['${effectivePrefix}path']),
2020-04-11 14:27:49 +02:00
duration:
intType.mapFromDatabaseResponse(data['${effectivePrefix}duration']),
albumArtPath: stringType
.mapFromDatabaseResponse(data['${effectivePrefix}album_art_path']),
trackNumber: intType
.mapFromDatabaseResponse(data['${effectivePrefix}track_number']),
2020-06-28 10:40:53 +02:00
present:
boolType.mapFromDatabaseResponse(data['${effectivePrefix}present']),
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (!nullToAbsent || title != null) {
map['title'] = Variable<String>(title);
}
2020-06-28 10:40:53 +02:00
if (!nullToAbsent || albumTitle != null) {
map['album_title'] = Variable<String>(albumTitle);
}
if (!nullToAbsent || albumId != null) {
map['album_id'] = Variable<int>(albumId);
}
if (!nullToAbsent || artist != null) {
map['artist'] = Variable<String>(artist);
}
if (!nullToAbsent || path != null) {
map['path'] = Variable<String>(path);
}
if (!nullToAbsent || duration != null) {
map['duration'] = Variable<int>(duration);
}
if (!nullToAbsent || albumArtPath != null) {
map['album_art_path'] = Variable<String>(albumArtPath);
}
if (!nullToAbsent || trackNumber != null) {
map['track_number'] = Variable<int>(trackNumber);
}
2020-06-28 10:40:53 +02:00
if (!nullToAbsent || present != null) {
map['present'] = Variable<bool>(present);
}
return map;
}
2020-06-28 10:40:53 +02:00
SongsCompanion toCompanion(bool nullToAbsent) {
return SongsCompanion(
title:
title == null && nullToAbsent ? const Value.absent() : Value(title),
albumTitle: albumTitle == null && nullToAbsent
? const Value.absent()
: Value(albumTitle),
albumId: albumId == null && nullToAbsent
? const Value.absent()
: Value(albumId),
artist:
artist == null && nullToAbsent ? const Value.absent() : Value(artist),
path: path == null && nullToAbsent ? const Value.absent() : Value(path),
duration: duration == null && nullToAbsent
? const Value.absent()
: Value(duration),
albumArtPath: albumArtPath == null && nullToAbsent
? const Value.absent()
: Value(albumArtPath),
trackNumber: trackNumber == null && nullToAbsent
? const Value.absent()
: Value(trackNumber),
present: present == null && nullToAbsent
? const Value.absent()
: Value(present),
);
}
factory MoorSong.fromJson(Map<String, dynamic> json,
{ValueSerializer serializer}) {
serializer ??= moorRuntimeOptions.defaultSerializer;
return MoorSong(
title: serializer.fromJson<String>(json['title']),
2020-06-28 10:40:53 +02:00
albumTitle: serializer.fromJson<String>(json['albumTitle']),
albumId: serializer.fromJson<int>(json['albumId']),
artist: serializer.fromJson<String>(json['artist']),
path: serializer.fromJson<String>(json['path']),
2020-04-11 14:27:49 +02:00
duration: serializer.fromJson<int>(json['duration']),
albumArtPath: serializer.fromJson<String>(json['albumArtPath']),
trackNumber: serializer.fromJson<int>(json['trackNumber']),
2020-06-28 10:40:53 +02:00
present: serializer.fromJson<bool>(json['present']),
);
}
@override
Map<String, dynamic> toJson({ValueSerializer serializer}) {
serializer ??= moorRuntimeOptions.defaultSerializer;
return <String, dynamic>{
'title': serializer.toJson<String>(title),
2020-06-28 10:40:53 +02:00
'albumTitle': serializer.toJson<String>(albumTitle),
'albumId': serializer.toJson<int>(albumId),
'artist': serializer.toJson<String>(artist),
'path': serializer.toJson<String>(path),
2020-04-11 14:27:49 +02:00
'duration': serializer.toJson<int>(duration),
'albumArtPath': serializer.toJson<String>(albumArtPath),
'trackNumber': serializer.toJson<int>(trackNumber),
2020-06-28 10:40:53 +02:00
'present': serializer.toJson<bool>(present),
};
}
MoorSong copyWith(
{String title,
2020-06-28 10:40:53 +02:00
String albumTitle,
int albumId,
String artist,
String path,
2020-04-11 14:27:49 +02:00
int duration,
String albumArtPath,
2020-06-28 10:40:53 +02:00
int trackNumber,
bool present}) =>
MoorSong(
title: title ?? this.title,
2020-06-28 10:40:53 +02:00
albumTitle: albumTitle ?? this.albumTitle,
albumId: albumId ?? this.albumId,
artist: artist ?? this.artist,
path: path ?? this.path,
2020-04-11 14:27:49 +02:00
duration: duration ?? this.duration,
albumArtPath: albumArtPath ?? this.albumArtPath,
trackNumber: trackNumber ?? this.trackNumber,
2020-06-28 10:40:53 +02:00
present: present ?? this.present,
);
@override
String toString() {
return (StringBuffer('MoorSong(')
..write('title: $title, ')
2020-06-28 10:40:53 +02:00
..write('albumTitle: $albumTitle, ')
..write('albumId: $albumId, ')
..write('artist: $artist, ')
..write('path: $path, ')
2020-04-11 14:27:49 +02:00
..write('duration: $duration, ')
..write('albumArtPath: $albumArtPath, ')
2020-06-28 10:40:53 +02:00
..write('trackNumber: $trackNumber, ')
..write('present: $present')
..write(')'))
.toString();
}
@override
int get hashCode => $mrjf($mrjc(
title.hashCode,
$mrjc(
2020-06-28 10:40:53 +02:00
albumTitle.hashCode,
$mrjc(
2020-06-28 10:40:53 +02:00
albumId.hashCode,
2020-04-11 14:27:49 +02:00
$mrjc(
2020-06-28 10:40:53 +02:00
artist.hashCode,
$mrjc(
path.hashCode,
$mrjc(
duration.hashCode,
$mrjc(
albumArtPath.hashCode,
$mrjc(trackNumber.hashCode,
present.hashCode)))))))));
@override
bool operator ==(dynamic other) =>
identical(this, other) ||
(other is MoorSong &&
other.title == this.title &&
2020-06-28 10:40:53 +02:00
other.albumTitle == this.albumTitle &&
other.albumId == this.albumId &&
other.artist == this.artist &&
other.path == this.path &&
2020-04-11 14:27:49 +02:00
other.duration == this.duration &&
other.albumArtPath == this.albumArtPath &&
2020-06-28 10:40:53 +02:00
other.trackNumber == this.trackNumber &&
other.present == this.present);
}
class SongsCompanion extends UpdateCompanion<MoorSong> {
final Value<String> title;
2020-06-28 10:40:53 +02:00
final Value<String> albumTitle;
final Value<int> albumId;
final Value<String> artist;
final Value<String> path;
2020-04-11 14:27:49 +02:00
final Value<int> duration;
final Value<String> albumArtPath;
final Value<int> trackNumber;
2020-06-28 10:40:53 +02:00
final Value<bool> present;
const SongsCompanion({
this.title = const Value.absent(),
2020-06-28 10:40:53 +02:00
this.albumTitle = const Value.absent(),
this.albumId = const Value.absent(),
this.artist = const Value.absent(),
this.path = const Value.absent(),
2020-04-11 14:27:49 +02:00
this.duration = const Value.absent(),
this.albumArtPath = const Value.absent(),
this.trackNumber = const Value.absent(),
2020-06-28 10:40:53 +02:00
this.present = const Value.absent(),
});
SongsCompanion.insert({
@required String title,
2020-06-28 10:40:53 +02:00
@required String albumTitle,
@required int albumId,
@required String artist,
@required String path,
2020-04-11 14:27:49 +02:00
this.duration = const Value.absent(),
this.albumArtPath = const Value.absent(),
this.trackNumber = const Value.absent(),
2020-06-28 10:40:53 +02:00
this.present = const Value.absent(),
}) : title = Value(title),
2020-06-28 10:40:53 +02:00
albumTitle = Value(albumTitle),
albumId = Value(albumId),
artist = Value(artist),
path = Value(path);
static Insertable<MoorSong> custom({
Expression<String> title,
2020-06-28 10:40:53 +02:00
Expression<String> albumTitle,
Expression<int> albumId,
Expression<String> artist,
Expression<String> path,
Expression<int> duration,
Expression<String> albumArtPath,
Expression<int> trackNumber,
2020-06-28 10:40:53 +02:00
Expression<bool> present,
}) {
return RawValuesInsertable({
if (title != null) 'title': title,
2020-06-28 10:40:53 +02:00
if (albumTitle != null) 'album_title': albumTitle,
if (albumId != null) 'album_id': albumId,
if (artist != null) 'artist': artist,
if (path != null) 'path': path,
if (duration != null) 'duration': duration,
if (albumArtPath != null) 'album_art_path': albumArtPath,
if (trackNumber != null) 'track_number': trackNumber,
2020-06-28 10:40:53 +02:00
if (present != null) 'present': present,
});
}
SongsCompanion copyWith(
{Value<String> title,
2020-06-28 10:40:53 +02:00
Value<String> albumTitle,
Value<int> albumId,
Value<String> artist,
Value<String> path,
2020-04-11 14:27:49 +02:00
Value<int> duration,
Value<String> albumArtPath,
2020-06-28 10:40:53 +02:00
Value<int> trackNumber,
Value<bool> present}) {
return SongsCompanion(
title: title ?? this.title,
2020-06-28 10:40:53 +02:00
albumTitle: albumTitle ?? this.albumTitle,
albumId: albumId ?? this.albumId,
artist: artist ?? this.artist,
path: path ?? this.path,
2020-04-11 14:27:49 +02:00
duration: duration ?? this.duration,
albumArtPath: albumArtPath ?? this.albumArtPath,
trackNumber: trackNumber ?? this.trackNumber,
2020-06-28 10:40:53 +02:00
present: present ?? this.present,
);
}
@override
Map<String, Expression> toColumns(bool nullToAbsent) {
final map = <String, Expression>{};
if (title.present) {
map['title'] = Variable<String>(title.value);
}
2020-06-28 10:40:53 +02:00
if (albumTitle.present) {
map['album_title'] = Variable<String>(albumTitle.value);
}
if (albumId.present) {
map['album_id'] = Variable<int>(albumId.value);
}
if (artist.present) {
map['artist'] = Variable<String>(artist.value);
}
if (path.present) {
map['path'] = Variable<String>(path.value);
}
if (duration.present) {
map['duration'] = Variable<int>(duration.value);
}
if (albumArtPath.present) {
map['album_art_path'] = Variable<String>(albumArtPath.value);
}
if (trackNumber.present) {
map['track_number'] = Variable<int>(trackNumber.value);
}
2020-06-28 10:40:53 +02:00
if (present.present) {
map['present'] = Variable<bool>(present.value);
}
return map;
}
}
class $SongsTable extends Songs with TableInfo<$SongsTable, MoorSong> {
final GeneratedDatabase _db;
final String _alias;
$SongsTable(this._db, [this._alias]);
final VerificationMeta _titleMeta = const VerificationMeta('title');
GeneratedTextColumn _title;
@override
GeneratedTextColumn get title => _title ??= _constructTitle();
GeneratedTextColumn _constructTitle() {
return GeneratedTextColumn(
'title',
$tableName,
false,
);
}
2020-06-28 10:40:53 +02:00
final VerificationMeta _albumTitleMeta = const VerificationMeta('albumTitle');
GeneratedTextColumn _albumTitle;
@override
2020-06-28 10:40:53 +02:00
GeneratedTextColumn get albumTitle => _albumTitle ??= _constructAlbumTitle();
GeneratedTextColumn _constructAlbumTitle() {
return GeneratedTextColumn(
2020-06-28 10:40:53 +02:00
'album_title',
$tableName,
false,
);
}
final VerificationMeta _albumIdMeta = const VerificationMeta('albumId');
GeneratedIntColumn _albumId;
@override
GeneratedIntColumn get albumId => _albumId ??= _constructAlbumId();
GeneratedIntColumn _constructAlbumId() {
return GeneratedIntColumn(
'album_id',
$tableName,
false,
);
}
final VerificationMeta _artistMeta = const VerificationMeta('artist');
GeneratedTextColumn _artist;
@override
GeneratedTextColumn get artist => _artist ??= _constructArtist();
GeneratedTextColumn _constructArtist() {
return GeneratedTextColumn(
'artist',
$tableName,
false,
);
}
final VerificationMeta _pathMeta = const VerificationMeta('path');
GeneratedTextColumn _path;
@override
GeneratedTextColumn get path => _path ??= _constructPath();
GeneratedTextColumn _constructPath() {
return GeneratedTextColumn(
'path',
$tableName,
false,
);
}
2020-04-11 14:27:49 +02:00
final VerificationMeta _durationMeta = const VerificationMeta('duration');
GeneratedIntColumn _duration;
@override
GeneratedIntColumn get duration => _duration ??= _constructDuration();
GeneratedIntColumn _constructDuration() {
return GeneratedIntColumn(
'duration',
$tableName,
true,
);
}
final VerificationMeta _albumArtPathMeta =
const VerificationMeta('albumArtPath');
GeneratedTextColumn _albumArtPath;
@override
GeneratedTextColumn get albumArtPath =>
_albumArtPath ??= _constructAlbumArtPath();
GeneratedTextColumn _constructAlbumArtPath() {
return GeneratedTextColumn(
'album_art_path',
$tableName,
true,
);
}
final VerificationMeta _trackNumberMeta =
const VerificationMeta('trackNumber');
GeneratedIntColumn _trackNumber;
@override
GeneratedIntColumn get trackNumber =>
_trackNumber ??= _constructTrackNumber();
GeneratedIntColumn _constructTrackNumber() {
return GeneratedIntColumn(
'track_number',
$tableName,
true,
);
}
2020-06-28 10:40:53 +02:00
final VerificationMeta _presentMeta = const VerificationMeta('present');
GeneratedBoolColumn _present;
@override
2020-06-28 10:40:53 +02:00
GeneratedBoolColumn get present => _present ??= _constructPresent();
GeneratedBoolColumn _constructPresent() {
return GeneratedBoolColumn('present', $tableName, false,
defaultValue: const Constant(true));
}
@override
List<GeneratedColumn> get $columns => [
title,
albumTitle,
albumId,
artist,
path,
duration,
albumArtPath,
trackNumber,
present
];
@override
$SongsTable get asDslTable => this;
@override
String get $tableName => _alias ?? 'songs';
@override
final String actualTableName = 'songs';
@override
VerificationContext validateIntegrity(Insertable<MoorSong> instance,
{bool isInserting = false}) {
final context = VerificationContext();
final data = instance.toColumns(true);
if (data.containsKey('title')) {
context.handle(
_titleMeta, title.isAcceptableOrUnknown(data['title'], _titleMeta));
} else if (isInserting) {
context.missing(_titleMeta);
}
2020-06-28 10:40:53 +02:00
if (data.containsKey('album_title')) {
context.handle(
2020-06-28 10:40:53 +02:00
_albumTitleMeta,
albumTitle.isAcceptableOrUnknown(
data['album_title'], _albumTitleMeta));
} else if (isInserting) {
2020-06-28 10:40:53 +02:00
context.missing(_albumTitleMeta);
}
if (data.containsKey('album_id')) {
context.handle(_albumIdMeta,
albumId.isAcceptableOrUnknown(data['album_id'], _albumIdMeta));
} else if (isInserting) {
context.missing(_albumIdMeta);
}
if (data.containsKey('artist')) {
context.handle(_artistMeta,
artist.isAcceptableOrUnknown(data['artist'], _artistMeta));
} else if (isInserting) {
context.missing(_artistMeta);
}
if (data.containsKey('path')) {
context.handle(
_pathMeta, path.isAcceptableOrUnknown(data['path'], _pathMeta));
} else if (isInserting) {
context.missing(_pathMeta);
}
if (data.containsKey('duration')) {
2020-04-11 14:27:49 +02:00
context.handle(_durationMeta,
duration.isAcceptableOrUnknown(data['duration'], _durationMeta));
2020-04-11 14:27:49 +02:00
}
if (data.containsKey('album_art_path')) {
context.handle(
_albumArtPathMeta,
albumArtPath.isAcceptableOrUnknown(
data['album_art_path'], _albumArtPathMeta));
}
if (data.containsKey('track_number')) {
context.handle(
_trackNumberMeta,
trackNumber.isAcceptableOrUnknown(
data['track_number'], _trackNumberMeta));
}
2020-06-28 10:40:53 +02:00
if (data.containsKey('present')) {
context.handle(_presentMeta,
present.isAcceptableOrUnknown(data['present'], _presentMeta));
}
return context;
}
@override
2020-06-28 10:40:53 +02:00
Set<GeneratedColumn> get $primaryKey => {path};
@override
MoorSong map(Map<String, dynamic> data, {String tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : null;
return MoorSong.fromData(data, _db, prefix: effectivePrefix);
}
@override
$SongsTable createAlias(String alias) {
return $SongsTable(_db, alias);
}
}
2020-03-24 22:17:03 +01:00
abstract class _$MoorMusicDataSource extends GeneratedDatabase {
_$MoorMusicDataSource(QueryExecutor e)
: super(SqlTypeSystem.defaultInstance, e);
_$MoorMusicDataSource.connect(DatabaseConnection c) : super.connect(c);
2020-03-24 22:17:03 +01:00
$AlbumsTable _albums;
$AlbumsTable get albums => _albums ??= $AlbumsTable(this);
$SongsTable _songs;
$SongsTable get songs => _songs ??= $SongsTable(this);
2020-03-24 22:17:03 +01:00
@override
Iterable<TableInfo> get allTables => allSchemaEntities.whereType<TableInfo>();
@override
List<DatabaseSchemaEntity> get allSchemaEntities => [albums, songs];
2020-03-24 22:17:03 +01:00
}