I want to build a JodaDateTimeField record Field. How should I build
this so my high level code only has to deal with Joda DateTime objects
but they get properly converted to Dates before getting sent to the
java driver.
Some ideas:
1) Modify scamongo to recognize DateTimes and do the conversion
there. But should the mongo driver really have to do that? What if
there are other future types that people want to use with it? It
shouldn't have to be modified anytime someone wants to save a new
type.
2) Just store the DateTimes in the datastore as Strings. This
actually works fine now. But it's pretty gross.
3) Punt on building JodaDateTimeField and just build DateField. But
this makes my application logic more complex.
Not entirely sure how this is supposed to work from the perspective of
record? Where is the translation from complex types (DateTime) to
simple types the datastore can understand (Date) supposed to happen?
-harryh
-Ross
> --
> You received this message because you are subscribed to the Google Groups "Lift" group.
> To post to this group, send email to lif...@googlegroups.com.
> To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.
>
That would certainly work, though it does clutter up my code some.
And the problem can be further generalized. What if Mongo didn't have
native support for Dates in the driver so we needed to, say, convert
them to ints (seconds since the epoch).
Then I would need to sublcass LongField (DateTimeLongField) in my
application instead yes? It seems like there is a bit of a potential
explosion of field types here that just translate from high order
types the application wants to use, and low level types the datastore
can handle.
It would be nice if record had a clean way of dealing with this sort
of thing. Which isn't to say I know exactly how that would work...
-harryh
-Ross
Once I get home I'll push the lift-json integration changes for lift-record. Then I'm going to work on some examples so Max can get started on the squeryl integration and I'll help him with that. Then I'm going to try and put the Debasish-Active-Record-Pattern-Considered-Harmful thing to rest in one way or another.
If you want to split out connection, that would be rad (and help Max)
-Ross