如何从DAO中脱颖而出?

时间:2019-04-10 10:54:17

标签: android kotlin android-room

我想让DAO带来的Kotlin Coroutnies

@Query("select * from gameprocess where cabinId = :cabinId ")
fun getAllGameProccesBiCabin(cabinId :Int) : Deferred<GameProcess>

但是它无法编译(房间不知道如何处理Deffered),但是我需要使用“ Deffered”中的“ wait”怎么办?

作为另一个选项,我可以使用本文中的扩展功能,但是,不知道如何将其集成到dao中:

https://codelabs.developers.google.com/codelabs/kotlin-coroutines/index.html?index=..%2F..index#6

1 个答案:

答案 0 :(得分:0)

这里是依赖项,它使我可以使用async{}.await https://github.com/Kotlin/kotlinx.coroutines/blob/master/ui/coroutines-guide-ui.md

问题是我使用的是不支持它的旧版本。