feat(pgrx): add chrono feature for easy conversions
This commit adds a chrono feature flag to pgrx, which enables conversions between pgrx native date/time (with or without timezone) and chrono types like NaiveDateTime.
I think you're probably on the right track here. I suppose we'd want to also have conversions from the chrono types into the Postgres types.
I don't know how far @workingjubilee might want to take this in terms of also supporting IntoDatum/FromDatum for the chrono types (not clear to which SQL type they'd map to), so that's an open question...
Yeah, this seems like the right direction.
I don't think we want to support IntoDatum/FromDatum for these types. I would rather move towards making it easier to distinguish when something is a "zero-overhead" or "direct" conversion that is natively supported by Postgres, and when something requires additional logic like these types always will.
Thanks for the check @workingjubilee @eeeebbbbrrrr and for the heads up -- just to confirm I do plan to add the conversions both ways.
Will finish up the rest of it in this pattern and turn this to ready for review hopefully soon!
Hey @workingjubilee @eeeebbbbrrrr just finished the first version of this, would love a review whenever you can find some time!
I've tried to be pretty explicit about where the microseconds-only limitation of pg comes into play. I'm also equally happy to put this functionality in some sort of external crate if you'd prefer to not upstream this functionality as well!
Hi !
Is there's a way for me to help moving this PR forward ? It would be very useful in my own extension...
Rebased just to make sure that's not blocking progress here :)
Sorry, all my focus was being consumed by https://github.com/pgcentralfoundation/pgrx/pull/1731 since that was one of our last release blockers so reviewing anything that wasn't incredibly trivial was backburnered.
@workingjubilee absolutely no problem -- thanks for taking a look (P.S. I saw the other thing you were working on :+1: :+1: :+1:).
Will add the additional tests!
Hi - any particular reason for closing down this PR?