2017-07-28 87 views
0

我正在使用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

添加:

val plainAPI = new API 
    with Date2DateTimePlainImplicits {} 

似乎解决了这个问题。也别忘了加with DateTimeImplicitswith PgDateSupport