简体   繁体   中英

can i use LiveData in Room SELECT Query (not as a return type)

can I do something like this:

@Query("SELECT * FROM DataClassPost WHERE documentPath IN (:docsList) ORDER BY postTime DESC")
    fun subscribeToCollectionDocs(docsList: LiveData<List<String>>): LiveData<List<DataClassPost>>

or I have to use List<String> ?

No you cant refer to the live data inside the QUERY. just pass the String itself from the live data value to the function so your function would look like fun subscribeToCollectionDocs(docsList: String): LiveData<List<DataClassPost>>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM