From 4a5269cd00707f494088f1b368fd293cb8fb4d49 Mon Sep 17 00:00:00 2001 From: elonnzhang Date: Mon, 29 Jul 2024 21:59:12 +0800 Subject: [PATCH] use type sql.NullString support uint64, avoid out of range int64, because sql.Null introduce in go1.22 --- fields.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fields.go b/fields.go index 7e4134ca..bd8757bd 100644 --- a/fields.go +++ b/fields.go @@ -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)) @@ -187,7 +187,7 @@ func (mf *mysqlField) scanType() reflect.Type { return scanTypeInt64 } if mf.flags&flagUnsigned != 0 { - return scanTypeNullUInt + return scanTypeNullUint } return scanTypeNullInt