268 lines
8.3 KiB
Dart
268 lines
8.3 KiB
Dart
|
// 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']),
|
||
|
);
|
||
|
}
|
||
|
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),
|
||
|
};
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
AlbumsCompanion createCompanion(bool nullToAbsent) {
|
||
|
return AlbumsCompanion(
|
||
|
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),
|
||
|
);
|
||
|
}
|
||
|
|
||
|
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);
|
||
|
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,
|
||
|
);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
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
|
||
|
VerificationContext validateIntegrity(AlbumsCompanion d,
|
||
|
{bool isInserting = false}) {
|
||
|
final context = VerificationContext();
|
||
|
if (d.title.present) {
|
||
|
context.handle(
|
||
|
_titleMeta, title.isAcceptableValue(d.title.value, _titleMeta));
|
||
|
} else if (isInserting) {
|
||
|
context.missing(_titleMeta);
|
||
|
}
|
||
|
if (d.artist.present) {
|
||
|
context.handle(
|
||
|
_artistMeta, artist.isAcceptableValue(d.artist.value, _artistMeta));
|
||
|
} else if (isInserting) {
|
||
|
context.missing(_artistMeta);
|
||
|
}
|
||
|
if (d.albumArtPath.present) {
|
||
|
context.handle(
|
||
|
_albumArtPathMeta,
|
||
|
albumArtPath.isAcceptableValue(
|
||
|
d.albumArtPath.value, _albumArtPathMeta));
|
||
|
}
|
||
|
if (d.year.present) {
|
||
|
context.handle(
|
||
|
_yearMeta, year.isAcceptableValue(d.year.value, _yearMeta));
|
||
|
}
|
||
|
return context;
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Set<GeneratedColumn> get $primaryKey => {title, artist};
|
||
|
@override
|
||
|
MoorAlbum map(Map<String, dynamic> data, {String tablePrefix}) {
|
||
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : null;
|
||
|
return MoorAlbum.fromData(data, _db, prefix: effectivePrefix);
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
Map<String, Variable> entityToSql(AlbumsCompanion d) {
|
||
|
final map = <String, Variable>{};
|
||
|
if (d.title.present) {
|
||
|
map['title'] = Variable<String, StringType>(d.title.value);
|
||
|
}
|
||
|
if (d.artist.present) {
|
||
|
map['artist'] = Variable<String, StringType>(d.artist.value);
|
||
|
}
|
||
|
if (d.albumArtPath.present) {
|
||
|
map['album_art_path'] =
|
||
|
Variable<String, StringType>(d.albumArtPath.value);
|
||
|
}
|
||
|
if (d.year.present) {
|
||
|
map['year'] = Variable<int, IntType>(d.year.value);
|
||
|
}
|
||
|
return map;
|
||
|
}
|
||
|
|
||
|
@override
|
||
|
$AlbumsTable createAlias(String alias) {
|
||
|
return $AlbumsTable(_db, alias);
|
||
|
}
|
||
|
}
|
||
|
|
||
|
abstract class _$MoorMusicDataSource extends GeneratedDatabase {
|
||
|
_$MoorMusicDataSource(QueryExecutor e)
|
||
|
: super(SqlTypeSystem.defaultInstance, e);
|
||
|
$AlbumsTable _albums;
|
||
|
$AlbumsTable get albums => _albums ??= $AlbumsTable(this);
|
||
|
@override
|
||
|
Iterable<TableInfo> get allTables => allSchemaEntities.whereType<TableInfo>();
|
||
|
@override
|
||
|
List<DatabaseSchemaEntity> get allSchemaEntities => [albums];
|
||
|
}
|