- Playlists + PlaylistSongs tables with position-ordered join query - Favorites table with toggle + watch (reactive heart icon support) - PlaybackHistory table for resume-position tracking - Schema v2 with migration from v1 - Follows existing Songs/Folders sync-ready pattern (uuid id, updatedAtMs, deleted) Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
4266 lines
132 KiB
Dart
4266 lines
132 KiB
Dart
// GENERATED CODE - DO NOT MODIFY BY HAND
|
|
|
|
part of 'database.dart';
|
|
|
|
// ignore_for_file: type=lint
|
|
class $SongsTable extends Songs with TableInfo<$SongsTable, Song> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$SongsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<String> id = GeneratedColumn<String>(
|
|
'id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _pathMeta = const VerificationMeta('path');
|
|
@override
|
|
late final GeneratedColumn<String> path = GeneratedColumn<String>(
|
|
'path',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
|
|
);
|
|
static const VerificationMeta _titleMeta = const VerificationMeta('title');
|
|
@override
|
|
late final GeneratedColumn<String> title = GeneratedColumn<String>(
|
|
'title',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _artistMeta = const VerificationMeta('artist');
|
|
@override
|
|
late final GeneratedColumn<String> artist = GeneratedColumn<String>(
|
|
'artist',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _albumMeta = const VerificationMeta('album');
|
|
@override
|
|
late final GeneratedColumn<String> album = GeneratedColumn<String>(
|
|
'album',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _durationMsMeta = const VerificationMeta(
|
|
'durationMs',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> durationMs = GeneratedColumn<int>(
|
|
'duration_ms',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _coverPathMeta = const VerificationMeta(
|
|
'coverPath',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> coverPath = GeneratedColumn<String>(
|
|
'cover_path',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _dateAddedMsMeta = const VerificationMeta(
|
|
'dateAddedMs',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> dateAddedMs = GeneratedColumn<int>(
|
|
'date_added_ms',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _updatedAtMsMeta = const VerificationMeta(
|
|
'updatedAtMs',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> updatedAtMs = GeneratedColumn<int>(
|
|
'updated_at_ms',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _deletedMeta = const VerificationMeta(
|
|
'deleted',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> deleted = GeneratedColumn<bool>(
|
|
'deleted',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("deleted" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(false),
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
id,
|
|
path,
|
|
title,
|
|
artist,
|
|
album,
|
|
durationMs,
|
|
coverPath,
|
|
dateAddedMs,
|
|
updatedAtMs,
|
|
deleted,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'songs';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Song> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
} else if (isInserting) {
|
|
context.missing(_idMeta);
|
|
}
|
|
if (data.containsKey('path')) {
|
|
context.handle(
|
|
_pathMeta,
|
|
path.isAcceptableOrUnknown(data['path']!, _pathMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_pathMeta);
|
|
}
|
|
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),
|
|
);
|
|
}
|
|
if (data.containsKey('album')) {
|
|
context.handle(
|
|
_albumMeta,
|
|
album.isAcceptableOrUnknown(data['album']!, _albumMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('duration_ms')) {
|
|
context.handle(
|
|
_durationMsMeta,
|
|
durationMs.isAcceptableOrUnknown(data['duration_ms']!, _durationMsMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('cover_path')) {
|
|
context.handle(
|
|
_coverPathMeta,
|
|
coverPath.isAcceptableOrUnknown(data['cover_path']!, _coverPathMeta),
|
|
);
|
|
}
|
|
if (data.containsKey('date_added_ms')) {
|
|
context.handle(
|
|
_dateAddedMsMeta,
|
|
dateAddedMs.isAcceptableOrUnknown(
|
|
data['date_added_ms']!,
|
|
_dateAddedMsMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_dateAddedMsMeta);
|
|
}
|
|
if (data.containsKey('updated_at_ms')) {
|
|
context.handle(
|
|
_updatedAtMsMeta,
|
|
updatedAtMs.isAcceptableOrUnknown(
|
|
data['updated_at_ms']!,
|
|
_updatedAtMsMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_updatedAtMsMeta);
|
|
}
|
|
if (data.containsKey('deleted')) {
|
|
context.handle(
|
|
_deletedMeta,
|
|
deleted.isAcceptableOrUnknown(data['deleted']!, _deletedMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
Song map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Song(
|
|
id: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}id'],
|
|
)!,
|
|
path: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}path'],
|
|
)!,
|
|
title: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}title'],
|
|
)!,
|
|
artist: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}artist'],
|
|
),
|
|
album: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}album'],
|
|
),
|
|
durationMs: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}duration_ms'],
|
|
),
|
|
coverPath: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}cover_path'],
|
|
),
|
|
dateAddedMs: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}date_added_ms'],
|
|
)!,
|
|
updatedAtMs: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}updated_at_ms'],
|
|
)!,
|
|
deleted: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}deleted'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$SongsTable createAlias(String alias) {
|
|
return $SongsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Song extends DataClass implements Insertable<Song> {
|
|
final String id;
|
|
final String path;
|
|
final String title;
|
|
final String? artist;
|
|
final String? album;
|
|
final int? durationMs;
|
|
final String? coverPath;
|
|
final int dateAddedMs;
|
|
final int updatedAtMs;
|
|
final bool deleted;
|
|
const Song({
|
|
required this.id,
|
|
required this.path,
|
|
required this.title,
|
|
this.artist,
|
|
this.album,
|
|
this.durationMs,
|
|
this.coverPath,
|
|
required this.dateAddedMs,
|
|
required this.updatedAtMs,
|
|
required this.deleted,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<String>(id);
|
|
map['path'] = Variable<String>(path);
|
|
map['title'] = Variable<String>(title);
|
|
if (!nullToAbsent || artist != null) {
|
|
map['artist'] = Variable<String>(artist);
|
|
}
|
|
if (!nullToAbsent || album != null) {
|
|
map['album'] = Variable<String>(album);
|
|
}
|
|
if (!nullToAbsent || durationMs != null) {
|
|
map['duration_ms'] = Variable<int>(durationMs);
|
|
}
|
|
if (!nullToAbsent || coverPath != null) {
|
|
map['cover_path'] = Variable<String>(coverPath);
|
|
}
|
|
map['date_added_ms'] = Variable<int>(dateAddedMs);
|
|
map['updated_at_ms'] = Variable<int>(updatedAtMs);
|
|
map['deleted'] = Variable<bool>(deleted);
|
|
return map;
|
|
}
|
|
|
|
SongsCompanion toCompanion(bool nullToAbsent) {
|
|
return SongsCompanion(
|
|
id: Value(id),
|
|
path: Value(path),
|
|
title: Value(title),
|
|
artist: artist == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(artist),
|
|
album: album == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(album),
|
|
durationMs: durationMs == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(durationMs),
|
|
coverPath: coverPath == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(coverPath),
|
|
dateAddedMs: Value(dateAddedMs),
|
|
updatedAtMs: Value(updatedAtMs),
|
|
deleted: Value(deleted),
|
|
);
|
|
}
|
|
|
|
factory Song.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Song(
|
|
id: serializer.fromJson<String>(json['id']),
|
|
path: serializer.fromJson<String>(json['path']),
|
|
title: serializer.fromJson<String>(json['title']),
|
|
artist: serializer.fromJson<String?>(json['artist']),
|
|
album: serializer.fromJson<String?>(json['album']),
|
|
durationMs: serializer.fromJson<int?>(json['durationMs']),
|
|
coverPath: serializer.fromJson<String?>(json['coverPath']),
|
|
dateAddedMs: serializer.fromJson<int>(json['dateAddedMs']),
|
|
updatedAtMs: serializer.fromJson<int>(json['updatedAtMs']),
|
|
deleted: serializer.fromJson<bool>(json['deleted']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<String>(id),
|
|
'path': serializer.toJson<String>(path),
|
|
'title': serializer.toJson<String>(title),
|
|
'artist': serializer.toJson<String?>(artist),
|
|
'album': serializer.toJson<String?>(album),
|
|
'durationMs': serializer.toJson<int?>(durationMs),
|
|
'coverPath': serializer.toJson<String?>(coverPath),
|
|
'dateAddedMs': serializer.toJson<int>(dateAddedMs),
|
|
'updatedAtMs': serializer.toJson<int>(updatedAtMs),
|
|
'deleted': serializer.toJson<bool>(deleted),
|
|
};
|
|
}
|
|
|
|
Song copyWith({
|
|
String? id,
|
|
String? path,
|
|
String? title,
|
|
Value<String?> artist = const Value.absent(),
|
|
Value<String?> album = const Value.absent(),
|
|
Value<int?> durationMs = const Value.absent(),
|
|
Value<String?> coverPath = const Value.absent(),
|
|
int? dateAddedMs,
|
|
int? updatedAtMs,
|
|
bool? deleted,
|
|
}) => Song(
|
|
id: id ?? this.id,
|
|
path: path ?? this.path,
|
|
title: title ?? this.title,
|
|
artist: artist.present ? artist.value : this.artist,
|
|
album: album.present ? album.value : this.album,
|
|
durationMs: durationMs.present ? durationMs.value : this.durationMs,
|
|
coverPath: coverPath.present ? coverPath.value : this.coverPath,
|
|
dateAddedMs: dateAddedMs ?? this.dateAddedMs,
|
|
updatedAtMs: updatedAtMs ?? this.updatedAtMs,
|
|
deleted: deleted ?? this.deleted,
|
|
);
|
|
Song copyWithCompanion(SongsCompanion data) {
|
|
return Song(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
path: data.path.present ? data.path.value : this.path,
|
|
title: data.title.present ? data.title.value : this.title,
|
|
artist: data.artist.present ? data.artist.value : this.artist,
|
|
album: data.album.present ? data.album.value : this.album,
|
|
durationMs: data.durationMs.present
|
|
? data.durationMs.value
|
|
: this.durationMs,
|
|
coverPath: data.coverPath.present ? data.coverPath.value : this.coverPath,
|
|
dateAddedMs: data.dateAddedMs.present
|
|
? data.dateAddedMs.value
|
|
: this.dateAddedMs,
|
|
updatedAtMs: data.updatedAtMs.present
|
|
? data.updatedAtMs.value
|
|
: this.updatedAtMs,
|
|
deleted: data.deleted.present ? data.deleted.value : this.deleted,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Song(')
|
|
..write('id: $id, ')
|
|
..write('path: $path, ')
|
|
..write('title: $title, ')
|
|
..write('artist: $artist, ')
|
|
..write('album: $album, ')
|
|
..write('durationMs: $durationMs, ')
|
|
..write('coverPath: $coverPath, ')
|
|
..write('dateAddedMs: $dateAddedMs, ')
|
|
..write('updatedAtMs: $updatedAtMs, ')
|
|
..write('deleted: $deleted')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(
|
|
id,
|
|
path,
|
|
title,
|
|
artist,
|
|
album,
|
|
durationMs,
|
|
coverPath,
|
|
dateAddedMs,
|
|
updatedAtMs,
|
|
deleted,
|
|
);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Song &&
|
|
other.id == this.id &&
|
|
other.path == this.path &&
|
|
other.title == this.title &&
|
|
other.artist == this.artist &&
|
|
other.album == this.album &&
|
|
other.durationMs == this.durationMs &&
|
|
other.coverPath == this.coverPath &&
|
|
other.dateAddedMs == this.dateAddedMs &&
|
|
other.updatedAtMs == this.updatedAtMs &&
|
|
other.deleted == this.deleted);
|
|
}
|
|
|
|
class SongsCompanion extends UpdateCompanion<Song> {
|
|
final Value<String> id;
|
|
final Value<String> path;
|
|
final Value<String> title;
|
|
final Value<String?> artist;
|
|
final Value<String?> album;
|
|
final Value<int?> durationMs;
|
|
final Value<String?> coverPath;
|
|
final Value<int> dateAddedMs;
|
|
final Value<int> updatedAtMs;
|
|
final Value<bool> deleted;
|
|
final Value<int> rowid;
|
|
const SongsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.path = const Value.absent(),
|
|
this.title = const Value.absent(),
|
|
this.artist = const Value.absent(),
|
|
this.album = const Value.absent(),
|
|
this.durationMs = const Value.absent(),
|
|
this.coverPath = const Value.absent(),
|
|
this.dateAddedMs = const Value.absent(),
|
|
this.updatedAtMs = const Value.absent(),
|
|
this.deleted = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
SongsCompanion.insert({
|
|
required String id,
|
|
required String path,
|
|
required String title,
|
|
this.artist = const Value.absent(),
|
|
this.album = const Value.absent(),
|
|
this.durationMs = const Value.absent(),
|
|
this.coverPath = const Value.absent(),
|
|
required int dateAddedMs,
|
|
required int updatedAtMs,
|
|
this.deleted = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : id = Value(id),
|
|
path = Value(path),
|
|
title = Value(title),
|
|
dateAddedMs = Value(dateAddedMs),
|
|
updatedAtMs = Value(updatedAtMs);
|
|
static Insertable<Song> custom({
|
|
Expression<String>? id,
|
|
Expression<String>? path,
|
|
Expression<String>? title,
|
|
Expression<String>? artist,
|
|
Expression<String>? album,
|
|
Expression<int>? durationMs,
|
|
Expression<String>? coverPath,
|
|
Expression<int>? dateAddedMs,
|
|
Expression<int>? updatedAtMs,
|
|
Expression<bool>? deleted,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (path != null) 'path': path,
|
|
if (title != null) 'title': title,
|
|
if (artist != null) 'artist': artist,
|
|
if (album != null) 'album': album,
|
|
if (durationMs != null) 'duration_ms': durationMs,
|
|
if (coverPath != null) 'cover_path': coverPath,
|
|
if (dateAddedMs != null) 'date_added_ms': dateAddedMs,
|
|
if (updatedAtMs != null) 'updated_at_ms': updatedAtMs,
|
|
if (deleted != null) 'deleted': deleted,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
SongsCompanion copyWith({
|
|
Value<String>? id,
|
|
Value<String>? path,
|
|
Value<String>? title,
|
|
Value<String?>? artist,
|
|
Value<String?>? album,
|
|
Value<int?>? durationMs,
|
|
Value<String?>? coverPath,
|
|
Value<int>? dateAddedMs,
|
|
Value<int>? updatedAtMs,
|
|
Value<bool>? deleted,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return SongsCompanion(
|
|
id: id ?? this.id,
|
|
path: path ?? this.path,
|
|
title: title ?? this.title,
|
|
artist: artist ?? this.artist,
|
|
album: album ?? this.album,
|
|
durationMs: durationMs ?? this.durationMs,
|
|
coverPath: coverPath ?? this.coverPath,
|
|
dateAddedMs: dateAddedMs ?? this.dateAddedMs,
|
|
updatedAtMs: updatedAtMs ?? this.updatedAtMs,
|
|
deleted: deleted ?? this.deleted,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<String>(id.value);
|
|
}
|
|
if (path.present) {
|
|
map['path'] = Variable<String>(path.value);
|
|
}
|
|
if (title.present) {
|
|
map['title'] = Variable<String>(title.value);
|
|
}
|
|
if (artist.present) {
|
|
map['artist'] = Variable<String>(artist.value);
|
|
}
|
|
if (album.present) {
|
|
map['album'] = Variable<String>(album.value);
|
|
}
|
|
if (durationMs.present) {
|
|
map['duration_ms'] = Variable<int>(durationMs.value);
|
|
}
|
|
if (coverPath.present) {
|
|
map['cover_path'] = Variable<String>(coverPath.value);
|
|
}
|
|
if (dateAddedMs.present) {
|
|
map['date_added_ms'] = Variable<int>(dateAddedMs.value);
|
|
}
|
|
if (updatedAtMs.present) {
|
|
map['updated_at_ms'] = Variable<int>(updatedAtMs.value);
|
|
}
|
|
if (deleted.present) {
|
|
map['deleted'] = Variable<bool>(deleted.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('SongsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('path: $path, ')
|
|
..write('title: $title, ')
|
|
..write('artist: $artist, ')
|
|
..write('album: $album, ')
|
|
..write('durationMs: $durationMs, ')
|
|
..write('coverPath: $coverPath, ')
|
|
..write('dateAddedMs: $dateAddedMs, ')
|
|
..write('updatedAtMs: $updatedAtMs, ')
|
|
..write('deleted: $deleted, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $FoldersTable extends Folders with TableInfo<$FoldersTable, Folder> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$FoldersTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<String> id = GeneratedColumn<String>(
|
|
'id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _pathMeta = const VerificationMeta('path');
|
|
@override
|
|
late final GeneratedColumn<String> path = GeneratedColumn<String>(
|
|
'path',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways('UNIQUE'),
|
|
);
|
|
static const VerificationMeta _updatedAtMsMeta = const VerificationMeta(
|
|
'updatedAtMs',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> updatedAtMs = GeneratedColumn<int>(
|
|
'updated_at_ms',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _deletedMeta = const VerificationMeta(
|
|
'deleted',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> deleted = GeneratedColumn<bool>(
|
|
'deleted',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("deleted" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(false),
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [id, path, updatedAtMs, deleted];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'folders';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Folder> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
} else if (isInserting) {
|
|
context.missing(_idMeta);
|
|
}
|
|
if (data.containsKey('path')) {
|
|
context.handle(
|
|
_pathMeta,
|
|
path.isAcceptableOrUnknown(data['path']!, _pathMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_pathMeta);
|
|
}
|
|
if (data.containsKey('updated_at_ms')) {
|
|
context.handle(
|
|
_updatedAtMsMeta,
|
|
updatedAtMs.isAcceptableOrUnknown(
|
|
data['updated_at_ms']!,
|
|
_updatedAtMsMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_updatedAtMsMeta);
|
|
}
|
|
if (data.containsKey('deleted')) {
|
|
context.handle(
|
|
_deletedMeta,
|
|
deleted.isAcceptableOrUnknown(data['deleted']!, _deletedMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
Folder map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Folder(
|
|
id: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}id'],
|
|
)!,
|
|
path: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}path'],
|
|
)!,
|
|
updatedAtMs: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}updated_at_ms'],
|
|
)!,
|
|
deleted: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}deleted'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$FoldersTable createAlias(String alias) {
|
|
return $FoldersTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Folder extends DataClass implements Insertable<Folder> {
|
|
final String id;
|
|
final String path;
|
|
final int updatedAtMs;
|
|
final bool deleted;
|
|
const Folder({
|
|
required this.id,
|
|
required this.path,
|
|
required this.updatedAtMs,
|
|
required this.deleted,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<String>(id);
|
|
map['path'] = Variable<String>(path);
|
|
map['updated_at_ms'] = Variable<int>(updatedAtMs);
|
|
map['deleted'] = Variable<bool>(deleted);
|
|
return map;
|
|
}
|
|
|
|
FoldersCompanion toCompanion(bool nullToAbsent) {
|
|
return FoldersCompanion(
|
|
id: Value(id),
|
|
path: Value(path),
|
|
updatedAtMs: Value(updatedAtMs),
|
|
deleted: Value(deleted),
|
|
);
|
|
}
|
|
|
|
factory Folder.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Folder(
|
|
id: serializer.fromJson<String>(json['id']),
|
|
path: serializer.fromJson<String>(json['path']),
|
|
updatedAtMs: serializer.fromJson<int>(json['updatedAtMs']),
|
|
deleted: serializer.fromJson<bool>(json['deleted']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<String>(id),
|
|
'path': serializer.toJson<String>(path),
|
|
'updatedAtMs': serializer.toJson<int>(updatedAtMs),
|
|
'deleted': serializer.toJson<bool>(deleted),
|
|
};
|
|
}
|
|
|
|
Folder copyWith({
|
|
String? id,
|
|
String? path,
|
|
int? updatedAtMs,
|
|
bool? deleted,
|
|
}) => Folder(
|
|
id: id ?? this.id,
|
|
path: path ?? this.path,
|
|
updatedAtMs: updatedAtMs ?? this.updatedAtMs,
|
|
deleted: deleted ?? this.deleted,
|
|
);
|
|
Folder copyWithCompanion(FoldersCompanion data) {
|
|
return Folder(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
path: data.path.present ? data.path.value : this.path,
|
|
updatedAtMs: data.updatedAtMs.present
|
|
? data.updatedAtMs.value
|
|
: this.updatedAtMs,
|
|
deleted: data.deleted.present ? data.deleted.value : this.deleted,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Folder(')
|
|
..write('id: $id, ')
|
|
..write('path: $path, ')
|
|
..write('updatedAtMs: $updatedAtMs, ')
|
|
..write('deleted: $deleted')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(id, path, updatedAtMs, deleted);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Folder &&
|
|
other.id == this.id &&
|
|
other.path == this.path &&
|
|
other.updatedAtMs == this.updatedAtMs &&
|
|
other.deleted == this.deleted);
|
|
}
|
|
|
|
class FoldersCompanion extends UpdateCompanion<Folder> {
|
|
final Value<String> id;
|
|
final Value<String> path;
|
|
final Value<int> updatedAtMs;
|
|
final Value<bool> deleted;
|
|
final Value<int> rowid;
|
|
const FoldersCompanion({
|
|
this.id = const Value.absent(),
|
|
this.path = const Value.absent(),
|
|
this.updatedAtMs = const Value.absent(),
|
|
this.deleted = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
FoldersCompanion.insert({
|
|
required String id,
|
|
required String path,
|
|
required int updatedAtMs,
|
|
this.deleted = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : id = Value(id),
|
|
path = Value(path),
|
|
updatedAtMs = Value(updatedAtMs);
|
|
static Insertable<Folder> custom({
|
|
Expression<String>? id,
|
|
Expression<String>? path,
|
|
Expression<int>? updatedAtMs,
|
|
Expression<bool>? deleted,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (path != null) 'path': path,
|
|
if (updatedAtMs != null) 'updated_at_ms': updatedAtMs,
|
|
if (deleted != null) 'deleted': deleted,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
FoldersCompanion copyWith({
|
|
Value<String>? id,
|
|
Value<String>? path,
|
|
Value<int>? updatedAtMs,
|
|
Value<bool>? deleted,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return FoldersCompanion(
|
|
id: id ?? this.id,
|
|
path: path ?? this.path,
|
|
updatedAtMs: updatedAtMs ?? this.updatedAtMs,
|
|
deleted: deleted ?? this.deleted,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<String>(id.value);
|
|
}
|
|
if (path.present) {
|
|
map['path'] = Variable<String>(path.value);
|
|
}
|
|
if (updatedAtMs.present) {
|
|
map['updated_at_ms'] = Variable<int>(updatedAtMs.value);
|
|
}
|
|
if (deleted.present) {
|
|
map['deleted'] = Variable<bool>(deleted.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('FoldersCompanion(')
|
|
..write('id: $id, ')
|
|
..write('path: $path, ')
|
|
..write('updatedAtMs: $updatedAtMs, ')
|
|
..write('deleted: $deleted, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $PlaylistsTable extends Playlists
|
|
with TableInfo<$PlaylistsTable, Playlist> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$PlaylistsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _idMeta = const VerificationMeta('id');
|
|
@override
|
|
late final GeneratedColumn<String> id = GeneratedColumn<String>(
|
|
'id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _nameMeta = const VerificationMeta('name');
|
|
@override
|
|
late final GeneratedColumn<String> name = GeneratedColumn<String>(
|
|
'name',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _descriptionMeta = const VerificationMeta(
|
|
'description',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> description = GeneratedColumn<String>(
|
|
'description',
|
|
aliasedName,
|
|
true,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: false,
|
|
);
|
|
static const VerificationMeta _createdAtMsMeta = const VerificationMeta(
|
|
'createdAtMs',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> createdAtMs = GeneratedColumn<int>(
|
|
'created_at_ms',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _updatedAtMsMeta = const VerificationMeta(
|
|
'updatedAtMs',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> updatedAtMs = GeneratedColumn<int>(
|
|
'updated_at_ms',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _deletedMeta = const VerificationMeta(
|
|
'deleted',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<bool> deleted = GeneratedColumn<bool>(
|
|
'deleted',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.bool,
|
|
requiredDuringInsert: false,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'CHECK ("deleted" IN (0, 1))',
|
|
),
|
|
defaultValue: const Constant(false),
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
id,
|
|
name,
|
|
description,
|
|
createdAtMs,
|
|
updatedAtMs,
|
|
deleted,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'playlists';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Playlist> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('id')) {
|
|
context.handle(_idMeta, id.isAcceptableOrUnknown(data['id']!, _idMeta));
|
|
} else if (isInserting) {
|
|
context.missing(_idMeta);
|
|
}
|
|
if (data.containsKey('name')) {
|
|
context.handle(
|
|
_nameMeta,
|
|
name.isAcceptableOrUnknown(data['name']!, _nameMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_nameMeta);
|
|
}
|
|
if (data.containsKey('description')) {
|
|
context.handle(
|
|
_descriptionMeta,
|
|
description.isAcceptableOrUnknown(
|
|
data['description']!,
|
|
_descriptionMeta,
|
|
),
|
|
);
|
|
}
|
|
if (data.containsKey('created_at_ms')) {
|
|
context.handle(
|
|
_createdAtMsMeta,
|
|
createdAtMs.isAcceptableOrUnknown(
|
|
data['created_at_ms']!,
|
|
_createdAtMsMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_createdAtMsMeta);
|
|
}
|
|
if (data.containsKey('updated_at_ms')) {
|
|
context.handle(
|
|
_updatedAtMsMeta,
|
|
updatedAtMs.isAcceptableOrUnknown(
|
|
data['updated_at_ms']!,
|
|
_updatedAtMsMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_updatedAtMsMeta);
|
|
}
|
|
if (data.containsKey('deleted')) {
|
|
context.handle(
|
|
_deletedMeta,
|
|
deleted.isAcceptableOrUnknown(data['deleted']!, _deletedMeta),
|
|
);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {id};
|
|
@override
|
|
Playlist map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Playlist(
|
|
id: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}id'],
|
|
)!,
|
|
name: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}name'],
|
|
)!,
|
|
description: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}description'],
|
|
),
|
|
createdAtMs: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}created_at_ms'],
|
|
)!,
|
|
updatedAtMs: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}updated_at_ms'],
|
|
)!,
|
|
deleted: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.bool,
|
|
data['${effectivePrefix}deleted'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$PlaylistsTable createAlias(String alias) {
|
|
return $PlaylistsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Playlist extends DataClass implements Insertable<Playlist> {
|
|
final String id;
|
|
final String name;
|
|
final String? description;
|
|
final int createdAtMs;
|
|
final int updatedAtMs;
|
|
final bool deleted;
|
|
const Playlist({
|
|
required this.id,
|
|
required this.name,
|
|
this.description,
|
|
required this.createdAtMs,
|
|
required this.updatedAtMs,
|
|
required this.deleted,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['id'] = Variable<String>(id);
|
|
map['name'] = Variable<String>(name);
|
|
if (!nullToAbsent || description != null) {
|
|
map['description'] = Variable<String>(description);
|
|
}
|
|
map['created_at_ms'] = Variable<int>(createdAtMs);
|
|
map['updated_at_ms'] = Variable<int>(updatedAtMs);
|
|
map['deleted'] = Variable<bool>(deleted);
|
|
return map;
|
|
}
|
|
|
|
PlaylistsCompanion toCompanion(bool nullToAbsent) {
|
|
return PlaylistsCompanion(
|
|
id: Value(id),
|
|
name: Value(name),
|
|
description: description == null && nullToAbsent
|
|
? const Value.absent()
|
|
: Value(description),
|
|
createdAtMs: Value(createdAtMs),
|
|
updatedAtMs: Value(updatedAtMs),
|
|
deleted: Value(deleted),
|
|
);
|
|
}
|
|
|
|
factory Playlist.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Playlist(
|
|
id: serializer.fromJson<String>(json['id']),
|
|
name: serializer.fromJson<String>(json['name']),
|
|
description: serializer.fromJson<String?>(json['description']),
|
|
createdAtMs: serializer.fromJson<int>(json['createdAtMs']),
|
|
updatedAtMs: serializer.fromJson<int>(json['updatedAtMs']),
|
|
deleted: serializer.fromJson<bool>(json['deleted']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'id': serializer.toJson<String>(id),
|
|
'name': serializer.toJson<String>(name),
|
|
'description': serializer.toJson<String?>(description),
|
|
'createdAtMs': serializer.toJson<int>(createdAtMs),
|
|
'updatedAtMs': serializer.toJson<int>(updatedAtMs),
|
|
'deleted': serializer.toJson<bool>(deleted),
|
|
};
|
|
}
|
|
|
|
Playlist copyWith({
|
|
String? id,
|
|
String? name,
|
|
Value<String?> description = const Value.absent(),
|
|
int? createdAtMs,
|
|
int? updatedAtMs,
|
|
bool? deleted,
|
|
}) => Playlist(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
description: description.present ? description.value : this.description,
|
|
createdAtMs: createdAtMs ?? this.createdAtMs,
|
|
updatedAtMs: updatedAtMs ?? this.updatedAtMs,
|
|
deleted: deleted ?? this.deleted,
|
|
);
|
|
Playlist copyWithCompanion(PlaylistsCompanion data) {
|
|
return Playlist(
|
|
id: data.id.present ? data.id.value : this.id,
|
|
name: data.name.present ? data.name.value : this.name,
|
|
description: data.description.present
|
|
? data.description.value
|
|
: this.description,
|
|
createdAtMs: data.createdAtMs.present
|
|
? data.createdAtMs.value
|
|
: this.createdAtMs,
|
|
updatedAtMs: data.updatedAtMs.present
|
|
? data.updatedAtMs.value
|
|
: this.updatedAtMs,
|
|
deleted: data.deleted.present ? data.deleted.value : this.deleted,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Playlist(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('description: $description, ')
|
|
..write('createdAtMs: $createdAtMs, ')
|
|
..write('updatedAtMs: $updatedAtMs, ')
|
|
..write('deleted: $deleted')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode =>
|
|
Object.hash(id, name, description, createdAtMs, updatedAtMs, deleted);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Playlist &&
|
|
other.id == this.id &&
|
|
other.name == this.name &&
|
|
other.description == this.description &&
|
|
other.createdAtMs == this.createdAtMs &&
|
|
other.updatedAtMs == this.updatedAtMs &&
|
|
other.deleted == this.deleted);
|
|
}
|
|
|
|
class PlaylistsCompanion extends UpdateCompanion<Playlist> {
|
|
final Value<String> id;
|
|
final Value<String> name;
|
|
final Value<String?> description;
|
|
final Value<int> createdAtMs;
|
|
final Value<int> updatedAtMs;
|
|
final Value<bool> deleted;
|
|
final Value<int> rowid;
|
|
const PlaylistsCompanion({
|
|
this.id = const Value.absent(),
|
|
this.name = const Value.absent(),
|
|
this.description = const Value.absent(),
|
|
this.createdAtMs = const Value.absent(),
|
|
this.updatedAtMs = const Value.absent(),
|
|
this.deleted = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
PlaylistsCompanion.insert({
|
|
required String id,
|
|
required String name,
|
|
this.description = const Value.absent(),
|
|
required int createdAtMs,
|
|
required int updatedAtMs,
|
|
this.deleted = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
}) : id = Value(id),
|
|
name = Value(name),
|
|
createdAtMs = Value(createdAtMs),
|
|
updatedAtMs = Value(updatedAtMs);
|
|
static Insertable<Playlist> custom({
|
|
Expression<String>? id,
|
|
Expression<String>? name,
|
|
Expression<String>? description,
|
|
Expression<int>? createdAtMs,
|
|
Expression<int>? updatedAtMs,
|
|
Expression<bool>? deleted,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (id != null) 'id': id,
|
|
if (name != null) 'name': name,
|
|
if (description != null) 'description': description,
|
|
if (createdAtMs != null) 'created_at_ms': createdAtMs,
|
|
if (updatedAtMs != null) 'updated_at_ms': updatedAtMs,
|
|
if (deleted != null) 'deleted': deleted,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
PlaylistsCompanion copyWith({
|
|
Value<String>? id,
|
|
Value<String>? name,
|
|
Value<String?>? description,
|
|
Value<int>? createdAtMs,
|
|
Value<int>? updatedAtMs,
|
|
Value<bool>? deleted,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return PlaylistsCompanion(
|
|
id: id ?? this.id,
|
|
name: name ?? this.name,
|
|
description: description ?? this.description,
|
|
createdAtMs: createdAtMs ?? this.createdAtMs,
|
|
updatedAtMs: updatedAtMs ?? this.updatedAtMs,
|
|
deleted: deleted ?? this.deleted,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (id.present) {
|
|
map['id'] = Variable<String>(id.value);
|
|
}
|
|
if (name.present) {
|
|
map['name'] = Variable<String>(name.value);
|
|
}
|
|
if (description.present) {
|
|
map['description'] = Variable<String>(description.value);
|
|
}
|
|
if (createdAtMs.present) {
|
|
map['created_at_ms'] = Variable<int>(createdAtMs.value);
|
|
}
|
|
if (updatedAtMs.present) {
|
|
map['updated_at_ms'] = Variable<int>(updatedAtMs.value);
|
|
}
|
|
if (deleted.present) {
|
|
map['deleted'] = Variable<bool>(deleted.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('PlaylistsCompanion(')
|
|
..write('id: $id, ')
|
|
..write('name: $name, ')
|
|
..write('description: $description, ')
|
|
..write('createdAtMs: $createdAtMs, ')
|
|
..write('updatedAtMs: $updatedAtMs, ')
|
|
..write('deleted: $deleted, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $PlaylistSongsTable extends PlaylistSongs
|
|
with TableInfo<$PlaylistSongsTable, PlaylistSong> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$PlaylistSongsTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _playlistIdMeta = const VerificationMeta(
|
|
'playlistId',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<String> playlistId = GeneratedColumn<String>(
|
|
'playlist_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES playlists (id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _songIdMeta = const VerificationMeta('songId');
|
|
@override
|
|
late final GeneratedColumn<String> songId = GeneratedColumn<String>(
|
|
'song_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES songs (id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _positionMeta = const VerificationMeta(
|
|
'position',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> position = GeneratedColumn<int>(
|
|
'position',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _addedAtMsMeta = const VerificationMeta(
|
|
'addedAtMs',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> addedAtMs = GeneratedColumn<int>(
|
|
'added_at_ms',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [
|
|
playlistId,
|
|
songId,
|
|
position,
|
|
addedAtMs,
|
|
];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'playlist_songs';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<PlaylistSong> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('playlist_id')) {
|
|
context.handle(
|
|
_playlistIdMeta,
|
|
playlistId.isAcceptableOrUnknown(data['playlist_id']!, _playlistIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_playlistIdMeta);
|
|
}
|
|
if (data.containsKey('song_id')) {
|
|
context.handle(
|
|
_songIdMeta,
|
|
songId.isAcceptableOrUnknown(data['song_id']!, _songIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_songIdMeta);
|
|
}
|
|
if (data.containsKey('position')) {
|
|
context.handle(
|
|
_positionMeta,
|
|
position.isAcceptableOrUnknown(data['position']!, _positionMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_positionMeta);
|
|
}
|
|
if (data.containsKey('added_at_ms')) {
|
|
context.handle(
|
|
_addedAtMsMeta,
|
|
addedAtMs.isAcceptableOrUnknown(data['added_at_ms']!, _addedAtMsMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_addedAtMsMeta);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {playlistId, songId};
|
|
@override
|
|
PlaylistSong map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return PlaylistSong(
|
|
playlistId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}playlist_id'],
|
|
)!,
|
|
songId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}song_id'],
|
|
)!,
|
|
position: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}position'],
|
|
)!,
|
|
addedAtMs: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}added_at_ms'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$PlaylistSongsTable createAlias(String alias) {
|
|
return $PlaylistSongsTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class PlaylistSong extends DataClass implements Insertable<PlaylistSong> {
|
|
final String playlistId;
|
|
final String songId;
|
|
final int position;
|
|
final int addedAtMs;
|
|
const PlaylistSong({
|
|
required this.playlistId,
|
|
required this.songId,
|
|
required this.position,
|
|
required this.addedAtMs,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['playlist_id'] = Variable<String>(playlistId);
|
|
map['song_id'] = Variable<String>(songId);
|
|
map['position'] = Variable<int>(position);
|
|
map['added_at_ms'] = Variable<int>(addedAtMs);
|
|
return map;
|
|
}
|
|
|
|
PlaylistSongsCompanion toCompanion(bool nullToAbsent) {
|
|
return PlaylistSongsCompanion(
|
|
playlistId: Value(playlistId),
|
|
songId: Value(songId),
|
|
position: Value(position),
|
|
addedAtMs: Value(addedAtMs),
|
|
);
|
|
}
|
|
|
|
factory PlaylistSong.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return PlaylistSong(
|
|
playlistId: serializer.fromJson<String>(json['playlistId']),
|
|
songId: serializer.fromJson<String>(json['songId']),
|
|
position: serializer.fromJson<int>(json['position']),
|
|
addedAtMs: serializer.fromJson<int>(json['addedAtMs']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'playlistId': serializer.toJson<String>(playlistId),
|
|
'songId': serializer.toJson<String>(songId),
|
|
'position': serializer.toJson<int>(position),
|
|
'addedAtMs': serializer.toJson<int>(addedAtMs),
|
|
};
|
|
}
|
|
|
|
PlaylistSong copyWith({
|
|
String? playlistId,
|
|
String? songId,
|
|
int? position,
|
|
int? addedAtMs,
|
|
}) => PlaylistSong(
|
|
playlistId: playlistId ?? this.playlistId,
|
|
songId: songId ?? this.songId,
|
|
position: position ?? this.position,
|
|
addedAtMs: addedAtMs ?? this.addedAtMs,
|
|
);
|
|
PlaylistSong copyWithCompanion(PlaylistSongsCompanion data) {
|
|
return PlaylistSong(
|
|
playlistId: data.playlistId.present
|
|
? data.playlistId.value
|
|
: this.playlistId,
|
|
songId: data.songId.present ? data.songId.value : this.songId,
|
|
position: data.position.present ? data.position.value : this.position,
|
|
addedAtMs: data.addedAtMs.present ? data.addedAtMs.value : this.addedAtMs,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('PlaylistSong(')
|
|
..write('playlistId: $playlistId, ')
|
|
..write('songId: $songId, ')
|
|
..write('position: $position, ')
|
|
..write('addedAtMs: $addedAtMs')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(playlistId, songId, position, addedAtMs);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is PlaylistSong &&
|
|
other.playlistId == this.playlistId &&
|
|
other.songId == this.songId &&
|
|
other.position == this.position &&
|
|
other.addedAtMs == this.addedAtMs);
|
|
}
|
|
|
|
class PlaylistSongsCompanion extends UpdateCompanion<PlaylistSong> {
|
|
final Value<String> playlistId;
|
|
final Value<String> songId;
|
|
final Value<int> position;
|
|
final Value<int> addedAtMs;
|
|
final Value<int> rowid;
|
|
const PlaylistSongsCompanion({
|
|
this.playlistId = const Value.absent(),
|
|
this.songId = const Value.absent(),
|
|
this.position = const Value.absent(),
|
|
this.addedAtMs = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
PlaylistSongsCompanion.insert({
|
|
required String playlistId,
|
|
required String songId,
|
|
required int position,
|
|
required int addedAtMs,
|
|
this.rowid = const Value.absent(),
|
|
}) : playlistId = Value(playlistId),
|
|
songId = Value(songId),
|
|
position = Value(position),
|
|
addedAtMs = Value(addedAtMs);
|
|
static Insertable<PlaylistSong> custom({
|
|
Expression<String>? playlistId,
|
|
Expression<String>? songId,
|
|
Expression<int>? position,
|
|
Expression<int>? addedAtMs,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (playlistId != null) 'playlist_id': playlistId,
|
|
if (songId != null) 'song_id': songId,
|
|
if (position != null) 'position': position,
|
|
if (addedAtMs != null) 'added_at_ms': addedAtMs,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
PlaylistSongsCompanion copyWith({
|
|
Value<String>? playlistId,
|
|
Value<String>? songId,
|
|
Value<int>? position,
|
|
Value<int>? addedAtMs,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return PlaylistSongsCompanion(
|
|
playlistId: playlistId ?? this.playlistId,
|
|
songId: songId ?? this.songId,
|
|
position: position ?? this.position,
|
|
addedAtMs: addedAtMs ?? this.addedAtMs,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (playlistId.present) {
|
|
map['playlist_id'] = Variable<String>(playlistId.value);
|
|
}
|
|
if (songId.present) {
|
|
map['song_id'] = Variable<String>(songId.value);
|
|
}
|
|
if (position.present) {
|
|
map['position'] = Variable<int>(position.value);
|
|
}
|
|
if (addedAtMs.present) {
|
|
map['added_at_ms'] = Variable<int>(addedAtMs.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('PlaylistSongsCompanion(')
|
|
..write('playlistId: $playlistId, ')
|
|
..write('songId: $songId, ')
|
|
..write('position: $position, ')
|
|
..write('addedAtMs: $addedAtMs, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $FavoritesTable extends Favorites
|
|
with TableInfo<$FavoritesTable, Favorite> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$FavoritesTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _songIdMeta = const VerificationMeta('songId');
|
|
@override
|
|
late final GeneratedColumn<String> songId = GeneratedColumn<String>(
|
|
'song_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES songs (id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _createdAtMsMeta = const VerificationMeta(
|
|
'createdAtMs',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> createdAtMs = GeneratedColumn<int>(
|
|
'created_at_ms',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [songId, createdAtMs];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'favorites';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<Favorite> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('song_id')) {
|
|
context.handle(
|
|
_songIdMeta,
|
|
songId.isAcceptableOrUnknown(data['song_id']!, _songIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_songIdMeta);
|
|
}
|
|
if (data.containsKey('created_at_ms')) {
|
|
context.handle(
|
|
_createdAtMsMeta,
|
|
createdAtMs.isAcceptableOrUnknown(
|
|
data['created_at_ms']!,
|
|
_createdAtMsMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_createdAtMsMeta);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {songId};
|
|
@override
|
|
Favorite map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return Favorite(
|
|
songId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}song_id'],
|
|
)!,
|
|
createdAtMs: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}created_at_ms'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$FavoritesTable createAlias(String alias) {
|
|
return $FavoritesTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class Favorite extends DataClass implements Insertable<Favorite> {
|
|
final String songId;
|
|
final int createdAtMs;
|
|
const Favorite({required this.songId, required this.createdAtMs});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['song_id'] = Variable<String>(songId);
|
|
map['created_at_ms'] = Variable<int>(createdAtMs);
|
|
return map;
|
|
}
|
|
|
|
FavoritesCompanion toCompanion(bool nullToAbsent) {
|
|
return FavoritesCompanion(
|
|
songId: Value(songId),
|
|
createdAtMs: Value(createdAtMs),
|
|
);
|
|
}
|
|
|
|
factory Favorite.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return Favorite(
|
|
songId: serializer.fromJson<String>(json['songId']),
|
|
createdAtMs: serializer.fromJson<int>(json['createdAtMs']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'songId': serializer.toJson<String>(songId),
|
|
'createdAtMs': serializer.toJson<int>(createdAtMs),
|
|
};
|
|
}
|
|
|
|
Favorite copyWith({String? songId, int? createdAtMs}) => Favorite(
|
|
songId: songId ?? this.songId,
|
|
createdAtMs: createdAtMs ?? this.createdAtMs,
|
|
);
|
|
Favorite copyWithCompanion(FavoritesCompanion data) {
|
|
return Favorite(
|
|
songId: data.songId.present ? data.songId.value : this.songId,
|
|
createdAtMs: data.createdAtMs.present
|
|
? data.createdAtMs.value
|
|
: this.createdAtMs,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('Favorite(')
|
|
..write('songId: $songId, ')
|
|
..write('createdAtMs: $createdAtMs')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(songId, createdAtMs);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is Favorite &&
|
|
other.songId == this.songId &&
|
|
other.createdAtMs == this.createdAtMs);
|
|
}
|
|
|
|
class FavoritesCompanion extends UpdateCompanion<Favorite> {
|
|
final Value<String> songId;
|
|
final Value<int> createdAtMs;
|
|
final Value<int> rowid;
|
|
const FavoritesCompanion({
|
|
this.songId = const Value.absent(),
|
|
this.createdAtMs = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
FavoritesCompanion.insert({
|
|
required String songId,
|
|
required int createdAtMs,
|
|
this.rowid = const Value.absent(),
|
|
}) : songId = Value(songId),
|
|
createdAtMs = Value(createdAtMs);
|
|
static Insertable<Favorite> custom({
|
|
Expression<String>? songId,
|
|
Expression<int>? createdAtMs,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (songId != null) 'song_id': songId,
|
|
if (createdAtMs != null) 'created_at_ms': createdAtMs,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
FavoritesCompanion copyWith({
|
|
Value<String>? songId,
|
|
Value<int>? createdAtMs,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return FavoritesCompanion(
|
|
songId: songId ?? this.songId,
|
|
createdAtMs: createdAtMs ?? this.createdAtMs,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (songId.present) {
|
|
map['song_id'] = Variable<String>(songId.value);
|
|
}
|
|
if (createdAtMs.present) {
|
|
map['created_at_ms'] = Variable<int>(createdAtMs.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('FavoritesCompanion(')
|
|
..write('songId: $songId, ')
|
|
..write('createdAtMs: $createdAtMs, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
class $PlaybackHistoryTable extends PlaybackHistory
|
|
with TableInfo<$PlaybackHistoryTable, PlaybackHistoryData> {
|
|
@override
|
|
final GeneratedDatabase attachedDatabase;
|
|
final String? _alias;
|
|
$PlaybackHistoryTable(this.attachedDatabase, [this._alias]);
|
|
static const VerificationMeta _songIdMeta = const VerificationMeta('songId');
|
|
@override
|
|
late final GeneratedColumn<String> songId = GeneratedColumn<String>(
|
|
'song_id',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.string,
|
|
requiredDuringInsert: true,
|
|
defaultConstraints: GeneratedColumn.constraintIsAlways(
|
|
'REFERENCES songs (id)',
|
|
),
|
|
);
|
|
static const VerificationMeta _positionMsMeta = const VerificationMeta(
|
|
'positionMs',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> positionMs = GeneratedColumn<int>(
|
|
'position_ms',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
);
|
|
static const VerificationMeta _playedAtMsMeta = const VerificationMeta(
|
|
'playedAtMs',
|
|
);
|
|
@override
|
|
late final GeneratedColumn<int> playedAtMs = GeneratedColumn<int>(
|
|
'played_at_ms',
|
|
aliasedName,
|
|
false,
|
|
type: DriftSqlType.int,
|
|
requiredDuringInsert: true,
|
|
);
|
|
@override
|
|
List<GeneratedColumn> get $columns => [songId, positionMs, playedAtMs];
|
|
@override
|
|
String get aliasedName => _alias ?? actualTableName;
|
|
@override
|
|
String get actualTableName => $name;
|
|
static const String $name = 'playback_history';
|
|
@override
|
|
VerificationContext validateIntegrity(
|
|
Insertable<PlaybackHistoryData> instance, {
|
|
bool isInserting = false,
|
|
}) {
|
|
final context = VerificationContext();
|
|
final data = instance.toColumns(true);
|
|
if (data.containsKey('song_id')) {
|
|
context.handle(
|
|
_songIdMeta,
|
|
songId.isAcceptableOrUnknown(data['song_id']!, _songIdMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_songIdMeta);
|
|
}
|
|
if (data.containsKey('position_ms')) {
|
|
context.handle(
|
|
_positionMsMeta,
|
|
positionMs.isAcceptableOrUnknown(data['position_ms']!, _positionMsMeta),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_positionMsMeta);
|
|
}
|
|
if (data.containsKey('played_at_ms')) {
|
|
context.handle(
|
|
_playedAtMsMeta,
|
|
playedAtMs.isAcceptableOrUnknown(
|
|
data['played_at_ms']!,
|
|
_playedAtMsMeta,
|
|
),
|
|
);
|
|
} else if (isInserting) {
|
|
context.missing(_playedAtMsMeta);
|
|
}
|
|
return context;
|
|
}
|
|
|
|
@override
|
|
Set<GeneratedColumn> get $primaryKey => {songId, playedAtMs};
|
|
@override
|
|
PlaybackHistoryData map(Map<String, dynamic> data, {String? tablePrefix}) {
|
|
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
|
|
return PlaybackHistoryData(
|
|
songId: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.string,
|
|
data['${effectivePrefix}song_id'],
|
|
)!,
|
|
positionMs: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}position_ms'],
|
|
)!,
|
|
playedAtMs: attachedDatabase.typeMapping.read(
|
|
DriftSqlType.int,
|
|
data['${effectivePrefix}played_at_ms'],
|
|
)!,
|
|
);
|
|
}
|
|
|
|
@override
|
|
$PlaybackHistoryTable createAlias(String alias) {
|
|
return $PlaybackHistoryTable(attachedDatabase, alias);
|
|
}
|
|
}
|
|
|
|
class PlaybackHistoryData extends DataClass
|
|
implements Insertable<PlaybackHistoryData> {
|
|
final String songId;
|
|
final int positionMs;
|
|
final int playedAtMs;
|
|
const PlaybackHistoryData({
|
|
required this.songId,
|
|
required this.positionMs,
|
|
required this.playedAtMs,
|
|
});
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
map['song_id'] = Variable<String>(songId);
|
|
map['position_ms'] = Variable<int>(positionMs);
|
|
map['played_at_ms'] = Variable<int>(playedAtMs);
|
|
return map;
|
|
}
|
|
|
|
PlaybackHistoryCompanion toCompanion(bool nullToAbsent) {
|
|
return PlaybackHistoryCompanion(
|
|
songId: Value(songId),
|
|
positionMs: Value(positionMs),
|
|
playedAtMs: Value(playedAtMs),
|
|
);
|
|
}
|
|
|
|
factory PlaybackHistoryData.fromJson(
|
|
Map<String, dynamic> json, {
|
|
ValueSerializer? serializer,
|
|
}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return PlaybackHistoryData(
|
|
songId: serializer.fromJson<String>(json['songId']),
|
|
positionMs: serializer.fromJson<int>(json['positionMs']),
|
|
playedAtMs: serializer.fromJson<int>(json['playedAtMs']),
|
|
);
|
|
}
|
|
@override
|
|
Map<String, dynamic> toJson({ValueSerializer? serializer}) {
|
|
serializer ??= driftRuntimeOptions.defaultSerializer;
|
|
return <String, dynamic>{
|
|
'songId': serializer.toJson<String>(songId),
|
|
'positionMs': serializer.toJson<int>(positionMs),
|
|
'playedAtMs': serializer.toJson<int>(playedAtMs),
|
|
};
|
|
}
|
|
|
|
PlaybackHistoryData copyWith({
|
|
String? songId,
|
|
int? positionMs,
|
|
int? playedAtMs,
|
|
}) => PlaybackHistoryData(
|
|
songId: songId ?? this.songId,
|
|
positionMs: positionMs ?? this.positionMs,
|
|
playedAtMs: playedAtMs ?? this.playedAtMs,
|
|
);
|
|
PlaybackHistoryData copyWithCompanion(PlaybackHistoryCompanion data) {
|
|
return PlaybackHistoryData(
|
|
songId: data.songId.present ? data.songId.value : this.songId,
|
|
positionMs: data.positionMs.present
|
|
? data.positionMs.value
|
|
: this.positionMs,
|
|
playedAtMs: data.playedAtMs.present
|
|
? data.playedAtMs.value
|
|
: this.playedAtMs,
|
|
);
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('PlaybackHistoryData(')
|
|
..write('songId: $songId, ')
|
|
..write('positionMs: $positionMs, ')
|
|
..write('playedAtMs: $playedAtMs')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
|
|
@override
|
|
int get hashCode => Object.hash(songId, positionMs, playedAtMs);
|
|
@override
|
|
bool operator ==(Object other) =>
|
|
identical(this, other) ||
|
|
(other is PlaybackHistoryData &&
|
|
other.songId == this.songId &&
|
|
other.positionMs == this.positionMs &&
|
|
other.playedAtMs == this.playedAtMs);
|
|
}
|
|
|
|
class PlaybackHistoryCompanion extends UpdateCompanion<PlaybackHistoryData> {
|
|
final Value<String> songId;
|
|
final Value<int> positionMs;
|
|
final Value<int> playedAtMs;
|
|
final Value<int> rowid;
|
|
const PlaybackHistoryCompanion({
|
|
this.songId = const Value.absent(),
|
|
this.positionMs = const Value.absent(),
|
|
this.playedAtMs = const Value.absent(),
|
|
this.rowid = const Value.absent(),
|
|
});
|
|
PlaybackHistoryCompanion.insert({
|
|
required String songId,
|
|
required int positionMs,
|
|
required int playedAtMs,
|
|
this.rowid = const Value.absent(),
|
|
}) : songId = Value(songId),
|
|
positionMs = Value(positionMs),
|
|
playedAtMs = Value(playedAtMs);
|
|
static Insertable<PlaybackHistoryData> custom({
|
|
Expression<String>? songId,
|
|
Expression<int>? positionMs,
|
|
Expression<int>? playedAtMs,
|
|
Expression<int>? rowid,
|
|
}) {
|
|
return RawValuesInsertable({
|
|
if (songId != null) 'song_id': songId,
|
|
if (positionMs != null) 'position_ms': positionMs,
|
|
if (playedAtMs != null) 'played_at_ms': playedAtMs,
|
|
if (rowid != null) 'rowid': rowid,
|
|
});
|
|
}
|
|
|
|
PlaybackHistoryCompanion copyWith({
|
|
Value<String>? songId,
|
|
Value<int>? positionMs,
|
|
Value<int>? playedAtMs,
|
|
Value<int>? rowid,
|
|
}) {
|
|
return PlaybackHistoryCompanion(
|
|
songId: songId ?? this.songId,
|
|
positionMs: positionMs ?? this.positionMs,
|
|
playedAtMs: playedAtMs ?? this.playedAtMs,
|
|
rowid: rowid ?? this.rowid,
|
|
);
|
|
}
|
|
|
|
@override
|
|
Map<String, Expression> toColumns(bool nullToAbsent) {
|
|
final map = <String, Expression>{};
|
|
if (songId.present) {
|
|
map['song_id'] = Variable<String>(songId.value);
|
|
}
|
|
if (positionMs.present) {
|
|
map['position_ms'] = Variable<int>(positionMs.value);
|
|
}
|
|
if (playedAtMs.present) {
|
|
map['played_at_ms'] = Variable<int>(playedAtMs.value);
|
|
}
|
|
if (rowid.present) {
|
|
map['rowid'] = Variable<int>(rowid.value);
|
|
}
|
|
return map;
|
|
}
|
|
|
|
@override
|
|
String toString() {
|
|
return (StringBuffer('PlaybackHistoryCompanion(')
|
|
..write('songId: $songId, ')
|
|
..write('positionMs: $positionMs, ')
|
|
..write('playedAtMs: $playedAtMs, ')
|
|
..write('rowid: $rowid')
|
|
..write(')'))
|
|
.toString();
|
|
}
|
|
}
|
|
|
|
abstract class _$MeloDb extends GeneratedDatabase {
|
|
_$MeloDb(QueryExecutor e) : super(e);
|
|
$MeloDbManager get managers => $MeloDbManager(this);
|
|
late final $SongsTable songs = $SongsTable(this);
|
|
late final $FoldersTable folders = $FoldersTable(this);
|
|
late final $PlaylistsTable playlists = $PlaylistsTable(this);
|
|
late final $PlaylistSongsTable playlistSongs = $PlaylistSongsTable(this);
|
|
late final $FavoritesTable favorites = $FavoritesTable(this);
|
|
late final $PlaybackHistoryTable playbackHistory = $PlaybackHistoryTable(
|
|
this,
|
|
);
|
|
@override
|
|
Iterable<TableInfo<Table, Object?>> get allTables =>
|
|
allSchemaEntities.whereType<TableInfo<Table, Object?>>();
|
|
@override
|
|
List<DatabaseSchemaEntity> get allSchemaEntities => [
|
|
songs,
|
|
folders,
|
|
playlists,
|
|
playlistSongs,
|
|
favorites,
|
|
playbackHistory,
|
|
];
|
|
}
|
|
|
|
typedef $$SongsTableCreateCompanionBuilder =
|
|
SongsCompanion Function({
|
|
required String id,
|
|
required String path,
|
|
required String title,
|
|
Value<String?> artist,
|
|
Value<String?> album,
|
|
Value<int?> durationMs,
|
|
Value<String?> coverPath,
|
|
required int dateAddedMs,
|
|
required int updatedAtMs,
|
|
Value<bool> deleted,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$SongsTableUpdateCompanionBuilder =
|
|
SongsCompanion Function({
|
|
Value<String> id,
|
|
Value<String> path,
|
|
Value<String> title,
|
|
Value<String?> artist,
|
|
Value<String?> album,
|
|
Value<int?> durationMs,
|
|
Value<String?> coverPath,
|
|
Value<int> dateAddedMs,
|
|
Value<int> updatedAtMs,
|
|
Value<bool> deleted,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$SongsTableReferences
|
|
extends BaseReferences<_$MeloDb, $SongsTable, Song> {
|
|
$$SongsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static MultiTypedResultKey<$PlaylistSongsTable, List<PlaylistSong>>
|
|
_playlistSongsRefsTable(_$MeloDb db) => MultiTypedResultKey.fromTable(
|
|
db.playlistSongs,
|
|
aliasName: 'songs__id__playlist_songs__song_id',
|
|
);
|
|
|
|
$$PlaylistSongsTableProcessedTableManager get playlistSongsRefs {
|
|
final manager = $$PlaylistSongsTableTableManager(
|
|
$_db,
|
|
$_db.playlistSongs,
|
|
).filter((f) => f.songId.id.sqlEquals($_itemColumn<String>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_playlistSongsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$FavoritesTable, List<Favorite>>
|
|
_favoritesRefsTable(_$MeloDb db) => MultiTypedResultKey.fromTable(
|
|
db.favorites,
|
|
aliasName: 'songs__id__favorites__song_id',
|
|
);
|
|
|
|
$$FavoritesTableProcessedTableManager get favoritesRefs {
|
|
final manager = $$FavoritesTableTableManager(
|
|
$_db,
|
|
$_db.favorites,
|
|
).filter((f) => f.songId.id.sqlEquals($_itemColumn<String>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_favoritesRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
|
|
static MultiTypedResultKey<$PlaybackHistoryTable, List<PlaybackHistoryData>>
|
|
_playbackHistoryRefsTable(_$MeloDb db) => MultiTypedResultKey.fromTable(
|
|
db.playbackHistory,
|
|
aliasName: 'songs__id__playback_history__song_id',
|
|
);
|
|
|
|
$$PlaybackHistoryTableProcessedTableManager get playbackHistoryRefs {
|
|
final manager = $$PlaybackHistoryTableTableManager(
|
|
$_db,
|
|
$_db.playbackHistory,
|
|
).filter((f) => f.songId.id.sqlEquals($_itemColumn<String>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(
|
|
_playbackHistoryRefsTable($_db),
|
|
);
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$SongsTableFilterComposer extends Composer<_$MeloDb, $SongsTable> {
|
|
$$SongsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get path => $composableBuilder(
|
|
column: $table.path,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get title => $composableBuilder(
|
|
column: $table.title,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get artist => $composableBuilder(
|
|
column: $table.artist,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get album => $composableBuilder(
|
|
column: $table.album,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get durationMs => $composableBuilder(
|
|
column: $table.durationMs,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get coverPath => $composableBuilder(
|
|
column: $table.coverPath,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get dateAddedMs => $composableBuilder(
|
|
column: $table.dateAddedMs,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get updatedAtMs => $composableBuilder(
|
|
column: $table.updatedAtMs,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get deleted => $composableBuilder(
|
|
column: $table.deleted,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
Expression<bool> playlistSongsRefs(
|
|
Expression<bool> Function($$PlaylistSongsTableFilterComposer f) f,
|
|
) {
|
|
final $$PlaylistSongsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.id,
|
|
referencedTable: $db.playlistSongs,
|
|
getReferencedColumn: (t) => t.songId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PlaylistSongsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.playlistSongs,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> favoritesRefs(
|
|
Expression<bool> Function($$FavoritesTableFilterComposer f) f,
|
|
) {
|
|
final $$FavoritesTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.id,
|
|
referencedTable: $db.favorites,
|
|
getReferencedColumn: (t) => t.songId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$FavoritesTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.favorites,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<bool> playbackHistoryRefs(
|
|
Expression<bool> Function($$PlaybackHistoryTableFilterComposer f) f,
|
|
) {
|
|
final $$PlaybackHistoryTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.id,
|
|
referencedTable: $db.playbackHistory,
|
|
getReferencedColumn: (t) => t.songId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PlaybackHistoryTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.playbackHistory,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$SongsTableOrderingComposer extends Composer<_$MeloDb, $SongsTable> {
|
|
$$SongsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get path => $composableBuilder(
|
|
column: $table.path,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get title => $composableBuilder(
|
|
column: $table.title,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get artist => $composableBuilder(
|
|
column: $table.artist,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get album => $composableBuilder(
|
|
column: $table.album,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get durationMs => $composableBuilder(
|
|
column: $table.durationMs,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get coverPath => $composableBuilder(
|
|
column: $table.coverPath,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get dateAddedMs => $composableBuilder(
|
|
column: $table.dateAddedMs,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get updatedAtMs => $composableBuilder(
|
|
column: $table.updatedAtMs,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get deleted => $composableBuilder(
|
|
column: $table.deleted,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$SongsTableAnnotationComposer extends Composer<_$MeloDb, $SongsTable> {
|
|
$$SongsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get path =>
|
|
$composableBuilder(column: $table.path, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get title =>
|
|
$composableBuilder(column: $table.title, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get artist =>
|
|
$composableBuilder(column: $table.artist, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get album =>
|
|
$composableBuilder(column: $table.album, builder: (column) => column);
|
|
|
|
GeneratedColumn<int> get durationMs => $composableBuilder(
|
|
column: $table.durationMs,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<String> get coverPath =>
|
|
$composableBuilder(column: $table.coverPath, builder: (column) => column);
|
|
|
|
GeneratedColumn<int> get dateAddedMs => $composableBuilder(
|
|
column: $table.dateAddedMs,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<int> get updatedAtMs => $composableBuilder(
|
|
column: $table.updatedAtMs,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get deleted =>
|
|
$composableBuilder(column: $table.deleted, builder: (column) => column);
|
|
|
|
Expression<T> playlistSongsRefs<T extends Object>(
|
|
Expression<T> Function($$PlaylistSongsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$PlaylistSongsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.id,
|
|
referencedTable: $db.playlistSongs,
|
|
getReferencedColumn: (t) => t.songId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PlaylistSongsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.playlistSongs,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> favoritesRefs<T extends Object>(
|
|
Expression<T> Function($$FavoritesTableAnnotationComposer a) f,
|
|
) {
|
|
final $$FavoritesTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.id,
|
|
referencedTable: $db.favorites,
|
|
getReferencedColumn: (t) => t.songId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$FavoritesTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.favorites,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
|
|
Expression<T> playbackHistoryRefs<T extends Object>(
|
|
Expression<T> Function($$PlaybackHistoryTableAnnotationComposer a) f,
|
|
) {
|
|
final $$PlaybackHistoryTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.id,
|
|
referencedTable: $db.playbackHistory,
|
|
getReferencedColumn: (t) => t.songId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PlaybackHistoryTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.playbackHistory,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$SongsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$MeloDb,
|
|
$SongsTable,
|
|
Song,
|
|
$$SongsTableFilterComposer,
|
|
$$SongsTableOrderingComposer,
|
|
$$SongsTableAnnotationComposer,
|
|
$$SongsTableCreateCompanionBuilder,
|
|
$$SongsTableUpdateCompanionBuilder,
|
|
(Song, $$SongsTableReferences),
|
|
Song,
|
|
PrefetchHooks Function({
|
|
bool playlistSongsRefs,
|
|
bool favoritesRefs,
|
|
bool playbackHistoryRefs,
|
|
})
|
|
> {
|
|
$$SongsTableTableManager(_$MeloDb db, $SongsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$SongsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$SongsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$SongsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> id = const Value.absent(),
|
|
Value<String> path = const Value.absent(),
|
|
Value<String> title = const Value.absent(),
|
|
Value<String?> artist = const Value.absent(),
|
|
Value<String?> album = const Value.absent(),
|
|
Value<int?> durationMs = const Value.absent(),
|
|
Value<String?> coverPath = const Value.absent(),
|
|
Value<int> dateAddedMs = const Value.absent(),
|
|
Value<int> updatedAtMs = const Value.absent(),
|
|
Value<bool> deleted = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => SongsCompanion(
|
|
id: id,
|
|
path: path,
|
|
title: title,
|
|
artist: artist,
|
|
album: album,
|
|
durationMs: durationMs,
|
|
coverPath: coverPath,
|
|
dateAddedMs: dateAddedMs,
|
|
updatedAtMs: updatedAtMs,
|
|
deleted: deleted,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
required String id,
|
|
required String path,
|
|
required String title,
|
|
Value<String?> artist = const Value.absent(),
|
|
Value<String?> album = const Value.absent(),
|
|
Value<int?> durationMs = const Value.absent(),
|
|
Value<String?> coverPath = const Value.absent(),
|
|
required int dateAddedMs,
|
|
required int updatedAtMs,
|
|
Value<bool> deleted = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => SongsCompanion.insert(
|
|
id: id,
|
|
path: path,
|
|
title: title,
|
|
artist: artist,
|
|
album: album,
|
|
durationMs: durationMs,
|
|
coverPath: coverPath,
|
|
dateAddedMs: dateAddedMs,
|
|
updatedAtMs: updatedAtMs,
|
|
deleted: deleted,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) =>
|
|
(e.readTable(table), $$SongsTableReferences(db, table, e)),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback:
|
|
({
|
|
playlistSongsRefs = false,
|
|
favoritesRefs = false,
|
|
playbackHistoryRefs = false,
|
|
}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [
|
|
if (playlistSongsRefs) db.playlistSongs,
|
|
if (favoritesRefs) db.favorites,
|
|
if (playbackHistoryRefs) db.playbackHistory,
|
|
],
|
|
addJoins: null,
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (playlistSongsRefs)
|
|
await $_getPrefetchedData<
|
|
Song,
|
|
$SongsTable,
|
|
PlaylistSong
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$SongsTableReferences
|
|
._playlistSongsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$SongsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).playlistSongsRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.songId == item.id,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (favoritesRefs)
|
|
await $_getPrefetchedData<Song, $SongsTable, Favorite>(
|
|
currentTable: table,
|
|
referencedTable: $$SongsTableReferences
|
|
._favoritesRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$SongsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).favoritesRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.songId == item.id,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
if (playbackHistoryRefs)
|
|
await $_getPrefetchedData<
|
|
Song,
|
|
$SongsTable,
|
|
PlaybackHistoryData
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$SongsTableReferences
|
|
._playbackHistoryRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$SongsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).playbackHistoryRefs,
|
|
referencedItemsForCurrentItem:
|
|
(item, referencedItems) => referencedItems.where(
|
|
(e) => e.songId == item.id,
|
|
),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$SongsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$MeloDb,
|
|
$SongsTable,
|
|
Song,
|
|
$$SongsTableFilterComposer,
|
|
$$SongsTableOrderingComposer,
|
|
$$SongsTableAnnotationComposer,
|
|
$$SongsTableCreateCompanionBuilder,
|
|
$$SongsTableUpdateCompanionBuilder,
|
|
(Song, $$SongsTableReferences),
|
|
Song,
|
|
PrefetchHooks Function({
|
|
bool playlistSongsRefs,
|
|
bool favoritesRefs,
|
|
bool playbackHistoryRefs,
|
|
})
|
|
>;
|
|
typedef $$FoldersTableCreateCompanionBuilder =
|
|
FoldersCompanion Function({
|
|
required String id,
|
|
required String path,
|
|
required int updatedAtMs,
|
|
Value<bool> deleted,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$FoldersTableUpdateCompanionBuilder =
|
|
FoldersCompanion Function({
|
|
Value<String> id,
|
|
Value<String> path,
|
|
Value<int> updatedAtMs,
|
|
Value<bool> deleted,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
class $$FoldersTableFilterComposer extends Composer<_$MeloDb, $FoldersTable> {
|
|
$$FoldersTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get path => $composableBuilder(
|
|
column: $table.path,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get updatedAtMs => $composableBuilder(
|
|
column: $table.updatedAtMs,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get deleted => $composableBuilder(
|
|
column: $table.deleted,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
}
|
|
|
|
class $$FoldersTableOrderingComposer extends Composer<_$MeloDb, $FoldersTable> {
|
|
$$FoldersTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get path => $composableBuilder(
|
|
column: $table.path,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get updatedAtMs => $composableBuilder(
|
|
column: $table.updatedAtMs,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get deleted => $composableBuilder(
|
|
column: $table.deleted,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$FoldersTableAnnotationComposer
|
|
extends Composer<_$MeloDb, $FoldersTable> {
|
|
$$FoldersTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get path =>
|
|
$composableBuilder(column: $table.path, builder: (column) => column);
|
|
|
|
GeneratedColumn<int> get updatedAtMs => $composableBuilder(
|
|
column: $table.updatedAtMs,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get deleted =>
|
|
$composableBuilder(column: $table.deleted, builder: (column) => column);
|
|
}
|
|
|
|
class $$FoldersTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$MeloDb,
|
|
$FoldersTable,
|
|
Folder,
|
|
$$FoldersTableFilterComposer,
|
|
$$FoldersTableOrderingComposer,
|
|
$$FoldersTableAnnotationComposer,
|
|
$$FoldersTableCreateCompanionBuilder,
|
|
$$FoldersTableUpdateCompanionBuilder,
|
|
(Folder, BaseReferences<_$MeloDb, $FoldersTable, Folder>),
|
|
Folder,
|
|
PrefetchHooks Function()
|
|
> {
|
|
$$FoldersTableTableManager(_$MeloDb db, $FoldersTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$FoldersTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$FoldersTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$FoldersTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> id = const Value.absent(),
|
|
Value<String> path = const Value.absent(),
|
|
Value<int> updatedAtMs = const Value.absent(),
|
|
Value<bool> deleted = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => FoldersCompanion(
|
|
id: id,
|
|
path: path,
|
|
updatedAtMs: updatedAtMs,
|
|
deleted: deleted,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
required String id,
|
|
required String path,
|
|
required int updatedAtMs,
|
|
Value<bool> deleted = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => FoldersCompanion.insert(
|
|
id: id,
|
|
path: path,
|
|
updatedAtMs: updatedAtMs,
|
|
deleted: deleted,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map((e) => (e.readTable(table), BaseReferences(db, table, e)))
|
|
.toList(),
|
|
prefetchHooksCallback: null,
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$FoldersTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$MeloDb,
|
|
$FoldersTable,
|
|
Folder,
|
|
$$FoldersTableFilterComposer,
|
|
$$FoldersTableOrderingComposer,
|
|
$$FoldersTableAnnotationComposer,
|
|
$$FoldersTableCreateCompanionBuilder,
|
|
$$FoldersTableUpdateCompanionBuilder,
|
|
(Folder, BaseReferences<_$MeloDb, $FoldersTable, Folder>),
|
|
Folder,
|
|
PrefetchHooks Function()
|
|
>;
|
|
typedef $$PlaylistsTableCreateCompanionBuilder =
|
|
PlaylistsCompanion Function({
|
|
required String id,
|
|
required String name,
|
|
Value<String?> description,
|
|
required int createdAtMs,
|
|
required int updatedAtMs,
|
|
Value<bool> deleted,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$PlaylistsTableUpdateCompanionBuilder =
|
|
PlaylistsCompanion Function({
|
|
Value<String> id,
|
|
Value<String> name,
|
|
Value<String?> description,
|
|
Value<int> createdAtMs,
|
|
Value<int> updatedAtMs,
|
|
Value<bool> deleted,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$PlaylistsTableReferences
|
|
extends BaseReferences<_$MeloDb, $PlaylistsTable, Playlist> {
|
|
$$PlaylistsTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static MultiTypedResultKey<$PlaylistSongsTable, List<PlaylistSong>>
|
|
_playlistSongsRefsTable(_$MeloDb db) => MultiTypedResultKey.fromTable(
|
|
db.playlistSongs,
|
|
aliasName: 'playlists__id__playlist_songs__playlist_id',
|
|
);
|
|
|
|
$$PlaylistSongsTableProcessedTableManager get playlistSongsRefs {
|
|
final manager = $$PlaylistSongsTableTableManager(
|
|
$_db,
|
|
$_db.playlistSongs,
|
|
).filter((f) => f.playlistId.id.sqlEquals($_itemColumn<String>('id')!));
|
|
|
|
final cache = $_typedResult.readTableOrNull(_playlistSongsRefsTable($_db));
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: cache),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$PlaylistsTableFilterComposer
|
|
extends Composer<_$MeloDb, $PlaylistsTable> {
|
|
$$PlaylistsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<String> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<String> get description => $composableBuilder(
|
|
column: $table.description,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get createdAtMs => $composableBuilder(
|
|
column: $table.createdAtMs,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get updatedAtMs => $composableBuilder(
|
|
column: $table.updatedAtMs,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<bool> get deleted => $composableBuilder(
|
|
column: $table.deleted,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
Expression<bool> playlistSongsRefs(
|
|
Expression<bool> Function($$PlaylistSongsTableFilterComposer f) f,
|
|
) {
|
|
final $$PlaylistSongsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.id,
|
|
referencedTable: $db.playlistSongs,
|
|
getReferencedColumn: (t) => t.playlistId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PlaylistSongsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.playlistSongs,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$PlaylistsTableOrderingComposer
|
|
extends Composer<_$MeloDb, $PlaylistsTable> {
|
|
$$PlaylistsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<String> get id => $composableBuilder(
|
|
column: $table.id,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get name => $composableBuilder(
|
|
column: $table.name,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<String> get description => $composableBuilder(
|
|
column: $table.description,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get createdAtMs => $composableBuilder(
|
|
column: $table.createdAtMs,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get updatedAtMs => $composableBuilder(
|
|
column: $table.updatedAtMs,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<bool> get deleted => $composableBuilder(
|
|
column: $table.deleted,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
}
|
|
|
|
class $$PlaylistsTableAnnotationComposer
|
|
extends Composer<_$MeloDb, $PlaylistsTable> {
|
|
$$PlaylistsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<String> get id =>
|
|
$composableBuilder(column: $table.id, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get name =>
|
|
$composableBuilder(column: $table.name, builder: (column) => column);
|
|
|
|
GeneratedColumn<String> get description => $composableBuilder(
|
|
column: $table.description,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<int> get createdAtMs => $composableBuilder(
|
|
column: $table.createdAtMs,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<int> get updatedAtMs => $composableBuilder(
|
|
column: $table.updatedAtMs,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<bool> get deleted =>
|
|
$composableBuilder(column: $table.deleted, builder: (column) => column);
|
|
|
|
Expression<T> playlistSongsRefs<T extends Object>(
|
|
Expression<T> Function($$PlaylistSongsTableAnnotationComposer a) f,
|
|
) {
|
|
final $$PlaylistSongsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.id,
|
|
referencedTable: $db.playlistSongs,
|
|
getReferencedColumn: (t) => t.playlistId,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PlaylistSongsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.playlistSongs,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return f(composer);
|
|
}
|
|
}
|
|
|
|
class $$PlaylistsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$MeloDb,
|
|
$PlaylistsTable,
|
|
Playlist,
|
|
$$PlaylistsTableFilterComposer,
|
|
$$PlaylistsTableOrderingComposer,
|
|
$$PlaylistsTableAnnotationComposer,
|
|
$$PlaylistsTableCreateCompanionBuilder,
|
|
$$PlaylistsTableUpdateCompanionBuilder,
|
|
(Playlist, $$PlaylistsTableReferences),
|
|
Playlist,
|
|
PrefetchHooks Function({bool playlistSongsRefs})
|
|
> {
|
|
$$PlaylistsTableTableManager(_$MeloDb db, $PlaylistsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$PlaylistsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$PlaylistsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$PlaylistsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> id = const Value.absent(),
|
|
Value<String> name = const Value.absent(),
|
|
Value<String?> description = const Value.absent(),
|
|
Value<int> createdAtMs = const Value.absent(),
|
|
Value<int> updatedAtMs = const Value.absent(),
|
|
Value<bool> deleted = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => PlaylistsCompanion(
|
|
id: id,
|
|
name: name,
|
|
description: description,
|
|
createdAtMs: createdAtMs,
|
|
updatedAtMs: updatedAtMs,
|
|
deleted: deleted,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
required String id,
|
|
required String name,
|
|
Value<String?> description = const Value.absent(),
|
|
required int createdAtMs,
|
|
required int updatedAtMs,
|
|
Value<bool> deleted = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => PlaylistsCompanion.insert(
|
|
id: id,
|
|
name: name,
|
|
description: description,
|
|
createdAtMs: createdAtMs,
|
|
updatedAtMs: updatedAtMs,
|
|
deleted: deleted,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$PlaylistsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({playlistSongsRefs = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [
|
|
if (playlistSongsRefs) db.playlistSongs,
|
|
],
|
|
addJoins: null,
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [
|
|
if (playlistSongsRefs)
|
|
await $_getPrefetchedData<
|
|
Playlist,
|
|
$PlaylistsTable,
|
|
PlaylistSong
|
|
>(
|
|
currentTable: table,
|
|
referencedTable: $$PlaylistsTableReferences
|
|
._playlistSongsRefsTable(db),
|
|
managerFromTypedResult: (p0) =>
|
|
$$PlaylistsTableReferences(
|
|
db,
|
|
table,
|
|
p0,
|
|
).playlistSongsRefs,
|
|
referencedItemsForCurrentItem: (item, referencedItems) =>
|
|
referencedItems.where((e) => e.playlistId == item.id),
|
|
typedResults: items,
|
|
),
|
|
];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$PlaylistsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$MeloDb,
|
|
$PlaylistsTable,
|
|
Playlist,
|
|
$$PlaylistsTableFilterComposer,
|
|
$$PlaylistsTableOrderingComposer,
|
|
$$PlaylistsTableAnnotationComposer,
|
|
$$PlaylistsTableCreateCompanionBuilder,
|
|
$$PlaylistsTableUpdateCompanionBuilder,
|
|
(Playlist, $$PlaylistsTableReferences),
|
|
Playlist,
|
|
PrefetchHooks Function({bool playlistSongsRefs})
|
|
>;
|
|
typedef $$PlaylistSongsTableCreateCompanionBuilder =
|
|
PlaylistSongsCompanion Function({
|
|
required String playlistId,
|
|
required String songId,
|
|
required int position,
|
|
required int addedAtMs,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$PlaylistSongsTableUpdateCompanionBuilder =
|
|
PlaylistSongsCompanion Function({
|
|
Value<String> playlistId,
|
|
Value<String> songId,
|
|
Value<int> position,
|
|
Value<int> addedAtMs,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$PlaylistSongsTableReferences
|
|
extends BaseReferences<_$MeloDb, $PlaylistSongsTable, PlaylistSong> {
|
|
$$PlaylistSongsTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static $PlaylistsTable _playlistIdTable(_$MeloDb db) =>
|
|
db.playlists.createAlias('playlist_songs__playlist_id__playlists__id');
|
|
|
|
$$PlaylistsTableProcessedTableManager get playlistId {
|
|
final $_column = $_itemColumn<String>('playlist_id')!;
|
|
|
|
final manager = $$PlaylistsTableTableManager(
|
|
$_db,
|
|
$_db.playlists,
|
|
).filter((f) => f.id.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_playlistIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
|
|
static $SongsTable _songIdTable(_$MeloDb db) =>
|
|
db.songs.createAlias('playlist_songs__song_id__songs__id');
|
|
|
|
$$SongsTableProcessedTableManager get songId {
|
|
final $_column = $_itemColumn<String>('song_id')!;
|
|
|
|
final manager = $$SongsTableTableManager(
|
|
$_db,
|
|
$_db.songs,
|
|
).filter((f) => f.id.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_songIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$PlaylistSongsTableFilterComposer
|
|
extends Composer<_$MeloDb, $PlaylistSongsTable> {
|
|
$$PlaylistSongsTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get position => $composableBuilder(
|
|
column: $table.position,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get addedAtMs => $composableBuilder(
|
|
column: $table.addedAtMs,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$PlaylistsTableFilterComposer get playlistId {
|
|
final $$PlaylistsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.playlistId,
|
|
referencedTable: $db.playlists,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PlaylistsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.playlists,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$SongsTableFilterComposer get songId {
|
|
final $$SongsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.songId,
|
|
referencedTable: $db.songs,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$SongsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.songs,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$PlaylistSongsTableOrderingComposer
|
|
extends Composer<_$MeloDb, $PlaylistSongsTable> {
|
|
$$PlaylistSongsTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get position => $composableBuilder(
|
|
column: $table.position,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get addedAtMs => $composableBuilder(
|
|
column: $table.addedAtMs,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$PlaylistsTableOrderingComposer get playlistId {
|
|
final $$PlaylistsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.playlistId,
|
|
referencedTable: $db.playlists,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PlaylistsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.playlists,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$SongsTableOrderingComposer get songId {
|
|
final $$SongsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.songId,
|
|
referencedTable: $db.songs,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$SongsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.songs,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$PlaylistSongsTableAnnotationComposer
|
|
extends Composer<_$MeloDb, $PlaylistSongsTable> {
|
|
$$PlaylistSongsTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get position =>
|
|
$composableBuilder(column: $table.position, builder: (column) => column);
|
|
|
|
GeneratedColumn<int> get addedAtMs =>
|
|
$composableBuilder(column: $table.addedAtMs, builder: (column) => column);
|
|
|
|
$$PlaylistsTableAnnotationComposer get playlistId {
|
|
final $$PlaylistsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.playlistId,
|
|
referencedTable: $db.playlists,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$PlaylistsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.playlists,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
|
|
$$SongsTableAnnotationComposer get songId {
|
|
final $$SongsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.songId,
|
|
referencedTable: $db.songs,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$SongsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.songs,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$PlaylistSongsTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$MeloDb,
|
|
$PlaylistSongsTable,
|
|
PlaylistSong,
|
|
$$PlaylistSongsTableFilterComposer,
|
|
$$PlaylistSongsTableOrderingComposer,
|
|
$$PlaylistSongsTableAnnotationComposer,
|
|
$$PlaylistSongsTableCreateCompanionBuilder,
|
|
$$PlaylistSongsTableUpdateCompanionBuilder,
|
|
(PlaylistSong, $$PlaylistSongsTableReferences),
|
|
PlaylistSong,
|
|
PrefetchHooks Function({bool playlistId, bool songId})
|
|
> {
|
|
$$PlaylistSongsTableTableManager(_$MeloDb db, $PlaylistSongsTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$PlaylistSongsTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$PlaylistSongsTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$PlaylistSongsTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> playlistId = const Value.absent(),
|
|
Value<String> songId = const Value.absent(),
|
|
Value<int> position = const Value.absent(),
|
|
Value<int> addedAtMs = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => PlaylistSongsCompanion(
|
|
playlistId: playlistId,
|
|
songId: songId,
|
|
position: position,
|
|
addedAtMs: addedAtMs,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
required String playlistId,
|
|
required String songId,
|
|
required int position,
|
|
required int addedAtMs,
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => PlaylistSongsCompanion.insert(
|
|
playlistId: playlistId,
|
|
songId: songId,
|
|
position: position,
|
|
addedAtMs: addedAtMs,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$PlaylistSongsTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({playlistId = false, songId = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (playlistId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.playlistId,
|
|
referencedTable: $$PlaylistSongsTableReferences
|
|
._playlistIdTable(db),
|
|
referencedColumn: $$PlaylistSongsTableReferences
|
|
._playlistIdTable(db)
|
|
.id,
|
|
)
|
|
as T;
|
|
}
|
|
if (songId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.songId,
|
|
referencedTable: $$PlaylistSongsTableReferences
|
|
._songIdTable(db),
|
|
referencedColumn: $$PlaylistSongsTableReferences
|
|
._songIdTable(db)
|
|
.id,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$PlaylistSongsTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$MeloDb,
|
|
$PlaylistSongsTable,
|
|
PlaylistSong,
|
|
$$PlaylistSongsTableFilterComposer,
|
|
$$PlaylistSongsTableOrderingComposer,
|
|
$$PlaylistSongsTableAnnotationComposer,
|
|
$$PlaylistSongsTableCreateCompanionBuilder,
|
|
$$PlaylistSongsTableUpdateCompanionBuilder,
|
|
(PlaylistSong, $$PlaylistSongsTableReferences),
|
|
PlaylistSong,
|
|
PrefetchHooks Function({bool playlistId, bool songId})
|
|
>;
|
|
typedef $$FavoritesTableCreateCompanionBuilder =
|
|
FavoritesCompanion Function({
|
|
required String songId,
|
|
required int createdAtMs,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$FavoritesTableUpdateCompanionBuilder =
|
|
FavoritesCompanion Function({
|
|
Value<String> songId,
|
|
Value<int> createdAtMs,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$FavoritesTableReferences
|
|
extends BaseReferences<_$MeloDb, $FavoritesTable, Favorite> {
|
|
$$FavoritesTableReferences(super.$_db, super.$_table, super.$_typedResult);
|
|
|
|
static $SongsTable _songIdTable(_$MeloDb db) =>
|
|
db.songs.createAlias('favorites__song_id__songs__id');
|
|
|
|
$$SongsTableProcessedTableManager get songId {
|
|
final $_column = $_itemColumn<String>('song_id')!;
|
|
|
|
final manager = $$SongsTableTableManager(
|
|
$_db,
|
|
$_db.songs,
|
|
).filter((f) => f.id.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_songIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$FavoritesTableFilterComposer
|
|
extends Composer<_$MeloDb, $FavoritesTable> {
|
|
$$FavoritesTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get createdAtMs => $composableBuilder(
|
|
column: $table.createdAtMs,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$SongsTableFilterComposer get songId {
|
|
final $$SongsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.songId,
|
|
referencedTable: $db.songs,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$SongsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.songs,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$FavoritesTableOrderingComposer
|
|
extends Composer<_$MeloDb, $FavoritesTable> {
|
|
$$FavoritesTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get createdAtMs => $composableBuilder(
|
|
column: $table.createdAtMs,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$SongsTableOrderingComposer get songId {
|
|
final $$SongsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.songId,
|
|
referencedTable: $db.songs,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$SongsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.songs,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$FavoritesTableAnnotationComposer
|
|
extends Composer<_$MeloDb, $FavoritesTable> {
|
|
$$FavoritesTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get createdAtMs => $composableBuilder(
|
|
column: $table.createdAtMs,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
$$SongsTableAnnotationComposer get songId {
|
|
final $$SongsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.songId,
|
|
referencedTable: $db.songs,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$SongsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.songs,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$FavoritesTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$MeloDb,
|
|
$FavoritesTable,
|
|
Favorite,
|
|
$$FavoritesTableFilterComposer,
|
|
$$FavoritesTableOrderingComposer,
|
|
$$FavoritesTableAnnotationComposer,
|
|
$$FavoritesTableCreateCompanionBuilder,
|
|
$$FavoritesTableUpdateCompanionBuilder,
|
|
(Favorite, $$FavoritesTableReferences),
|
|
Favorite,
|
|
PrefetchHooks Function({bool songId})
|
|
> {
|
|
$$FavoritesTableTableManager(_$MeloDb db, $FavoritesTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$FavoritesTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$FavoritesTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$FavoritesTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> songId = const Value.absent(),
|
|
Value<int> createdAtMs = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => FavoritesCompanion(
|
|
songId: songId,
|
|
createdAtMs: createdAtMs,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
required String songId,
|
|
required int createdAtMs,
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => FavoritesCompanion.insert(
|
|
songId: songId,
|
|
createdAtMs: createdAtMs,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$FavoritesTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({songId = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (songId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.songId,
|
|
referencedTable: $$FavoritesTableReferences
|
|
._songIdTable(db),
|
|
referencedColumn: $$FavoritesTableReferences
|
|
._songIdTable(db)
|
|
.id,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$FavoritesTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$MeloDb,
|
|
$FavoritesTable,
|
|
Favorite,
|
|
$$FavoritesTableFilterComposer,
|
|
$$FavoritesTableOrderingComposer,
|
|
$$FavoritesTableAnnotationComposer,
|
|
$$FavoritesTableCreateCompanionBuilder,
|
|
$$FavoritesTableUpdateCompanionBuilder,
|
|
(Favorite, $$FavoritesTableReferences),
|
|
Favorite,
|
|
PrefetchHooks Function({bool songId})
|
|
>;
|
|
typedef $$PlaybackHistoryTableCreateCompanionBuilder =
|
|
PlaybackHistoryCompanion Function({
|
|
required String songId,
|
|
required int positionMs,
|
|
required int playedAtMs,
|
|
Value<int> rowid,
|
|
});
|
|
typedef $$PlaybackHistoryTableUpdateCompanionBuilder =
|
|
PlaybackHistoryCompanion Function({
|
|
Value<String> songId,
|
|
Value<int> positionMs,
|
|
Value<int> playedAtMs,
|
|
Value<int> rowid,
|
|
});
|
|
|
|
final class $$PlaybackHistoryTableReferences
|
|
extends
|
|
BaseReferences<_$MeloDb, $PlaybackHistoryTable, PlaybackHistoryData> {
|
|
$$PlaybackHistoryTableReferences(
|
|
super.$_db,
|
|
super.$_table,
|
|
super.$_typedResult,
|
|
);
|
|
|
|
static $SongsTable _songIdTable(_$MeloDb db) =>
|
|
db.songs.createAlias('playback_history__song_id__songs__id');
|
|
|
|
$$SongsTableProcessedTableManager get songId {
|
|
final $_column = $_itemColumn<String>('song_id')!;
|
|
|
|
final manager = $$SongsTableTableManager(
|
|
$_db,
|
|
$_db.songs,
|
|
).filter((f) => f.id.sqlEquals($_column));
|
|
final item = $_typedResult.readTableOrNull(_songIdTable($_db));
|
|
if (item == null) return manager;
|
|
return ProcessedTableManager(
|
|
manager.$state.copyWith(prefetchedData: [item]),
|
|
);
|
|
}
|
|
}
|
|
|
|
class $$PlaybackHistoryTableFilterComposer
|
|
extends Composer<_$MeloDb, $PlaybackHistoryTable> {
|
|
$$PlaybackHistoryTableFilterComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnFilters<int> get positionMs => $composableBuilder(
|
|
column: $table.positionMs,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
ColumnFilters<int> get playedAtMs => $composableBuilder(
|
|
column: $table.playedAtMs,
|
|
builder: (column) => ColumnFilters(column),
|
|
);
|
|
|
|
$$SongsTableFilterComposer get songId {
|
|
final $$SongsTableFilterComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.songId,
|
|
referencedTable: $db.songs,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$SongsTableFilterComposer(
|
|
$db: $db,
|
|
$table: $db.songs,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$PlaybackHistoryTableOrderingComposer
|
|
extends Composer<_$MeloDb, $PlaybackHistoryTable> {
|
|
$$PlaybackHistoryTableOrderingComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
ColumnOrderings<int> get positionMs => $composableBuilder(
|
|
column: $table.positionMs,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
ColumnOrderings<int> get playedAtMs => $composableBuilder(
|
|
column: $table.playedAtMs,
|
|
builder: (column) => ColumnOrderings(column),
|
|
);
|
|
|
|
$$SongsTableOrderingComposer get songId {
|
|
final $$SongsTableOrderingComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.songId,
|
|
referencedTable: $db.songs,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$SongsTableOrderingComposer(
|
|
$db: $db,
|
|
$table: $db.songs,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$PlaybackHistoryTableAnnotationComposer
|
|
extends Composer<_$MeloDb, $PlaybackHistoryTable> {
|
|
$$PlaybackHistoryTableAnnotationComposer({
|
|
required super.$db,
|
|
required super.$table,
|
|
super.joinBuilder,
|
|
super.$addJoinBuilderToRootComposer,
|
|
super.$removeJoinBuilderFromRootComposer,
|
|
});
|
|
GeneratedColumn<int> get positionMs => $composableBuilder(
|
|
column: $table.positionMs,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
GeneratedColumn<int> get playedAtMs => $composableBuilder(
|
|
column: $table.playedAtMs,
|
|
builder: (column) => column,
|
|
);
|
|
|
|
$$SongsTableAnnotationComposer get songId {
|
|
final $$SongsTableAnnotationComposer composer = $composerBuilder(
|
|
composer: this,
|
|
getCurrentColumn: (t) => t.songId,
|
|
referencedTable: $db.songs,
|
|
getReferencedColumn: (t) => t.id,
|
|
builder:
|
|
(
|
|
joinBuilder, {
|
|
$addJoinBuilderToRootComposer,
|
|
$removeJoinBuilderFromRootComposer,
|
|
}) => $$SongsTableAnnotationComposer(
|
|
$db: $db,
|
|
$table: $db.songs,
|
|
$addJoinBuilderToRootComposer: $addJoinBuilderToRootComposer,
|
|
joinBuilder: joinBuilder,
|
|
$removeJoinBuilderFromRootComposer:
|
|
$removeJoinBuilderFromRootComposer,
|
|
),
|
|
);
|
|
return composer;
|
|
}
|
|
}
|
|
|
|
class $$PlaybackHistoryTableTableManager
|
|
extends
|
|
RootTableManager<
|
|
_$MeloDb,
|
|
$PlaybackHistoryTable,
|
|
PlaybackHistoryData,
|
|
$$PlaybackHistoryTableFilterComposer,
|
|
$$PlaybackHistoryTableOrderingComposer,
|
|
$$PlaybackHistoryTableAnnotationComposer,
|
|
$$PlaybackHistoryTableCreateCompanionBuilder,
|
|
$$PlaybackHistoryTableUpdateCompanionBuilder,
|
|
(PlaybackHistoryData, $$PlaybackHistoryTableReferences),
|
|
PlaybackHistoryData,
|
|
PrefetchHooks Function({bool songId})
|
|
> {
|
|
$$PlaybackHistoryTableTableManager(_$MeloDb db, $PlaybackHistoryTable table)
|
|
: super(
|
|
TableManagerState(
|
|
db: db,
|
|
table: table,
|
|
createFilteringComposer: () =>
|
|
$$PlaybackHistoryTableFilterComposer($db: db, $table: table),
|
|
createOrderingComposer: () =>
|
|
$$PlaybackHistoryTableOrderingComposer($db: db, $table: table),
|
|
createComputedFieldComposer: () =>
|
|
$$PlaybackHistoryTableAnnotationComposer($db: db, $table: table),
|
|
updateCompanionCallback:
|
|
({
|
|
Value<String> songId = const Value.absent(),
|
|
Value<int> positionMs = const Value.absent(),
|
|
Value<int> playedAtMs = const Value.absent(),
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => PlaybackHistoryCompanion(
|
|
songId: songId,
|
|
positionMs: positionMs,
|
|
playedAtMs: playedAtMs,
|
|
rowid: rowid,
|
|
),
|
|
createCompanionCallback:
|
|
({
|
|
required String songId,
|
|
required int positionMs,
|
|
required int playedAtMs,
|
|
Value<int> rowid = const Value.absent(),
|
|
}) => PlaybackHistoryCompanion.insert(
|
|
songId: songId,
|
|
positionMs: positionMs,
|
|
playedAtMs: playedAtMs,
|
|
rowid: rowid,
|
|
),
|
|
withReferenceMapper: (p0) => p0
|
|
.map(
|
|
(e) => (
|
|
e.readTable(table),
|
|
$$PlaybackHistoryTableReferences(db, table, e),
|
|
),
|
|
)
|
|
.toList(),
|
|
prefetchHooksCallback: ({songId = false}) {
|
|
return PrefetchHooks(
|
|
db: db,
|
|
explicitlyWatchedTables: [],
|
|
addJoins:
|
|
<
|
|
T extends TableManagerState<
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic,
|
|
dynamic
|
|
>
|
|
>(state) {
|
|
if (songId) {
|
|
state =
|
|
state.withJoin(
|
|
currentTable: table,
|
|
currentColumn: table.songId,
|
|
referencedTable:
|
|
$$PlaybackHistoryTableReferences
|
|
._songIdTable(db),
|
|
referencedColumn:
|
|
$$PlaybackHistoryTableReferences
|
|
._songIdTable(db)
|
|
.id,
|
|
)
|
|
as T;
|
|
}
|
|
|
|
return state;
|
|
},
|
|
getPrefetchedDataCallback: (items) async {
|
|
return [];
|
|
},
|
|
);
|
|
},
|
|
),
|
|
);
|
|
}
|
|
|
|
typedef $$PlaybackHistoryTableProcessedTableManager =
|
|
ProcessedTableManager<
|
|
_$MeloDb,
|
|
$PlaybackHistoryTable,
|
|
PlaybackHistoryData,
|
|
$$PlaybackHistoryTableFilterComposer,
|
|
$$PlaybackHistoryTableOrderingComposer,
|
|
$$PlaybackHistoryTableAnnotationComposer,
|
|
$$PlaybackHistoryTableCreateCompanionBuilder,
|
|
$$PlaybackHistoryTableUpdateCompanionBuilder,
|
|
(PlaybackHistoryData, $$PlaybackHistoryTableReferences),
|
|
PlaybackHistoryData,
|
|
PrefetchHooks Function({bool songId})
|
|
>;
|
|
|
|
class $MeloDbManager {
|
|
final _$MeloDb _db;
|
|
$MeloDbManager(this._db);
|
|
$$SongsTableTableManager get songs =>
|
|
$$SongsTableTableManager(_db, _db.songs);
|
|
$$FoldersTableTableManager get folders =>
|
|
$$FoldersTableTableManager(_db, _db.folders);
|
|
$$PlaylistsTableTableManager get playlists =>
|
|
$$PlaylistsTableTableManager(_db, _db.playlists);
|
|
$$PlaylistSongsTableTableManager get playlistSongs =>
|
|
$$PlaylistSongsTableTableManager(_db, _db.playlistSongs);
|
|
$$FavoritesTableTableManager get favorites =>
|
|
$$FavoritesTableTableManager(_db, _db.favorites);
|
|
$$PlaybackHistoryTableTableManager get playbackHistory =>
|
|
$$PlaybackHistoryTableTableManager(_db, _db.playbackHistory);
|
|
}
|