我需要编写一个使用日期作为 id 的应用程序,并且我必须能够通过比较日期来更新
@Entity
data class DailyCount(@PrimaryKey
var date:DateTime,
var summ: Double = 0.0)
这是DAO
@Query("update DailyCount set summ = :sum where date = :today")
fun updateCash(today: DateTime, sum: Double)
我想做这样的:
@Entity
data class DailyCount(@PrimaryKey
var date:Date,//JodaTime containing only date
var summ: Double = 0.0)
或者像这样:
@Query("update DailyCount set summ = :sum where date.today = :dateArg.today")
fun updateCash(dateArg: DateTime, sum: Double)