mongodb - ReactiveMongo 0.9: Joda Datetime Implicit Conversion for Macros.handler -
i have case class joda datetime field:
case domainpositiondata(domain: string, position: int, change: option[int], date:datetime)
trying use macro generate reader&writer:
implicit val domposformat = macros.handler[domainpositiondata]
i got:
implicit org.joda.time.datetime 'value date' not found
but haven't found info how implement own implicit convertor.
looking @ source code existing handlers, try create implicit conversion (not tested):
import org.joda.time.datetime implicit object bsondatetimehandler extends bsonhandler[bsondatetime, datetime] { def read(time: bsondatetime) = new datetime(time.value) def write(jdtime: datetime) = bsondatetime(jdtime.getmillis) }
Comments
Post a Comment