说我有一个带有列的表“ cities_with_customers”
id | city | customers
---+------------+----------
1 | London | 5
2 | Bristol | 6
3 | Birmingham | 7
和没有ID的地图
val map: mapOf("London" to 20, "Birmingham" to 5) // No ids!
现在我可以继续执行此操作
@Query("UPDATE cities_with_customers SET customers = :v WHERE city LIKE :k") }
fun update(k: String, v: Int)
和
for((k, v) in map)
dao.update(k,v)
但是有没有一种方法可以将其优化为单个查询?
类似
@Query( **magic happens here!**)
dao.update(cities: List<String>, customers: List<Int>)