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

jsonb_pretty function #4254

Merged
merged 3 commits into from
Sep 13, 2024
Merged

Conversation

anna-ahmed19
Copy link
Contributor

Added th jsonb_pretty function under Issue#4216

@weiznich weiznich requested review from a team September 11, 2024 09:09
Copy link
Contributor

@guissalustiano guissalustiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening the PR!

The changes look good, I only would like to see some tests with NULL input (I explain the reason in yours other PR.

///
/// assert_eq!(r#"{
/// }"#, result);
/// # Ok(())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a test case with a None input?

/// # Ok(())
/// # }
/// ```
fn jsonb_pretty<E: JsonbOrNullableJsonb + SingleValue>(e: E) -> Text;
Copy link
Member

@weiznich weiznich Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
fn jsonb_pretty<E: JsonbOrNullableJsonb + SingleValue>(e: E) -> Text;
fn jsonb_pretty<E: JsonbOrNullableJsonb + MaybeNullableValue<Text> + SingleValue>(e: E) -> E::Out;

to correctly handle null value inputs.

See the longer explanation here how this works. (You are not expected to know this on your own, I just don't want to copy this comment everywhere)

@anna-ahmed19
Copy link
Contributor Author

Thank you for the suggestion.
I have added MaybeNullableValue<Text> and the None test.
Let me know if this is alright now.

Copy link
Contributor

@guissalustiano guissalustiano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@weiznich weiznich enabled auto-merge September 13, 2024 05:41
@weiznich weiznich added this pull request to the merge queue Sep 13, 2024
Merged via the queue into diesel-rs:master with commit 2d34564 Sep 13, 2024
48 checks passed
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.

3 participants