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