在Slick 3 documentation中的哪个部分记录了如何进行insertOrUpdate
式操作?
答案 0 :(得分:2)
slick 3.x随附的insertOrUpdate方法为limited to MySQL Only。您将不会获得任何警告/代码文档,它只会引发Integrity异常。
要在使用Postgres的情况下使用Slick进行增补,可以使用slick-pg。
答案 1 :(得分:1)
This support is there in Slick . Look at this merge : Pull Request Merged Here The support was added in Slick 2.1 .
These are also called upsert
statements.
However i would think you would want to use plain SQL(for the native DB you are using) for this kind of requirement. Look here for examples of how to use Slick to do this.
Basically code that looks like the following ,
val reviews = TableQuery[<Class extending Table>]
val upsert: DBIO[Int] = reviews.insertOrUpdate(<value to be inserted>)
答案 2 :(得分:0)
SimpleInsertActionComposer
包含所需方法:doc link