-
-
Notifications
You must be signed in to change notification settings - Fork 523
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
Support the time crate in addition (instead of?) chrono #499
Comments
Ha, I thought I missed those PRs, but I opened this ticket before these PRs were opened. :P |
You can take my starts and finalize it, I'm busy with different stuff right now but also interested in this. |
I will, if I have the time to do so. Others are welcome to contribute :) |
The alternative might be, is it possible to fix chrono? |
According to the link and information I was provided with (see the link above): no, chrono can't be fixed. Also, they wouldn't be mutually exclusive, only in the automatic code generation but even then it can be a flag. So I think runtime is find, the only incompatibility would be seaorm-cli's generation which is not a compatibility problem. |
Yeah I agree. We should go down the route of supporting both "together" (without being mutually exclusive). |
That's great for longer term, but even just having things work when I manually set a time object as a seaorm field would go a very long way. We can't do it (without a wrapper type) because the trait and time are both external to trait. So just built in conversion definitions in searorm is all we need. |
So, we'll keep all existing type aliases untouched. Lines 18 to 37 in 0a26dee
Then, we'll add // Existing alias
#[cfg(feature = "with-chrono")]
pub use chrono::NaiveDateTime as DateTime;
// New alias
#[cfg(feature = "with-chrono")]
pub use chrono::NaiveDateTime as ChronoDateTime;
// New alias
#[cfg(feature = "with-time")]
pub use time::PrimitiveDateTime as TimeDateTime; |
That's fine, I don't think there's a problem with this. Let people choose what they want to use. The main thing though is that I can't even reimplement it in our own project because I can't add the necessary traits on |
Hey @tasn, I'll open a PR and implement the supports for |
Thanks a lot @billy1624! 🙏🏻 |
Yay, thanks a lot! |
Hey, while its nice that this got into the new release it would be helpful to add a flag to the code generator to specify if it should generate for |
Good suggestions! @cemoktra Would you mind opening a feature request for this? |
It looks like chrono has security issues that can't be fixed. It depends on an old version of the
time
library which is good on its own anyway. Should we add support for the time crate?Is there a way for me to do it in our own code before support hits sea-orm?
More info: svix/rust-ksuid#1
The text was updated successfully, but these errors were encountered: