会议室数据库获取价值图

时间:2020-04-29 09:03:12

标签: android-room androidx

我需要得到类似的东西: Map<String, Boolean>List<Pair>

Dao:

...
@Query("SELECT id, isFavorite FROM sources")
fun getCompareData(): Map<String, Boolean>
...

Entitiy:

@Entity(tableName = "sources")
data class Source(
    @PrimaryKey val id: String,
    val name: String,
    val description: String,
    val language: String,
    val country: String,
    var isFavorite: Boolean = false
)

或者我该怎么做?

更新:我刚刚创建

data class Favorite(
val id: String,
val isFavorite: Boolean
)

并写成`fun getFavorites():列表

0 个答案:

没有答案