Add track Dao
This commit is contained in:
parent
3a3bd10fdb
commit
ee67f4c744
|
@ -31,6 +31,8 @@ abstract class MetaDatabase : RoomDatabase() {
|
|||
|
||||
abstract fun albumDao(): AlbumDao
|
||||
|
||||
abstract fun trackDao(): AlbumDao
|
||||
|
||||
abstract fun musicFoldersDao(): MusicFoldersDao
|
||||
|
||||
abstract fun indexDao(): IndexDao
|
||||
|
|
|
@ -0,0 +1,25 @@
|
|||
package org.moire.ultrasonic.data
|
||||
|
||||
import androidx.room.Query
|
||||
import org.moire.ultrasonic.domain.MusicDirectory
|
||||
|
||||
interface TrackDao {
|
||||
/**
|
||||
* Clear the whole database
|
||||
*/
|
||||
@Query("DELETE FROM tracks")
|
||||
fun clear()
|
||||
|
||||
/**
|
||||
* Get all albums
|
||||
*/
|
||||
@Query("SELECT * FROM tracks")
|
||||
fun get(): List<MusicDirectory.Album>
|
||||
|
||||
/**
|
||||
* Get albums by artist
|
||||
*/
|
||||
@Query("SELECT * FROM tracks WHERE albumId LIKE :id")
|
||||
fun byAlbum(id: String): List<MusicDirectory.Entry>
|
||||
|
||||
}
|
Loading…
Reference in New Issue