Skip to content
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

Add json(nullable) macro attribute #3677

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

seanaye
Copy link

@seanaye seanaye commented Jan 10, 2025

Does your PR solve an issue?

fixes #2849

This MR introduces a #[sqlx(json(nullable))] attribute which allows for the correct behaviour on

#[derive(Serialize, Deserialize)]
enum Foo {
  Bar,
  Baz
}

struct Test {
  #[sqlx(json(nullable))]
  hello: Option<Foo>
}

by allowing the underlying row value to be null

@seanaye seanaye changed the title Add json(optional) macro attribute Add json(nullable) macro attribute Jan 10, 2025
@seanaye seanaye marked this pull request as ready for review January 10, 2025 03:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

#[sqlx(json)] does not support nullable values
1 participant