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> {
|
|
|
|
final String title;
|
|
|
|
final String artist;
|
|
|
|
final String albumArtPath;
|
|
|
|
final int year;
|
|
|
|
MoorAlbum(
|
|
|
|
{@required this.title,
|
|
|
|
@required this.artist,
|
|
|
|
this.albumArtPath,
|
|
|
|
this.year});
|
|
|
|
factory MoorAlbum.fromData(Map<String, dynamic> data, GeneratedDatabase db,
|
|
|
|
{String prefix}) {
|
|
|
|
final effectivePrefix = prefix ?? '';
|
|
|
|
final stringType = db.typeSystem.forDartType<String>();
|
|
|
|
final intType = db.typeSystem.forDartType<int>();
|
|
|
|
return MoorAlbum(
|
|
|
|
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-01 10:49:33 +02:00
|
|
|
@override
|
|
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
|
|
final map = <String, Expression>{};
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
2020-03-24 22:17:03 +01:00
|
|
|
factory MoorAlbum.fromJson(Map<String, dynamic> json,
|
|
|
|
{ValueSerializer serializer}) {
|
|
|
|
serializer ??= moorRuntimeOptions.defaultSerializer;
|
|
|
|
return MoorAlbum(
|
|
|
|
title: serializer.fromJson<String>(json['title']),
|
|
|
|
artist: serializer.fromJson<String>(json['artist']),
|
|
|
|
albumArtPath: serializer.fromJson<String>(json['albumArtPath']),
|
|
|
|
year: serializer.fromJson<int>(json['year']),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
@override
|
|
|
|
Map<String, dynamic> toJson({ValueSerializer serializer}) {
|
|
|
|
serializer ??= moorRuntimeOptions.defaultSerializer;
|
|
|
|
return <String, dynamic>{
|
|
|
|
'title': serializer.toJson<String>(title),
|
|
|
|
'artist': serializer.toJson<String>(artist),
|
|
|
|
'albumArtPath': serializer.toJson<String>(albumArtPath),
|
|
|
|
'year': serializer.toJson<int>(year),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
MoorAlbum copyWith(
|
|
|
|
{String title, String artist, String albumArtPath, int year}) =>
|
|
|
|
MoorAlbum(
|
|
|
|
title: title ?? this.title,
|
|
|
|
artist: artist ?? this.artist,
|
|
|
|
albumArtPath: albumArtPath ?? this.albumArtPath,
|
|
|
|
year: year ?? this.year,
|
|
|
|
);
|
|
|
|
@override
|
|
|
|
String toString() {
|
|
|
|
return (StringBuffer('MoorAlbum(')
|
|
|
|
..write('title: $title, ')
|
|
|
|
..write('artist: $artist, ')
|
|
|
|
..write('albumArtPath: $albumArtPath, ')
|
|
|
|
..write('year: $year')
|
|
|
|
..write(')'))
|
|
|
|
.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get hashCode => $mrjf($mrjc(title.hashCode,
|
|
|
|
$mrjc(artist.hashCode, $mrjc(albumArtPath.hashCode, year.hashCode))));
|
|
|
|
@override
|
|
|
|
bool operator ==(dynamic other) =>
|
|
|
|
identical(this, other) ||
|
|
|
|
(other is MoorAlbum &&
|
|
|
|
other.title == this.title &&
|
|
|
|
other.artist == this.artist &&
|
|
|
|
other.albumArtPath == this.albumArtPath &&
|
|
|
|
other.year == this.year);
|
|
|
|
}
|
|
|
|
|
|
|
|
class AlbumsCompanion extends UpdateCompanion<MoorAlbum> {
|
|
|
|
final Value<String> title;
|
|
|
|
final Value<String> artist;
|
|
|
|
final Value<String> albumArtPath;
|
|
|
|
final Value<int> year;
|
|
|
|
const AlbumsCompanion({
|
|
|
|
this.title = const Value.absent(),
|
|
|
|
this.artist = const Value.absent(),
|
|
|
|
this.albumArtPath = const Value.absent(),
|
|
|
|
this.year = const Value.absent(),
|
|
|
|
});
|
|
|
|
AlbumsCompanion.insert({
|
|
|
|
@required String title,
|
|
|
|
@required String artist,
|
|
|
|
this.albumArtPath = const Value.absent(),
|
|
|
|
this.year = const Value.absent(),
|
|
|
|
}) : title = Value(title),
|
|
|
|
artist = Value(artist);
|
2020-06-01 10:49:33 +02:00
|
|
|
static Insertable<MoorAlbum> custom({
|
|
|
|
Expression<String> title,
|
|
|
|
Expression<String> artist,
|
|
|
|
Expression<String> albumArtPath,
|
|
|
|
Expression<int> year,
|
|
|
|
}) {
|
|
|
|
return RawValuesInsertable({
|
|
|
|
if (title != null) 'title': title,
|
|
|
|
if (artist != null) 'artist': artist,
|
|
|
|
if (albumArtPath != null) 'album_art_path': albumArtPath,
|
|
|
|
if (year != null) 'year': year,
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2020-03-24 22:17:03 +01:00
|
|
|
AlbumsCompanion copyWith(
|
|
|
|
{Value<String> title,
|
|
|
|
Value<String> artist,
|
|
|
|
Value<String> albumArtPath,
|
|
|
|
Value<int> year}) {
|
|
|
|
return AlbumsCompanion(
|
|
|
|
title: title ?? this.title,
|
|
|
|
artist: artist ?? this.artist,
|
|
|
|
albumArtPath: albumArtPath ?? this.albumArtPath,
|
|
|
|
year: year ?? this.year,
|
|
|
|
);
|
|
|
|
}
|
2020-06-01 10:49:33 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
|
|
final map = <String, Expression>{};
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
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]);
|
|
|
|
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,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
List<GeneratedColumn> get $columns => [title, artist, albumArtPath, year];
|
|
|
|
@override
|
|
|
|
$AlbumsTable get asDslTable => this;
|
|
|
|
@override
|
|
|
|
String get $tableName => _alias ?? 'albums';
|
|
|
|
@override
|
|
|
|
final String actualTableName = 'albums';
|
|
|
|
@override
|
2020-06-01 10:49:33 +02:00
|
|
|
VerificationContext validateIntegrity(Insertable<MoorAlbum> instance,
|
2020-03-24 22:17:03 +01:00
|
|
|
{bool isInserting = false}) {
|
|
|
|
final context = VerificationContext();
|
2020-06-01 10:49:33 +02:00
|
|
|
final data = instance.toColumns(true);
|
|
|
|
if (data.containsKey('title')) {
|
2020-03-24 22:17:03 +01:00
|
|
|
context.handle(
|
2020-06-01 10:49:33 +02:00
|
|
|
_titleMeta, title.isAcceptableOrUnknown(data['title'], _titleMeta));
|
2020-03-24 22:17:03 +01:00
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_titleMeta);
|
|
|
|
}
|
2020-06-01 10:49:33 +02:00
|
|
|
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);
|
|
|
|
}
|
2020-06-01 10:49:33 +02:00
|
|
|
if (data.containsKey('album_art_path')) {
|
2020-03-24 22:17:03 +01:00
|
|
|
context.handle(
|
|
|
|
_albumArtPathMeta,
|
2020-06-01 10:49:33 +02:00
|
|
|
albumArtPath.isAcceptableOrUnknown(
|
|
|
|
data['album_art_path'], _albumArtPathMeta));
|
2020-03-24 22:17:03 +01:00
|
|
|
}
|
2020-06-01 10:49:33 +02:00
|
|
|
if (data.containsKey('year')) {
|
2020-03-24 22:17:03 +01:00
|
|
|
context.handle(
|
2020-06-01 10:49:33 +02:00
|
|
|
_yearMeta, year.isAcceptableOrUnknown(data['year'], _yearMeta));
|
2020-03-24 22:17:03 +01:00
|
|
|
}
|
|
|
|
return context;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
2020-03-30 22:25:57 +02:00
|
|
|
Set<GeneratedColumn> get $primaryKey => {title, artist};
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-03-30 22:25:57 +02:00
|
|
|
class MoorSong extends DataClass implements Insertable<MoorSong> {
|
|
|
|
final String title;
|
|
|
|
final String album;
|
|
|
|
final String artist;
|
|
|
|
final String path;
|
2020-04-11 14:27:49 +02:00
|
|
|
final int duration;
|
2020-03-30 22:25:57 +02:00
|
|
|
final String albumArtPath;
|
|
|
|
final int trackNumber;
|
|
|
|
MoorSong(
|
|
|
|
{@required this.title,
|
|
|
|
@required this.album,
|
|
|
|
@required this.artist,
|
|
|
|
@required this.path,
|
2020-04-11 14:27:49 +02:00
|
|
|
this.duration,
|
2020-03-30 22:25:57 +02:00
|
|
|
this.albumArtPath,
|
|
|
|
this.trackNumber});
|
|
|
|
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>();
|
|
|
|
return MoorSong(
|
|
|
|
title:
|
|
|
|
stringType.mapFromDatabaseResponse(data['${effectivePrefix}title']),
|
|
|
|
album:
|
|
|
|
stringType.mapFromDatabaseResponse(data['${effectivePrefix}album']),
|
|
|
|
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']),
|
2020-03-30 22:25:57 +02:00
|
|
|
albumArtPath: stringType
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}album_art_path']),
|
|
|
|
trackNumber: intType
|
|
|
|
.mapFromDatabaseResponse(data['${effectivePrefix}track_number']),
|
|
|
|
);
|
|
|
|
}
|
2020-06-01 10:49:33 +02:00
|
|
|
@override
|
|
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
|
|
final map = <String, Expression>{};
|
|
|
|
if (!nullToAbsent || title != null) {
|
|
|
|
map['title'] = Variable<String>(title);
|
|
|
|
}
|
|
|
|
if (!nullToAbsent || album != null) {
|
|
|
|
map['album'] = Variable<String>(album);
|
|
|
|
}
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
|
|
|
|
2020-03-30 22:25:57 +02:00
|
|
|
factory MoorSong.fromJson(Map<String, dynamic> json,
|
|
|
|
{ValueSerializer serializer}) {
|
|
|
|
serializer ??= moorRuntimeOptions.defaultSerializer;
|
|
|
|
return MoorSong(
|
|
|
|
title: serializer.fromJson<String>(json['title']),
|
|
|
|
album: serializer.fromJson<String>(json['album']),
|
|
|
|
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']),
|
2020-03-30 22:25:57 +02:00
|
|
|
albumArtPath: serializer.fromJson<String>(json['albumArtPath']),
|
|
|
|
trackNumber: serializer.fromJson<int>(json['trackNumber']),
|
|
|
|
);
|
|
|
|
}
|
|
|
|
@override
|
|
|
|
Map<String, dynamic> toJson({ValueSerializer serializer}) {
|
|
|
|
serializer ??= moorRuntimeOptions.defaultSerializer;
|
|
|
|
return <String, dynamic>{
|
|
|
|
'title': serializer.toJson<String>(title),
|
|
|
|
'album': serializer.toJson<String>(album),
|
|
|
|
'artist': serializer.toJson<String>(artist),
|
|
|
|
'path': serializer.toJson<String>(path),
|
2020-04-11 14:27:49 +02:00
|
|
|
'duration': serializer.toJson<int>(duration),
|
2020-03-30 22:25:57 +02:00
|
|
|
'albumArtPath': serializer.toJson<String>(albumArtPath),
|
|
|
|
'trackNumber': serializer.toJson<int>(trackNumber),
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
MoorSong copyWith(
|
|
|
|
{String title,
|
|
|
|
String album,
|
|
|
|
String artist,
|
|
|
|
String path,
|
2020-04-11 14:27:49 +02:00
|
|
|
int duration,
|
2020-03-30 22:25:57 +02:00
|
|
|
String albumArtPath,
|
|
|
|
int trackNumber}) =>
|
|
|
|
MoorSong(
|
|
|
|
title: title ?? this.title,
|
|
|
|
album: album ?? this.album,
|
|
|
|
artist: artist ?? this.artist,
|
|
|
|
path: path ?? this.path,
|
2020-04-11 14:27:49 +02:00
|
|
|
duration: duration ?? this.duration,
|
2020-03-30 22:25:57 +02:00
|
|
|
albumArtPath: albumArtPath ?? this.albumArtPath,
|
|
|
|
trackNumber: trackNumber ?? this.trackNumber,
|
|
|
|
);
|
|
|
|
@override
|
|
|
|
String toString() {
|
|
|
|
return (StringBuffer('MoorSong(')
|
|
|
|
..write('title: $title, ')
|
|
|
|
..write('album: $album, ')
|
|
|
|
..write('artist: $artist, ')
|
|
|
|
..write('path: $path, ')
|
2020-04-11 14:27:49 +02:00
|
|
|
..write('duration: $duration, ')
|
2020-03-30 22:25:57 +02:00
|
|
|
..write('albumArtPath: $albumArtPath, ')
|
|
|
|
..write('trackNumber: $trackNumber')
|
|
|
|
..write(')'))
|
|
|
|
.toString();
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
int get hashCode => $mrjf($mrjc(
|
|
|
|
title.hashCode,
|
|
|
|
$mrjc(
|
|
|
|
album.hashCode,
|
|
|
|
$mrjc(
|
|
|
|
artist.hashCode,
|
2020-04-11 14:27:49 +02:00
|
|
|
$mrjc(
|
|
|
|
path.hashCode,
|
|
|
|
$mrjc(duration.hashCode,
|
|
|
|
$mrjc(albumArtPath.hashCode, trackNumber.hashCode)))))));
|
2020-03-30 22:25:57 +02:00
|
|
|
@override
|
|
|
|
bool operator ==(dynamic other) =>
|
|
|
|
identical(this, other) ||
|
|
|
|
(other is MoorSong &&
|
|
|
|
other.title == this.title &&
|
|
|
|
other.album == this.album &&
|
|
|
|
other.artist == this.artist &&
|
|
|
|
other.path == this.path &&
|
2020-04-11 14:27:49 +02:00
|
|
|
other.duration == this.duration &&
|
2020-03-30 22:25:57 +02:00
|
|
|
other.albumArtPath == this.albumArtPath &&
|
|
|
|
other.trackNumber == this.trackNumber);
|
|
|
|
}
|
|
|
|
|
|
|
|
class SongsCompanion extends UpdateCompanion<MoorSong> {
|
|
|
|
final Value<String> title;
|
|
|
|
final Value<String> album;
|
|
|
|
final Value<String> artist;
|
|
|
|
final Value<String> path;
|
2020-04-11 14:27:49 +02:00
|
|
|
final Value<int> duration;
|
2020-03-30 22:25:57 +02:00
|
|
|
final Value<String> albumArtPath;
|
|
|
|
final Value<int> trackNumber;
|
|
|
|
const SongsCompanion({
|
|
|
|
this.title = const Value.absent(),
|
|
|
|
this.album = 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(),
|
2020-03-30 22:25:57 +02:00
|
|
|
this.albumArtPath = const Value.absent(),
|
|
|
|
this.trackNumber = const Value.absent(),
|
|
|
|
});
|
|
|
|
SongsCompanion.insert({
|
|
|
|
@required String title,
|
|
|
|
@required String album,
|
|
|
|
@required String artist,
|
|
|
|
@required String path,
|
2020-04-11 14:27:49 +02:00
|
|
|
this.duration = const Value.absent(),
|
2020-03-30 22:25:57 +02:00
|
|
|
this.albumArtPath = const Value.absent(),
|
|
|
|
this.trackNumber = const Value.absent(),
|
|
|
|
}) : title = Value(title),
|
|
|
|
album = Value(album),
|
|
|
|
artist = Value(artist),
|
|
|
|
path = Value(path);
|
2020-06-01 10:49:33 +02:00
|
|
|
static Insertable<MoorSong> custom({
|
|
|
|
Expression<String> title,
|
|
|
|
Expression<String> album,
|
|
|
|
Expression<String> artist,
|
|
|
|
Expression<String> path,
|
|
|
|
Expression<int> duration,
|
|
|
|
Expression<String> albumArtPath,
|
|
|
|
Expression<int> trackNumber,
|
|
|
|
}) {
|
|
|
|
return RawValuesInsertable({
|
|
|
|
if (title != null) 'title': title,
|
|
|
|
if (album != null) 'album': album,
|
|
|
|
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-03-30 22:25:57 +02:00
|
|
|
SongsCompanion copyWith(
|
|
|
|
{Value<String> title,
|
|
|
|
Value<String> album,
|
|
|
|
Value<String> artist,
|
|
|
|
Value<String> path,
|
2020-04-11 14:27:49 +02:00
|
|
|
Value<int> duration,
|
2020-03-30 22:25:57 +02:00
|
|
|
Value<String> albumArtPath,
|
|
|
|
Value<int> trackNumber}) {
|
|
|
|
return SongsCompanion(
|
|
|
|
title: title ?? this.title,
|
|
|
|
album: album ?? this.album,
|
|
|
|
artist: artist ?? this.artist,
|
|
|
|
path: path ?? this.path,
|
2020-04-11 14:27:49 +02:00
|
|
|
duration: duration ?? this.duration,
|
2020-03-30 22:25:57 +02:00
|
|
|
albumArtPath: albumArtPath ?? this.albumArtPath,
|
|
|
|
trackNumber: trackNumber ?? this.trackNumber,
|
|
|
|
);
|
|
|
|
}
|
2020-06-01 10:49:33 +02:00
|
|
|
|
|
|
|
@override
|
|
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
|
|
final map = <String, Expression>{};
|
|
|
|
if (title.present) {
|
|
|
|
map['title'] = Variable<String>(title.value);
|
|
|
|
}
|
|
|
|
if (album.present) {
|
|
|
|
map['album'] = Variable<String>(album.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);
|
|
|
|
}
|
|
|
|
return map;
|
|
|
|
}
|
2020-03-30 22:25:57 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
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,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
final VerificationMeta _albumMeta = const VerificationMeta('album');
|
|
|
|
GeneratedTextColumn _album;
|
|
|
|
@override
|
|
|
|
GeneratedTextColumn get album => _album ??= _constructAlbum();
|
|
|
|
GeneratedTextColumn _constructAlbum() {
|
|
|
|
return GeneratedTextColumn(
|
|
|
|
'album',
|
|
|
|
$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,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-03-30 22:25:57 +02:00
|
|
|
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,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
List<GeneratedColumn> get $columns =>
|
2020-04-11 14:27:49 +02:00
|
|
|
[title, album, artist, path, duration, albumArtPath, trackNumber];
|
2020-03-30 22:25:57 +02:00
|
|
|
@override
|
|
|
|
$SongsTable get asDslTable => this;
|
|
|
|
@override
|
|
|
|
String get $tableName => _alias ?? 'songs';
|
|
|
|
@override
|
|
|
|
final String actualTableName = 'songs';
|
|
|
|
@override
|
2020-06-01 10:49:33 +02:00
|
|
|
VerificationContext validateIntegrity(Insertable<MoorSong> instance,
|
2020-03-30 22:25:57 +02:00
|
|
|
{bool isInserting = false}) {
|
|
|
|
final context = VerificationContext();
|
2020-06-01 10:49:33 +02:00
|
|
|
final data = instance.toColumns(true);
|
|
|
|
if (data.containsKey('title')) {
|
2020-03-30 22:25:57 +02:00
|
|
|
context.handle(
|
2020-06-01 10:49:33 +02:00
|
|
|
_titleMeta, title.isAcceptableOrUnknown(data['title'], _titleMeta));
|
2020-03-30 22:25:57 +02:00
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_titleMeta);
|
|
|
|
}
|
2020-06-01 10:49:33 +02:00
|
|
|
if (data.containsKey('album')) {
|
2020-03-30 22:25:57 +02:00
|
|
|
context.handle(
|
2020-06-01 10:49:33 +02:00
|
|
|
_albumMeta, album.isAcceptableOrUnknown(data['album'], _albumMeta));
|
2020-03-30 22:25:57 +02:00
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_albumMeta);
|
|
|
|
}
|
2020-06-01 10:49:33 +02:00
|
|
|
if (data.containsKey('artist')) {
|
|
|
|
context.handle(_artistMeta,
|
|
|
|
artist.isAcceptableOrUnknown(data['artist'], _artistMeta));
|
2020-03-30 22:25:57 +02:00
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_artistMeta);
|
|
|
|
}
|
2020-06-01 10:49:33 +02:00
|
|
|
if (data.containsKey('path')) {
|
2020-03-30 22:25:57 +02:00
|
|
|
context.handle(
|
2020-06-01 10:49:33 +02:00
|
|
|
_pathMeta, path.isAcceptableOrUnknown(data['path'], _pathMeta));
|
2020-03-30 22:25:57 +02:00
|
|
|
} else if (isInserting) {
|
|
|
|
context.missing(_pathMeta);
|
|
|
|
}
|
2020-06-01 10:49:33 +02:00
|
|
|
if (data.containsKey('duration')) {
|
2020-04-11 14:27:49 +02:00
|
|
|
context.handle(_durationMeta,
|
2020-06-01 10:49:33 +02:00
|
|
|
duration.isAcceptableOrUnknown(data['duration'], _durationMeta));
|
2020-04-11 14:27:49 +02:00
|
|
|
}
|
2020-06-01 10:49:33 +02:00
|
|
|
if (data.containsKey('album_art_path')) {
|
2020-03-30 22:25:57 +02:00
|
|
|
context.handle(
|
|
|
|
_albumArtPathMeta,
|
2020-06-01 10:49:33 +02:00
|
|
|
albumArtPath.isAcceptableOrUnknown(
|
|
|
|
data['album_art_path'], _albumArtPathMeta));
|
2020-03-30 22:25:57 +02:00
|
|
|
}
|
2020-06-01 10:49:33 +02:00
|
|
|
if (data.containsKey('track_number')) {
|
|
|
|
context.handle(
|
|
|
|
_trackNumberMeta,
|
|
|
|
trackNumber.isAcceptableOrUnknown(
|
|
|
|
data['track_number'], _trackNumberMeta));
|
2020-03-30 22:25:57 +02:00
|
|
|
}
|
|
|
|
return context;
|
|
|
|
}
|
|
|
|
|
|
|
|
@override
|
|
|
|
Set<GeneratedColumn> get $primaryKey => <GeneratedColumn>{};
|
|
|
|
@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);
|
2020-06-01 10:49:33 +02:00
|
|
|
_$MoorMusicDataSource.connect(DatabaseConnection c) : super.connect(c);
|
2020-03-24 22:17:03 +01:00
|
|
|
$AlbumsTable _albums;
|
|
|
|
$AlbumsTable get albums => _albums ??= $AlbumsTable(this);
|
2020-03-30 22:25:57 +02:00
|
|
|
$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
|
2020-03-30 22:25:57 +02:00
|
|
|
List<DatabaseSchemaEntity> get allSchemaEntities => [albums, songs];
|
2020-03-24 22:17:03 +01:00
|
|
|
}
|