Compile error using slick MappedColumnType for static request
I have the following mapper so that I can use Joda DateTime values ββin my Slick models and queries:
import java.sql.Timestamp
import org.joda.time.DateTime
import scala.slick.driver.MySQLDriver.simple._
object Mappers {
implicit def joda =
MappedColumnType.base[DateTime, Timestamp](
dt => new Timestamp(dt.getMillis),
ts => new DateTime(ts.getTime)
)
}
The designated table classes containing the DateTime field compile normally by importing this. However, a static query like this will not:
sql"""select s.expiresAt from tablename s limit 1""".as[DateTime].first
I am getting this error:
could not find implicit value for parameter rconv: scala.slick.jdbc.GetResult[org.joda.time.DateTime]
What do I need to add to make this work?
+3
source to share