Make Room models @Immutable
This commit is contained in:
parent
e7d768e6bd
commit
305d6c80c5
12 changed files with 24 additions and 0 deletions
|
@ -1,8 +1,10 @@
|
|||
package it.vfsfitvnm.vimusic.models
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Immutable
|
||||
@Entity
|
||||
data class Album(
|
||||
@PrimaryKey val id: String,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package it.vfsfitvnm.vimusic.models
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Immutable
|
||||
@Entity
|
||||
data class Artist(
|
||||
@PrimaryKey val id: String,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package it.vfsfitvnm.vimusic.models
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.room.Junction
|
||||
import androidx.room.Relation
|
||||
|
||||
@Immutable
|
||||
open class DetailedSong(
|
||||
val id: String,
|
||||
val title: String,
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package it.vfsfitvnm.vimusic.models
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.room.Relation
|
||||
|
||||
@Immutable
|
||||
class DetailedSongWithContentLength(
|
||||
id: String,
|
||||
title: String,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package it.vfsfitvnm.vimusic.models
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Immutable
|
||||
@Entity
|
||||
data class Playlist(
|
||||
@PrimaryKey(autoGenerate = true) val id: Long = 0,
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
package it.vfsfitvnm.vimusic.models
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.room.Embedded
|
||||
|
||||
@Immutable
|
||||
data class PlaylistPreview(
|
||||
@Embedded val playlist: Playlist,
|
||||
val songCount: Int
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package it.vfsfitvnm.vimusic.models
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.room.Embedded
|
||||
import androidx.room.Junction
|
||||
import androidx.room.Relation
|
||||
|
||||
@Immutable
|
||||
data class PlaylistWithSongs(
|
||||
@Embedded val playlist: Playlist,
|
||||
@Relation(
|
||||
|
|
|
@ -1,10 +1,12 @@
|
|||
package it.vfsfitvnm.vimusic.models
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.media3.common.MediaItem
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Immutable
|
||||
@Entity
|
||||
class QueuedMediaItem(
|
||||
@PrimaryKey(autoGenerate = true) val id: Long = 0,
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package it.vfsfitvnm.vimusic.models
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.room.Entity
|
||||
import androidx.room.PrimaryKey
|
||||
|
||||
@Immutable
|
||||
@Entity
|
||||
data class Song(
|
||||
@PrimaryKey val id: String,
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package it.vfsfitvnm.vimusic.models
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.ForeignKey
|
||||
|
||||
@Immutable
|
||||
@Entity(
|
||||
primaryKeys = ["songId", "artistId"],
|
||||
foreignKeys = [
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
package it.vfsfitvnm.vimusic.models
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.Entity
|
||||
import androidx.room.ForeignKey
|
||||
|
||||
@Immutable
|
||||
@Entity(
|
||||
primaryKeys = ["songId", "playlistId"],
|
||||
foreignKeys = [
|
||||
|
|
|
@ -1,8 +1,10 @@
|
|||
package it.vfsfitvnm.vimusic.models
|
||||
|
||||
import androidx.compose.runtime.Immutable
|
||||
import androidx.room.ColumnInfo
|
||||
import androidx.room.DatabaseView
|
||||
|
||||
@Immutable
|
||||
@DatabaseView("SELECT * FROM SongPlaylistMap ORDER BY position")
|
||||
data class SortedSongPlaylistMap(
|
||||
@ColumnInfo(index = true) val songId: String,
|
||||
|
|
Loading…
Add table
Reference in a new issue