【发布时间】:2017-03-07 17:21:18
【问题描述】:
我正在尝试插入已使用此代码的不存在
case class Item(name: String, id: Long = 0L) // name is unique
val data = Query("Bob")
val exists = items.filter(_.name === "Bob").exists
val sel = data.filterNot(_ => exists)
val action = items.map(_.name).forceInsertQuery(sel)
它有效,但我想返回行的 id(现有/插入)。目前它返回一个布尔值。如何在无需再次查询的情况下获取 id?
【问题讨论】: