Optional nested structs #14
Merged
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.
Merging code that fixes jmoiron/sqlx#162
This is the upstream work from multiple authors in jmoiron/sqlx#950 which makes for a much improved and intuitive experience when scanning joined tables.
There is the possibility of slight breakage with this change if client code depended on the result of the scan being non-nil for embedded structs, but pointer members is not typical usage and the likelihood of breakage is small enough to not be a serious problem.
This behavior matches expectations set by other scanning behavior where struct members are made pointers for possibly null values. Extending that behavior to struct members increases consistency.
Alternatively, we could have used omitempty tags to opt into the behavior, but this is different than other struct members that don't need a tag.