From fb5a2a0adb17b65a2793e706c20278b74c0c155a Mon Sep 17 00:00:00 2001 From: elonnzhang Date: Fri, 26 Jul 2024 19:29:52 +0800 Subject: [PATCH 1/5] fix bigint unsigned null cloumn scan to err type int64 --- fields.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fields.go b/fields.go index be5cd809..7e4134ca 100644 --- a/fields.go +++ b/fields.go @@ -128,6 +128,7 @@ var ( 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 @@ func (mf *mysqlField) scanType() reflect.Type { } return scanTypeInt64 } + if mf.flags&flagUnsigned != 0 { + return scanTypeNullUInt + } return scanTypeNullInt case fieldTypeFloat: From 11f9287323f7249519405560407d4f5cd2b10bc0 Mon Sep 17 00:00:00 2001 From: elonnzhang Date: Fri, 26 Jul 2024 20:11:55 +0800 Subject: [PATCH 2/5] add auth --- AUTHORS | 1 + 1 file changed, 1 insertion(+) diff --git a/AUTHORS b/AUTHORS index bab66a3b..97b4a9f1 100644 --- a/AUTHORS +++ b/AUTHORS @@ -120,6 +120,7 @@ Zhang Xiang Zhenye Xie Zhixin Wen Ziheng Lyu +Jiabin Zhang # Organizations From 4a5269cd00707f494088f1b368fd293cb8fb4d49 Mon Sep 17 00:00:00 2001 From: elonnzhang Date: Mon, 29 Jul 2024 21:59:12 +0800 Subject: [PATCH 3/5] 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 From 6368cf39ae87cbf3e78691905febe5054ce2923e Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Mon, 11 Nov 2024 11:31:04 +0900 Subject: [PATCH 4/5] use sql.Null --- fields.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fields.go b/fields.go index bd8757bd..25a16628 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.NullString{}) // reflect.TypeOf(sql.Null[uint64]{}) // support in go 1.22 + scanTypeNullUint = reflect.TypeOf(sql.Null[uint64]{}) scanTypeNullTime = reflect.TypeOf(sql.NullTime{}) scanTypeUint8 = reflect.TypeOf(uint8(0)) scanTypeUint16 = reflect.TypeOf(uint16(0)) From 8006bf587039169566d79b230cc2ddd6a0ab5bce Mon Sep 17 00:00:00 2001 From: Inada Naoki Date: Mon, 21 Apr 2025 16:20:01 +0900 Subject: [PATCH 5/5] sort authors --- AUTHORS | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/AUTHORS b/AUTHORS index c5293e0f..2a978fc5 100644 --- a/AUTHORS +++ b/AUTHORS @@ -18,8 +18,8 @@ Alex Snast Alexey Palazhchenko Andrew Reid Animesh Ray -Arne Hormann Ariel Mashraki +Arne Hormann Artur Melanchyk Asta Xie B Lamarche @@ -62,6 +62,7 @@ Jeff Hodges Jeffrey Charles Jennifer Purevsuren Jerome Meyer +Jiabin Zhang Jiajia Zhong Jian Zhen Joe Mann @@ -81,10 +82,11 @@ Linh Tran Tuan Lion Yang Luca Looz Lucas Liu -Lunny Xiao Luke Scott +Lunny Xiao Maciej Zimnoch Michael Woolnough +Minh Quang Nao Yokotsuka Nathanial Murphy Nicola Peduzzi @@ -95,7 +97,6 @@ Paul Bonser Paulius Lozys Peter Schultz Phil Porada -Minh Quang Rebecca Chin Reed Allman Richard Wilkes @@ -126,7 +127,6 @@ Zhang Xiang Zhenye Xie Zhixin Wen Ziheng Lyu -Jiabin Zhang # Organizations