[英]Increment column value using Slick for postgres
I need to add 1 to column value for a record in postgres table based on some filter. 我需要根据一些过滤器为postgres表中的记录添加1到列值。 Suppose I have two fields id
and count
and I want to increment count value by 1. 假设我有两个字段id
和count
,我想将计数值增加1。
So far I have 到目前为止我有
MyTable.filter(_.id === someId).map(_.count).update(??)
Not sure how if it is possible to use update
to do so. 不确定如何使用update
来执行此操作。 Any suggestion? 有什么建议吗?
Currently, this is not supported in Slick - https://github.com/slick/slick/issues/497 . 目前,Slick不支持此功能 - https://github.com/slick/slick/issues/497 。 You could: 你可以:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.