Add track Dao

This commit is contained in:
tzugen 2022-04-18 07:20:19 +02:00
parent 3a3bd10fdb
commit ee67f4c744
No known key found for this signature in database
GPG Key ID: 61E9C34BC10EC930
2 changed files with 27 additions and 0 deletions

View File

@ -31,6 +31,8 @@ abstract class MetaDatabase : RoomDatabase() {
abstract fun albumDao(): AlbumDao
abstract fun trackDao(): AlbumDao
abstract fun musicFoldersDao(): MusicFoldersDao
abstract fun indexDao(): IndexDao

View File

@ -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>
}