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

Fix #2204 #2213

Merged
merged 3 commits into from
Dec 31, 2024
Merged

Fix #2204 #2213

merged 3 commits into from
Dec 31, 2024

Conversation

moukoublen
Copy link
Contributor

Fix issues discussed in #2204

  1. Add the missing check in both in getSQLScanner (used in json and jsonb codecs PlanScan) and getSQLScanner (used in scanPlanSQLScanner.Scan) in case the destination value is not a pointer but it is an sql.Scanner. At the same time I left the reflection to be used only in cases where chain-following is needed. Otherwise (when the type is directly an sql.Scanner the reflection will not be used which is a performance gain.
  2. Updated scanPlanJSONToJSONUnmarshal.Scan so as not to aggressively assume that the target destination is a pointer because if it is not, it leads to panic. Followed an approach similar to what json.Unmarashal does.

@moukoublen moukoublen marked this pull request as ready for review December 30, 2024 21:12
@jackc jackc merged commit c2175fe into jackc:master Dec 31, 2024
14 checks passed
@jackc
Copy link
Owner

jackc commented Dec 31, 2024

Thanks!

@gazerro
Copy link

gazerro commented Dec 31, 2024

@moukoublen thanks so much.

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