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

902 views Asked by At

Im using play-slick 3.0.3 I have such column:

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..

Im having this problem after migration from 1.1.1 :)

or in other places in code:

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

any help appreciated thanks!

1

There are 1 answers

2
Evgeny On

Not a lot of info, but how it could be (example for slick 3.1, think should be similar for 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. And will be harder to migrate from 1.1.1