We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Json<T>
The Json support for postgresql only works through the usage of the Value type. The Json type when used as show in the documentation doesn't work : https://docs.rs/sqlx/latest/sqlx/types/struct.Json.html
I've checked the source and I have the feeling that the Json module is not covered by tests, it may have been broken in one refactoring.
I've made a minimal repo that repro the compiler error.
https://github.com/ElysaSrc/repro-sqlx-json-bug
["runtime-tokio","tls-rustls","postgres","chrono","migrate","uuid","json"]
rustc --version
The text was updated successfully, but these errors were encountered:
Not a bug. The query macros map JSON columns to serde_json::Value by default. You have to tell the macro to use the Json adapter using the type override syntax: https://docs.rs/sqlx/latest/sqlx/macro.query.html#force-a-differentcustom-type
serde_json::Value
Json
See this example (uses query!() but the concept is the same): https://github.com/launchbadge/sqlx/blob/main/examples/postgres/json/src/main.rs#L80
query!()
Note also that query_as!() does not currently use FromRow as stated in the docs: https://docs.rs/sqlx/latest/sqlx/macro.query_as.html
query_as!()
FromRow
Leaving this open as a documentation issue.
Sorry, something went wrong.
It is indeed working as intended when the types are set in the request. Sorry for the false bug.
No branches or pull requests
Bug Description
The Json support for postgresql only works through the usage of the Value type. The Json type when used as show in the documentation doesn't work : https://docs.rs/sqlx/latest/sqlx/types/struct.Json.html
I've checked the source and I have the feeling that the Json module is not covered by tests, it may have been broken in one refactoring.
Minimal Reproduction
I've made a minimal repo that repro the compiler error.
https://github.com/ElysaSrc/repro-sqlx-json-bug
Info
["runtime-tokio","tls-rustls","postgres","chrono","migrate","uuid","json"]
rustc --version
: rustc 1.77.0 (aedd173a2 2024-03-17)The text was updated successfully, but these errors were encountered: