You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would actually be really useful to have access to the format_description module. I am working with protobuf and it has no native Date format.
I can think of some ways to circumvent this:
I could create custom messages which I could then parse for every incoming request
Add the time crate separately to the project and then use the format_description module
Let the DBMS manage the conversion from string to Date
But to be honest I would like to:
Avoid creating custom messages for the Date and Timestamp types as this just increases the API complexity
Avoid managing the versions of the time feature of sqlx and the additional time dependency
Manage the parsing inside of Rust
In general, I think that it is not that uncommon to add a Date or Timestamp which is only available as a string to the database.
Prefered solution
Re-export the format_description module.
Is this a breaking change? Why or why not?
No, as it does not change any structures, functions, methods or traits but rather extends the time crate with additional (and arguably necessary) parsing functionalities.
The text was updated successfully, but these errors were encountered:
Sorry, but the answer is still no. The sqlx crate is not intended to be a one-stop shop. The re-exports exist mainly for the macros (for the types to exist at a known path whether or not the time crate is explicitly added as a dependency) and documentation purposes.
It is not that hard to add time as a dependency. Specify a compatible version number and cargo update will take care of the rest:
# You should also enable the features you're actually usingtime = { version = "0.3", features = ["formatting", "parsing", "macros"] }
This also gives you access to anything else in the time crate you might need down the road.
If/when time 0.4 or 1.0.0 comes out, that will also involve a major release for SQLx. It won't just break out of nowhere unless you have something like sqlx = "*".
I have found these related issues/pull requests
Relates to #1851.
Description
It would actually be really useful to have access to the format_description module. I am working with protobuf and it has no native Date format.
I can think of some ways to circumvent this:
But to be honest I would like to:
In general, I think that it is not that uncommon to add a Date or Timestamp which is only available as a string to the database.
Prefered solution
Re-export the format_description module.
Is this a breaking change? Why or why not?
No, as it does not change any structures, functions, methods or traits but rather extends the time crate with additional (and arguably necessary) parsing functionalities.
The text was updated successfully, but these errors were encountered: