0

接口松到{

@Query("SELECT * FROM song group by artist")
fun getAll(): LivePagedListProvider<Int, Song>

@Query("SELECT * FROM song where album like :arg0")
fun getAllSong(albumName: String): LivePagedListProvider<Int, Song>

@Query("SELECT * FROM song group by album")
fun getAllAlbum(): LivePagedListProvider<Int, Song>

}

类 SongViewModel(app: Application) : AndroidViewModel(app) {

private val doa = AppDatabase.get(app).songDao()

companion object {

    private const val PAGE_SIZE = 30

    private const val ENABLE_PLACEHOLDERS = true
}

val allSong = doa.getAllSong("1989 taylor swift").
        create(0, PagedList.Config.Builder().
                setPageSize(PAGE_SIZE).
                setEnablePlaceholders(ENABLE_PLACEHOLDERS).
                build())

}

我想在我的 AndroidViewModel 中调用 getAllSong 函数

我想用传递的实际参数替换“1989 taylor swift”,以及它是如何传递给它的

4

0 回答 0