I have following case class
case class Tag(key: String, value: String, modifiedDate: Date)
And I have a data access object that looks like this:
class TagDao(implicit val ec: ExecutionContext, val ctx: PostgresAsyncContext[SnakeCase]) {
def update(tag: Tag): Future[Int] =
performIO(
runIO(
quote {
query[Tag]
.filter(_.id == tag.id)
.update(lift(tag))
.returning(_.id)
}
)
)
}
I want
modifiedDate
field ofTag
in update method to be replaced byCURRENT_TIMESTAMP
. How can it be done?
One alternative is before updating I set the modifiedDate
manually in the code
try to use
copy
method from case class object and pass new Date contained current date: