feat(database/gdb): support to Scan field type value to pointer of basic or slice types#4716
Open
wanghaolong613 wants to merge 1 commit intogogf:masterfrom
Open
feat(database/gdb): support to Scan field type value to pointer of basic or slice types#4716wanghaolong613 wants to merge 1 commit intogogf:masterfrom
wanghaolong613 wants to merge 1 commit intogogf:masterfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds support for scanning query results directly into pointers to basic types and into slices of basic/pointer element types, addressing gf issue #3977.
Changes:
- Extend
Model.Scanto support scanning single-field results into basic types (and scanner-backed types) without struct mapping. - Improve
gconv.Converter.Scanslice handling to populate pointer elements. - Add MySQL issue test data and a regression test covering pointer/basic/slice scan scenarios.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| util/gconv/internal/converter/converter_scan.go | Enhances slice element scanning to support pointer element allocation/dereference. |
| util/gconv/internal/converter/converter_bool.go | Adds handling for reflect.Value inputs to Bool conversion. |
| database/gdb/gdb_model_select.go | Extends Model.Scan to route single-field scans into basic/scanner types. |
| contrib/drivers/mysql/testdata/issues/3977.sql | Adds schema/data fixture for issue #3977 regression tests. |
| contrib/drivers/mysql/mysql_z_unit_issue_test.go | Adds regression tests covering Scan into basic/pointer/slice and decimal/scanner types. |
| contrib/drivers/mysql/go.mod | Adds shopspring/decimal dependency for the new test. |
| contrib/drivers/mysql/go.sum | Records checksums for the added dependency. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…sic or slice types
3b14cc2 to
ecfbd9e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
fix: #3977
Scan 支持将查询的结果直接反序列化至指定变量