Skip to content

Commit

Permalink
use type sql.NullString support uint64, avoid out of range int64, bec…
Browse files Browse the repository at this point in the history
…ause sql.Null introduce in go1.22
  • Loading branch information
elonnzhang committed Jul 29, 2024
1 parent 11f9287 commit 4a5269c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ var (
scanTypeInt64 = reflect.TypeOf(int64(0))
scanTypeNullFloat = reflect.TypeOf(sql.NullFloat64{})
scanTypeNullInt = reflect.TypeOf(sql.NullInt64{})
scanTypeNullUInt = reflect.TypeOf(sql.Null[uint64]{})
scanTypeNullUint = reflect.TypeOf(sql.NullString{}) // reflect.TypeOf(sql.Null[uint64]{}) // support in go 1.22
scanTypeNullTime = reflect.TypeOf(sql.NullTime{})
scanTypeUint8 = reflect.TypeOf(uint8(0))
scanTypeUint16 = reflect.TypeOf(uint16(0))
Expand Down Expand Up @@ -187,7 +187,7 @@ func (mf *mysqlField) scanType() reflect.Type {
return scanTypeInt64
}
if mf.flags&flagUnsigned != 0 {
return scanTypeNullUInt
return scanTypeNullUint
}
return scanTypeNullInt

Expand Down

0 comments on commit 4a5269c

Please sign in to comment.