-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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 bigint unsigned null column scan to err type int64 #1612
base: master
Are you sure you want to change the base?
Changes from all commits
fb5a2a0
11f9287
4a5269c
fdd0987
6368cf3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,7 @@ | |
scanTypeInt64 = reflect.TypeOf(int64(0)) | ||
scanTypeNullFloat = reflect.TypeOf(sql.NullFloat64{}) | ||
scanTypeNullInt = reflect.TypeOf(sql.NullInt64{}) | ||
scanTypeNullUint = reflect.TypeOf(sql.Null[uint64]{}) | ||
scanTypeNullTime = reflect.TypeOf(sql.NullTime{}) | ||
scanTypeUint8 = reflect.TypeOf(uint8(0)) | ||
scanTypeUint16 = reflect.TypeOf(uint16(0)) | ||
|
@@ -185,6 +186,9 @@ | |
} | ||
return scanTypeInt64 | ||
} | ||
if mf.flags&flagUnsigned != 0 { | ||
return scanTypeNullUint | ||
} | ||
Comment on lines
+189
to
+191
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Based on the test content examination, I can now provide a final response: Test coverage for unsigned bigint nulls is insufficient The codebase has tests for unsigned bigint (
🔗 Analysis chainVerify test coverage for unsigned bigint nulls. Let's ensure the changes are properly tested, especially for edge cases where uint64 values exceed int64 range. Let's examine the specific test content in driver_test.go since it appears in both searches. 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Search for tests involving unsigned bigint columns
echo "Searching for tests with unsigned bigint columns..."
rg -l --type go "(?i)(unsigned.*bigint|uint64.*null)" *_test.go
# Search for existing null scanning tests
echo "Searching for null scanning tests..."
rg -l --type go "(?i)(nullint|nulluint|null.*scan)" *_test.go
Length of output: 755 Script: #!/bin/bash
# Check the content of driver_test.go for unsigned bigint and null scanning tests
echo "Examining driver_test.go for unsigned bigint and null scanning tests..."
rg -A 10 -B 2 "(?i)(unsigned.*bigint|uint64.*null|nullint|nulluint|null.*scan)" driver_test.go
Length of output: 11427 |
||
return scanTypeNullInt | ||
|
||
case fieldTypeFloat: | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Breaking change: sql.Null requires Go 1.22.
As mentioned in the PR discussion, Go 1.21 support hasn't been dropped yet. Using
sql.Null[uint64]
would break compatibility with Go 1.21 and earlier versions.Consider one of these alternatives: