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
Adding bigdecimal::BigDecimal
as specta compatible type results in string.
#25
Comments
Chrono is officially supported (and used by Spacedrive) with the The issue you're having with the Thanks for sending that Be aware that the |
Thanks for the swift response! I've tried the |
I just added the majority of the sqlx types, exceptions are tracked in #26. The main branch isn't ready for a release yet so I will leave this issue open until these changes are published but feel free to add the following to the bottom of the [patch.crates-io]
rspc = { git = "https://github.com/oscartbeaumont/rspc.git" }
specta = { git = "https://github.com/oscartbeaumont/rspc.git" } I also changed my mind about an |
Thanks for the work! I can verify that these types work now. I think we can close this issue. |
I was using
sqlx
with MySQL through RSPC. The database is connected successfully, however there are some types that are not currently supported for examplechrono::NaiveDate
,bigdecimal::BigDecimal
. A list of whatsqlx
maps SQL types into rust types can be found here.As a workaround, I could get it working by creating another struct and manually mapping the values into the values I need, see following:
So this code above is working well and fine and produce the following JSON response:
However, since I'm learning Rust and wanted to try making
chrono::NaiveDate
andbigdecimal::BigDecimal
works by implementing therspc::internal::specta::Type
trait for it.The following shows my implementation
For
SpectaCompatibleNaiveDate
, it's working flawlessly. However forSpectaCompatibleBigDecimal
, it returned String to the client instead of a number value. Here's the JSON response being returned.The text was updated successfully, but these errors were encountered: