Skip to content

Commit 4a5269c

Browse files
author
elonnzhang
committed
use type sql.NullString support uint64, avoid out of range int64, because sql.Null introduce in go1.22
1 parent 11f9287 commit 4a5269c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: fields.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ var (
128128
scanTypeInt64 = reflect.TypeOf(int64(0))
129129
scanTypeNullFloat = reflect.TypeOf(sql.NullFloat64{})
130130
scanTypeNullInt = reflect.TypeOf(sql.NullInt64{})
131-
scanTypeNullUInt = reflect.TypeOf(sql.Null[uint64]{})
131+
scanTypeNullUint = reflect.TypeOf(sql.NullString{}) // reflect.TypeOf(sql.Null[uint64]{}) // support in go 1.22
132132
scanTypeNullTime = reflect.TypeOf(sql.NullTime{})
133133
scanTypeUint8 = reflect.TypeOf(uint8(0))
134134
scanTypeUint16 = reflect.TypeOf(uint16(0))
@@ -187,7 +187,7 @@ func (mf *mysqlField) scanType() reflect.Type {
187187
return scanTypeInt64
188188
}
189189
if mf.flags&flagUnsigned != 0 {
190-
return scanTypeNullUInt
190+
return scanTypeNullUint
191191
}
192192
return scanTypeNullInt
193193

0 commit comments

Comments
 (0)