Add RowsColumnScanner support (Go 1.27+)#1773
Draft
Copilot wants to merge 3 commits into
Draft
Conversation
Copilot
AI
changed the title
[WIP] Add support for RowsColumnScanner
Add RowsColumnScanner support (Go 1.27+)
May 27, 2026
methane
reviewed
May 27, 2026
| mc *mysqlConn | ||
| rs resultSet | ||
| finish func() | ||
| currentRow []driver.Value // used by RowsColumnScanner (Go 1.27+) |
Member
There was a problem hiding this comment.
@copilot Go <1.27 で currentRow が使われていないというエラーになります。
rows_column_scanner.go を作るのをやめて、 rows.go の中で実装してください。
Go <1.27 で使われない関数があるのは気にしません。
Contributor
Author
There was a problem hiding this comment.
Fixed in the latest commit. Since driver.ScanContext only exists in Go 1.27+, rows.go now carries //go:build go1.27 and contains all rows code plus the NextRow/ScanColumn methods. A new rows_before_go127.go with //go:build !go1.27 covers pre-1.27 builds (same structure as the existing conncheck.go / conncheck_dummy.go pattern). rows_column_scanner.go has been deleted.
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.
Implements the
driver.RowsColumnScannerinterface introduced in Go 1.27, which allows drivers to scan row data directly into user-provided destinations, bypassing the intermediatedriver.Valueallocation path.Changes
rows.go(//go:build go1.27): Contains the fullmysqlRowsstruct (withcurrentRow []driver.Valuefield to cache decoded values for the current row) plus all existing row methods and the new RowsColumnScanner implementation:(*binaryRows).NextRow()/(*textRows).NextRow()— reads the next row intocurrentRow, reallocating only when column count changes (e.g. afterNextResultSet)(*mysqlRows).ScanColumn(scanCtx, i, dest)— delegates tosql.ConvertAssignwith a bounds checkrows_before_go127.go(//go:build !go1.27): Contains the originalmysqlRowsstruct and all existing row methods for pre-1.27 builds (no RowsColumnScanner support).When Go 1.27+ is used,
database/sqlautomatically prefersNextRow+ScanColumnoverNext([]driver.Value). For older Go versions, behavior is unchanged.