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

added jsonb_insert #4257

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

aznszn
Copy link
Contributor

@aznszn aznszn commented Sep 12, 2024

added the jsonb_insert function under #4216.

@aznszn
Copy link
Contributor Author

aznszn commented Sep 12, 2024

@weiznich

@wowinter13 wowinter13 requested a review from a team September 12, 2024 10:48
@aznszn aznszn marked this pull request as ready for review September 18, 2024 07:53
@weiznich weiznich requested review from a team and removed request for a team September 18, 2024 09:45
Copy link
Member

@weiznich weiznich 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 this PR. The tests look mostly fine, but the function signatures might need more tweaking to express all possibilities correctly.

/// # Ok(())
/// # }
/// ```
fn jsonb_insert<J: JsonbOrNullableJsonb + SingleValue, P: TextArrayOrNullableTextArray + CombinedNullableValue<J, Jsonb>>(target: J, path: P, value: J) -> P::Out;
Copy link
Member

Choose a reason for hiding this comment

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

We need to have separate generic types for the first and last argument here to allow using different types in these places. That allows us to use a column in one place and an expression in another place while calling this function. That means we won't be able to use CombineNullableValue as it is, we might need another helper trait there or some more experimentation how to combine three or four values with the existing trait.

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.

2 participants