From 3a9095661686256911bb02365837addc70bd03b4 Mon Sep 17 00:00:00 2001 From: what Date: Sun, 30 Jul 2023 18:36:13 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E6=96=B0=E5=A2=9E=E9=94=99=E8=AF=AF?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scan.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scan.go b/scan.go index c78077b..58bbce5 100644 --- a/scan.go +++ b/scan.go @@ -4,6 +4,7 @@ import ( "database/sql" "encoding/json" "errors" + "fmt" "reflect" ) @@ -138,7 +139,7 @@ func sStructSlice(rows *sql.Rows, dest any) (result RowScan) { if data := *scanArgs[i].(*[]uint8); len(data) > 0 { v := rv.Addr().Interface() if err := json.Unmarshal(data, &v); err != nil { - panic(err) + panic(fmt.Sprintf("[%s:%q] => %s", rv.Kind(), data, err)) } } } @@ -212,7 +213,7 @@ func sStruct(rows *sql.Rows, dest any) (result RowScan) { if data := *scanArgs[i].(*[]uint8); len(data) > 0 { v := rv.Addr().Interface() if err := json.Unmarshal(data, &v); err != nil { - panic(err) + panic(fmt.Sprintf("[%s:%q] => %s", rv.Kind(), data, err)) } } }