我正在创建一个实体(房间持久性库)类Food,在那里我想使foodId作为自增量。
@Entity
class Food(var foodName: String, var foodDesc: String, var protein: Double, var carbs: Double, var fat: Double)
{
@PrimaryKey
var foodId: Int = 0
var calories: Double = 0.toDouble()
}
如何设置foodId自增字段?