【发布时间】:2017-10-26 11:00:47
【问题描述】:
在 SQL Brite 中,有一个方法 mapToOneOrDefault。房间里有类似的东西吗?
为模特说话
@Entity(tableName = "users")
data class User(@PrimaryKey val name: String)
和道
@Dao
interface UserDao {
@Query("SELECT FROM users where name = :name")
fun getUserByName(name: String): Flowable<User>
}
如果数据库中没有John,则流不会为getUserByName("John") 返回任何内容。有没有办法获得默认值,比如User("")?
【问题讨论】:
-
嗨,Sourabh,你能帮我解决这个问题吗? stackoverflow.com/questions/47171018/css-animation-transition
-
嗨,Sourabh,请帮我解决这个问题stackoverflow.com/questions/47171018/css-animation-transition 我认为你的 CSS 动画很棒。
-
对不起,我不再做 CSS 了
标签: android kotlin rx-java2 android-room