Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Ability to choose chrono instead of time #209

Open
jacobsvante opened this issue Mar 31, 2023 · 4 comments
Open

Feature request: Ability to choose chrono instead of time #209

jacobsvante opened this issue Mar 31, 2023 · 4 comments
Labels
dependencies Dependency versions, features and changes. feature New feature or request

Comments

@jacobsvante
Copy link
Contributor

Currently time fields seem bound to the time library. Working with time zones with time is a PITA so I was saddened to see that cornucopia does not support chrono.

Might implement this myself after Easter. @LouisGariepy @Virgiel Should I implement as a crate feature, e.g. chrono + time where time is default?

Or maybe #207 would solve this?

@Virgiel
Copy link
Member

Virgiel commented Mar 31, 2023

The simplest solution for now, would be to use SystemTime for timestamp and timestamptz and let the user match to time or chrono. Latter we could add a feature to make this more ergonomic.

In postgres, timestamps are just microseconds and dates are just number of day. We should use types that match this reality.

@jacobsvante
Copy link
Contributor Author

I didn't know SystemTime can be used to store historical dates..?

Either way I think the feature approach I mentioned might make more sense though, as postgres-types does it this way. I don't think it makes use of SystemTime at all.

@LouisGariepy LouisGariepy added feature New feature or request dependencies Dependency versions, features and changes. labels May 17, 2023
@LouisGariepy
Copy link
Member

@jacobsvante I didn't add chrono support originally because of the whole unsoundness debacle. I tried to not include crates with serious known vulnerabilities.

This has been fixed in version 4.20, but only if you disable default features and don't enable the oldtime feature. The sound implementation will be the default in a future 0.5.0 release chronotope/chrono#970.

In any case, disregarding the soundness issues, this will probably be actionable via the new codegen architecture #211.

@jacobsvante
Copy link
Contributor Author

Okay, sounds good 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Dependency versions, features and changes. feature New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants