如何从DAO中脱颖而出? [英] how to get Deffered from DAO?
问题描述
我想让DAO带来的Kotlin Coroutnies
I want to get Kotlin Coroutnies Deffered from DAO
@Query("select * from gameprocess where cabinId = :cabinId ")
fun getAllGameProccesBiCabin(cabinId :Int) : Deferred<GameProcess>
但是它不能编译(房间不知道如何处理Deffered),但是我需要使用'Deffered'中的'wait'怎么做?
but it does not compile (room does not know how to handle Deffered), but I need to use 'wait' from 'Deffered' how can do this?
作为另一个选项,我可以使用本文中的扩展功能,但是,不知道如何将其集成到dao中:
as another option I could use extension function from this post but, dont know how to integrate it into dao:
https ://codelabs.developers.google.com/codelabs/kotlin-coroutines/index.html?index = ..%2F..index#6
推荐答案
here is dependency which allows me to use async{}.await
https://github.com/Kotlin/kotlinx.coroutines/blob/master/ui/coroutines-guide-ui.md
问题是我使用的是不支持它的旧版本.
The problem was that I was using old version which doesn't support it.
这篇关于如何从DAO中脱颖而出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!