Skip to content

Document how to use Json<T> with the query macros #3153

@ghost

Description

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

  • SQLx version: 0.7.4
  • SQLx features enabled: ["runtime-tokio","tls-rustls","postgres","chrono","migrate","uuid","json"]
  • Database server and version: Postgres 14
  • Operating system: Nixos unstable - Linux 6.7.9
  • rustc --version: rustc 1.77.0 (aedd173a2 2024-03-17)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationmacros

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions