我正在使用postgres的pg-slick扩展名。我尝试在where子句中进行计算但是我没有让它工作。它总是说:
value - is not a member of java.sql.Timestamp
过滤条款:
.filter(r => Timestamp.from(Instant.now()) - r.lastActivity < Duration.ofMinutes(30))
其中lastActivity是:
def lastActivity = column[Timestamp]("last_activity")
和我的postgres驱动程序是:
trait MyPostgresDriver extends ExPostgresProfile
with PgPostGISSupport
with PgDate2Support
with PgEnumSupport {
override val api: API = new API {}
///
trait API extends super.API
with PostGISImplicits
with DateTimeImplicits
with PostGISAssistants {
}
}
object MyPostgresDriver extends MyPostgresDriver
答案 0 :(得分:0)
添加:
val plainAPI = new API
with Date2DateTimePlainImplicits {}
似乎解决了这个问题。另外,请不要忘记添加with DateTimeImplicits
和with PgDateSupport