feat: add self-extractor for JSON type #4123
Open
+7
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Does your PR solve an issue?
No, but i can create one if bureaucracy is expected.
Is this a breaking change?
No. Adding a new method for already existing type is not considered a breaking change for downstream-users.
ThIs PR introduces
.into_innermethod forJson<T>type, so that users can extractTfromJson<T>, if they prefer to do so. Regarding sqlx-core types, there's already.into_innermethod in Text type, but there is none in Json type. Using.into_innermight come really handy, especially when iterating and doing.map(Json::into_inner)instead of.map(|Json(x)| x).Tests
Regarding tests and Text type, its
.into_innermethod is not found in examples / whatnot. Which is why there are no tests written -- I expected that if another type.into_inner's method does not appear in tests / examples, similar the situation should be for my change. If I'm wrong -- never hesitate to announce that :)