Skip to content

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
wanghaolong613:feature/sql-scan
Open

feat(database/gdb): support to Scan field type value to pointer of basic or slice types#4716
wanghaolong613 wants to merge 1 commit intogogf:masterfrom
wanghaolong613:feature/sql-scan

Conversation

@wanghaolong613
Copy link
Contributor

@wanghaolong613 wanghaolong613 commented Feb 28, 2026

fix: #3977
Scan 支持将查询的结果直接反序列化至指定变量

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.Scan to support scanning single-field results into basic types (and scanner-backed types) without struct mapping.
  • Improve gconv.Converter.Scan slice 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.

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.

database/gdb: Scan, Array, Value deserialization enhancement

2 participants