// 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 { final int id; final String title; final String artist; final String albumArtPath; final int year; final bool present; MoorAlbum( {@required this.id, @required this.title, @required this.artist, this.albumArtPath, this.year, @required this.present}); factory MoorAlbum.fromData(Map data, GeneratedDatabase db, {String prefix}) { final effectivePrefix = prefix ?? ''; final intType = db.typeSystem.forDartType(); final stringType = db.typeSystem.forDartType(); final boolType = db.typeSystem.forDartType(); return MoorAlbum( id: intType.mapFromDatabaseResponse(data['${effectivePrefix}id']), 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']), present: boolType.mapFromDatabaseResponse(data['${effectivePrefix}present']), ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (!nullToAbsent || id != null) { map['id'] = Variable(id); } if (!nullToAbsent || title != null) { map['title'] = Variable(title); } if (!nullToAbsent || artist != null) { map['artist'] = Variable(artist); } if (!nullToAbsent || albumArtPath != null) { map['album_art_path'] = Variable(albumArtPath); } if (!nullToAbsent || year != null) { map['year'] = Variable(year); } if (!nullToAbsent || present != null) { map['present'] = Variable(present); } return map; } 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), ); } factory MoorAlbum.fromJson(Map json, {ValueSerializer serializer}) { serializer ??= moorRuntimeOptions.defaultSerializer; return MoorAlbum( id: serializer.fromJson(json['id']), title: serializer.fromJson(json['title']), artist: serializer.fromJson(json['artist']), albumArtPath: serializer.fromJson(json['albumArtPath']), year: serializer.fromJson(json['year']), present: serializer.fromJson(json['present']), ); } @override Map toJson({ValueSerializer serializer}) { serializer ??= moorRuntimeOptions.defaultSerializer; return { 'id': serializer.toJson(id), 'title': serializer.toJson(title), 'artist': serializer.toJson(artist), 'albumArtPath': serializer.toJson(albumArtPath), 'year': serializer.toJson(year), 'present': serializer.toJson(present), }; } MoorAlbum copyWith( {int id, String title, String artist, String albumArtPath, int year, bool present}) => MoorAlbum( id: id ?? this.id, title: title ?? this.title, artist: artist ?? this.artist, albumArtPath: albumArtPath ?? this.albumArtPath, year: year ?? this.year, present: present ?? this.present, ); @override String toString() { return (StringBuffer('MoorAlbum(') ..write('id: $id, ') ..write('title: $title, ') ..write('artist: $artist, ') ..write('albumArtPath: $albumArtPath, ') ..write('year: $year, ') ..write('present: $present') ..write(')')) .toString(); } @override int get hashCode => $mrjf($mrjc( id.hashCode, $mrjc( title.hashCode, $mrjc( artist.hashCode, $mrjc(albumArtPath.hashCode, $mrjc(year.hashCode, present.hashCode)))))); @override bool operator ==(dynamic other) => identical(this, other) || (other is MoorAlbum && other.id == this.id && other.title == this.title && other.artist == this.artist && other.albumArtPath == this.albumArtPath && other.year == this.year && other.present == this.present); } class AlbumsCompanion extends UpdateCompanion { final Value id; final Value title; final Value artist; final Value albumArtPath; final Value year; final Value present; const AlbumsCompanion({ this.id = const Value.absent(), this.title = const Value.absent(), this.artist = const Value.absent(), this.albumArtPath = const Value.absent(), this.year = const Value.absent(), this.present = const Value.absent(), }); AlbumsCompanion.insert({ this.id = const Value.absent(), @required String title, @required String artist, this.albumArtPath = const Value.absent(), this.year = const Value.absent(), this.present = const Value.absent(), }) : title = Value(title), artist = Value(artist); static Insertable custom({ Expression id, Expression title, Expression artist, Expression albumArtPath, Expression year, Expression present, }) { return RawValuesInsertable({ 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, if (present != null) 'present': present, }); } AlbumsCompanion copyWith( {Value id, Value title, Value artist, Value albumArtPath, Value year, Value present}) { return AlbumsCompanion( id: id ?? this.id, title: title ?? this.title, artist: artist ?? this.artist, albumArtPath: albumArtPath ?? this.albumArtPath, year: year ?? this.year, present: present ?? this.present, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (id.present) { map['id'] = Variable(id.value); } if (title.present) { map['title'] = Variable(title.value); } if (artist.present) { map['artist'] = Variable(artist.value); } if (albumArtPath.present) { map['album_art_path'] = Variable(albumArtPath.value); } if (year.present) { map['year'] = Variable(year.value); } if (present.present) { map['present'] = Variable(present.value); } return map; } } class $AlbumsTable extends Albums with TableInfo<$AlbumsTable, MoorAlbum> { final GeneratedDatabase _db; final String _alias; $AlbumsTable(this._db, [this._alias]); 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); } 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, ); } 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)); } @override List get $columns => [id, title, artist, albumArtPath, year, present]; @override $AlbumsTable get asDslTable => this; @override String get $tableName => _alias ?? 'albums'; @override final String actualTableName = 'albums'; @override VerificationContext validateIntegrity(Insertable instance, {bool isInserting = false}) { final context = VerificationContext(); final data = instance.toColumns(true); if (data.containsKey('id')) { context.handle(_idMeta, id.isAcceptableOrUnknown(data['id'], _idMeta)); } if (data.containsKey('title')) { context.handle( _titleMeta, title.isAcceptableOrUnknown(data['title'], _titleMeta)); } else if (isInserting) { context.missing(_titleMeta); } if (data.containsKey('artist')) { context.handle(_artistMeta, artist.isAcceptableOrUnknown(data['artist'], _artistMeta)); } else if (isInserting) { context.missing(_artistMeta); } if (data.containsKey('album_art_path')) { context.handle( _albumArtPathMeta, albumArtPath.isAcceptableOrUnknown( data['album_art_path'], _albumArtPathMeta)); } if (data.containsKey('year')) { context.handle( _yearMeta, year.isAcceptableOrUnknown(data['year'], _yearMeta)); } if (data.containsKey('present')) { context.handle(_presentMeta, present.isAcceptableOrUnknown(data['present'], _presentMeta)); } return context; } @override Set get $primaryKey => {id}; @override MoorAlbum map(Map 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 { final String title; final String albumTitle; final int albumId; final String artist; final String path; final int duration; final String albumArtPath; final int trackNumber; final bool present; MoorSong( {@required this.title, @required this.albumTitle, @required this.albumId, @required this.artist, @required this.path, this.duration, this.albumArtPath, this.trackNumber, @required this.present}); factory MoorSong.fromData(Map data, GeneratedDatabase db, {String prefix}) { final effectivePrefix = prefix ?? ''; final stringType = db.typeSystem.forDartType(); final intType = db.typeSystem.forDartType(); final boolType = db.typeSystem.forDartType(); return MoorSong( title: stringType.mapFromDatabaseResponse(data['${effectivePrefix}title']), 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']), duration: intType.mapFromDatabaseResponse(data['${effectivePrefix}duration']), albumArtPath: stringType .mapFromDatabaseResponse(data['${effectivePrefix}album_art_path']), trackNumber: intType .mapFromDatabaseResponse(data['${effectivePrefix}track_number']), present: boolType.mapFromDatabaseResponse(data['${effectivePrefix}present']), ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (!nullToAbsent || title != null) { map['title'] = Variable(title); } if (!nullToAbsent || albumTitle != null) { map['album_title'] = Variable(albumTitle); } if (!nullToAbsent || albumId != null) { map['album_id'] = Variable(albumId); } if (!nullToAbsent || artist != null) { map['artist'] = Variable(artist); } if (!nullToAbsent || path != null) { map['path'] = Variable(path); } if (!nullToAbsent || duration != null) { map['duration'] = Variable(duration); } if (!nullToAbsent || albumArtPath != null) { map['album_art_path'] = Variable(albumArtPath); } if (!nullToAbsent || trackNumber != null) { map['track_number'] = Variable(trackNumber); } if (!nullToAbsent || present != null) { map['present'] = Variable(present); } return map; } 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 json, {ValueSerializer serializer}) { serializer ??= moorRuntimeOptions.defaultSerializer; return MoorSong( title: serializer.fromJson(json['title']), albumTitle: serializer.fromJson(json['albumTitle']), albumId: serializer.fromJson(json['albumId']), artist: serializer.fromJson(json['artist']), path: serializer.fromJson(json['path']), duration: serializer.fromJson(json['duration']), albumArtPath: serializer.fromJson(json['albumArtPath']), trackNumber: serializer.fromJson(json['trackNumber']), present: serializer.fromJson(json['present']), ); } @override Map toJson({ValueSerializer serializer}) { serializer ??= moorRuntimeOptions.defaultSerializer; return { 'title': serializer.toJson(title), 'albumTitle': serializer.toJson(albumTitle), 'albumId': serializer.toJson(albumId), 'artist': serializer.toJson(artist), 'path': serializer.toJson(path), 'duration': serializer.toJson(duration), 'albumArtPath': serializer.toJson(albumArtPath), 'trackNumber': serializer.toJson(trackNumber), 'present': serializer.toJson(present), }; } MoorSong copyWith( {String title, String albumTitle, int albumId, String artist, String path, int duration, String albumArtPath, int trackNumber, bool present}) => MoorSong( title: title ?? this.title, albumTitle: albumTitle ?? this.albumTitle, albumId: albumId ?? this.albumId, artist: artist ?? this.artist, path: path ?? this.path, duration: duration ?? this.duration, albumArtPath: albumArtPath ?? this.albumArtPath, trackNumber: trackNumber ?? this.trackNumber, present: present ?? this.present, ); @override String toString() { return (StringBuffer('MoorSong(') ..write('title: $title, ') ..write('albumTitle: $albumTitle, ') ..write('albumId: $albumId, ') ..write('artist: $artist, ') ..write('path: $path, ') ..write('duration: $duration, ') ..write('albumArtPath: $albumArtPath, ') ..write('trackNumber: $trackNumber, ') ..write('present: $present') ..write(')')) .toString(); } @override int get hashCode => $mrjf($mrjc( title.hashCode, $mrjc( albumTitle.hashCode, $mrjc( albumId.hashCode, $mrjc( 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 && other.albumTitle == this.albumTitle && other.albumId == this.albumId && other.artist == this.artist && other.path == this.path && other.duration == this.duration && other.albumArtPath == this.albumArtPath && other.trackNumber == this.trackNumber && other.present == this.present); } class SongsCompanion extends UpdateCompanion { final Value title; final Value albumTitle; final Value albumId; final Value artist; final Value path; final Value duration; final Value albumArtPath; final Value trackNumber; final Value present; const SongsCompanion({ this.title = const Value.absent(), this.albumTitle = const Value.absent(), this.albumId = const Value.absent(), this.artist = const Value.absent(), this.path = const Value.absent(), this.duration = const Value.absent(), this.albumArtPath = const Value.absent(), this.trackNumber = const Value.absent(), this.present = const Value.absent(), }); SongsCompanion.insert({ @required String title, @required String albumTitle, @required int albumId, @required String artist, @required String path, this.duration = const Value.absent(), this.albumArtPath = const Value.absent(), this.trackNumber = const Value.absent(), this.present = const Value.absent(), }) : title = Value(title), albumTitle = Value(albumTitle), albumId = Value(albumId), artist = Value(artist), path = Value(path); static Insertable custom({ Expression title, Expression albumTitle, Expression albumId, Expression artist, Expression path, Expression duration, Expression albumArtPath, Expression trackNumber, Expression present, }) { return RawValuesInsertable({ if (title != null) 'title': title, 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, if (present != null) 'present': present, }); } SongsCompanion copyWith( {Value title, Value albumTitle, Value albumId, Value artist, Value path, Value duration, Value albumArtPath, Value trackNumber, Value present}) { return SongsCompanion( title: title ?? this.title, albumTitle: albumTitle ?? this.albumTitle, albumId: albumId ?? this.albumId, artist: artist ?? this.artist, path: path ?? this.path, duration: duration ?? this.duration, albumArtPath: albumArtPath ?? this.albumArtPath, trackNumber: trackNumber ?? this.trackNumber, present: present ?? this.present, ); } @override Map toColumns(bool nullToAbsent) { final map = {}; if (title.present) { map['title'] = Variable(title.value); } if (albumTitle.present) { map['album_title'] = Variable(albumTitle.value); } if (albumId.present) { map['album_id'] = Variable(albumId.value); } if (artist.present) { map['artist'] = Variable(artist.value); } if (path.present) { map['path'] = Variable(path.value); } if (duration.present) { map['duration'] = Variable(duration.value); } if (albumArtPath.present) { map['album_art_path'] = Variable(albumArtPath.value); } if (trackNumber.present) { map['track_number'] = Variable(trackNumber.value); } if (present.present) { map['present'] = Variable(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, ); } final VerificationMeta _albumTitleMeta = const VerificationMeta('albumTitle'); GeneratedTextColumn _albumTitle; @override GeneratedTextColumn get albumTitle => _albumTitle ??= _constructAlbumTitle(); GeneratedTextColumn _constructAlbumTitle() { return GeneratedTextColumn( '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, ); } 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, ); } 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)); } @override List 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 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); } if (data.containsKey('album_title')) { context.handle( _albumTitleMeta, albumTitle.isAcceptableOrUnknown( data['album_title'], _albumTitleMeta)); } else if (isInserting) { 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')) { context.handle(_durationMeta, duration.isAcceptableOrUnknown(data['duration'], _durationMeta)); } 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)); } if (data.containsKey('present')) { context.handle(_presentMeta, present.isAcceptableOrUnknown(data['present'], _presentMeta)); } return context; } @override Set get $primaryKey => {path}; @override MoorSong map(Map 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); } } abstract class _$MoorMusicDataSource extends GeneratedDatabase { _$MoorMusicDataSource(QueryExecutor e) : super(SqlTypeSystem.defaultInstance, e); _$MoorMusicDataSource.connect(DatabaseConnection c) : super.connect(c); $AlbumsTable _albums; $AlbumsTable get albums => _albums ??= $AlbumsTable(this); $SongsTable _songs; $SongsTable get songs => _songs ??= $SongsTable(this); @override Iterable get allTables => allSchemaEntities.whereType(); @override List get allSchemaEntities => [albums, songs]; }