Open elonnzhang opened 1 month ago
This update enhances the codebase by adding Jiabin Zhang as a contributor in the AUTHORS
file, recognizing their contributions to the project. Additionally, a new reflection type, scanTypeNullUInt
, is introduced in fields.go
to improve the handling of unsigned integer types in MySQL fields. The scanType
method in the mysqlField
struct is modified to ensure better type safety during the processing of these unsigned integers.
Files | Change Summary |
---|---|
AUTHORS |
Added Jiabin Zhang's name and email address to the authors list. |
fields.go |
Introduced scanTypeNullUInt for sql.Null[uint64]{} ; modified scanType method to handle unsigned integers. |
🐇 In fields of code where rabbits play,
New authors join, hip-hip-hooray!
With types anew, we hop with glee,
Reflecting all our unity!
A project blooms, together we thrive,
In every line, our spirit's alive! 🌼✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
We don't drop Go 1.21 support yet. So we can not use sql.Null without dirty build tag hacks.
We don't drop Go 1.21 support yet. So we can not use sql.Null without dirty build tag hacks.
ok,i just notice sql.Null introduced in 1.22
We don't drop Go 1.21 support yet. So we can not use sql.Null without dirty build tag hacks.
Can we use sql.NullString to temporarily support all supported version avoid this problem (out of range) until we support minimum version is go 1.22?
I prefer 1 breaking change over 2 breaking changes.
Description
when i use gorm scan sql rows to map[string]any, i got an error (out of range). gorm scan
sql.Rows
tomap[string]any
byScanRows
there has three step:in step 2, when occur number(tiny int short long longlong )null column, this type will be all set to
scanTypeNullInt
,tiny int short long type will be ok, its Maximum value will not out of range int64 but unsigned longlong may be out of range. int64:-9223372036854775808 ~9223372036854775807, uint64:0 ~ 18446744073709551615
a uint64 assign to NullInt64 will be out of range, because the value store into int64
so to fix it
Must add a new scan type NullUint64 to represent unsigned bigint null column. and though flag to judge unsigned or not.
Dur to
database/sql
support generics Null[T] type, it will be easy to support NullUint64.Reproduce the problem
table example
code
Env
Error log
Checklist
Summary by CodeRabbit
Documentation
AUTHORS
file to include Jiabin Zhang as a contributor.Enhancements