scala – 在Slick中查询类型映射列
发布时间:2020-12-16 18:55:38 所属栏目:安全 来源:网络整理
导读:你会如何在SLICK写这个查询? DB.withSession { implicit session = Tokens.where(_.expirationTime DateTime.now ).delete} DateTime.now的类型为org.joda.time.DateTime 和_.expirationTime是相同类型的类型映射列. 我收到这个错误 [error] UserService.sc
你会如何在SLICK写这个查询?
DB.withSession { implicit session => Tokens.where(_.expirationTime < DateTime.now ).delete } DateTime.now的类型为org.joda.time.DateTime 和_.expirationTime是相同类型的类型映射列. 我收到这个错误 [error] UserService.scala:80: value < is not a member of scala.slick.lifted.Column[org.joda.time.DateTime] [error] Tokens.where(_.expirationTime < DateTime.now ).delete [error] ^ [error] one error found 现在使用此表单中的查询. 解决方法
我的猜测是JodaTime类型不是开箱即用的支持类型.如果您将该列更改为java.sql.Timestamp并使用Timestamp作为比较值,那么事情就可以了.如果要在光滑的列映射中使用joda类型,可能需要查看以下内容:
https://github.com/tototoshi/slick-joda-mapper (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |