简体   繁体   English

isEmpty值不是slick.lifted.Rep [Option [java.time.LocalDateTime]]的成员

[英]value isEmpty is not a member of slick.lifted.Rep[Option[java.time.LocalDateTime]]

Im using play-slick 3.0.3 I have such column: 我正在使用光滑的3.0.3我有这样的专栏:

val someDate = column[Option[LocalDateTime]]("some_date", O.Default(None))

and in code I want to do: 和我想做的代码:

table.someDate.isEmpty

but Ive got errors that isEmpty does not exists.. for example for Option[Int] it works fine.. 但是我有isEmpty不存在的错误..例如对于Option [Int],它可以正常工作。

Im having this problem after migration from 1.1.1 :) 我从1.1.1迁移后遇到了这个问题:)

or in other places in code: 或代码中的其他位置:

value value is not a member of java.time.LocalDateTime

any help appreciated thanks! 任何帮助表示赞赏,谢谢!

Not a lot of info, but how it could be (example for slick 3.1, think should be similar for 3.0): 信息不是很多,但信息可能是多少(例如光滑的3.1的示例,认为与3.0相似):

case class RowClass(id: Option[Int],
                    someDate: Option[LocalDateTime])

case class TableClass(tag: Tag)
  extends Table[RowClass](tag, "companies") {
  val id = column[Int]("id", O.PrimaryKey, O.AutoInc)
  val someDate = column[Option[LocalDateTime]]("some_date", O.Default(None))

  def * = (id.?, someDate) <> ( RowClass.tupled, RowClass.unapply )
}
val query = TableQuery[TableClass]
val q: Query[TableClass, RowClass, Seq] = 
  query.filter(_.someDate.isEmpty)

and than you can get result as 然后你可以得到如下结果

val result: Future[Seq[RowClass]] =
  db.run(q.result)

Please note, that slick introduced huge amount of difference even between versions 2.1 and 3.0, from my point of view it is hard to migrate. 请注意,从我的观点来看,即使在2.1和3.0版本之间,slick带来了巨大的差异,很难移植。 And will be harder to migrate from 1.1.1 从1.1.1迁移将更加困难

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM