以下是我的房间实体:
@Entity(tableName = "matched_users")
data class MatchedUser(
@PrimaryKey(autoGenerate = true) val id: Int,
@ColumnInfo(name = "match_id") val matchId: String
)
以下是我在Fragment中实例化它的示例:
private fun pass(){
CoroutineScope(coroutineContext).launch {
val match = MatchedUser()
CustomApplication.database?.matchedUsersDao()?.addMatchUid(match)
Log.d(TAG, "Added matchId to DB")
}
return removeUser2()
}
当我悬停在
MatchedUser()
上时,它仍然显示需要传递id
参数...但是根据实体中的说明,它应该是自动生成的。有任何想法吗?