[feat] 新增错误提示
This commit is contained in:
parent
5740d11240
commit
3a90956616
5
scan.go
5
scan.go
@ -4,6 +4,7 @@ import (
|
|||||||
"database/sql"
|
"database/sql"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -138,7 +139,7 @@ func sStructSlice(rows *sql.Rows, dest any) (result RowScan) {
|
|||||||
if data := *scanArgs[i].(*[]uint8); len(data) > 0 {
|
if data := *scanArgs[i].(*[]uint8); len(data) > 0 {
|
||||||
v := rv.Addr().Interface()
|
v := rv.Addr().Interface()
|
||||||
if err := json.Unmarshal(data, &v); err != nil {
|
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 {
|
if data := *scanArgs[i].(*[]uint8); len(data) > 0 {
|
||||||
v := rv.Addr().Interface()
|
v := rv.Addr().Interface()
|
||||||
if err := json.Unmarshal(data, &v); err != nil {
|
if err := json.Unmarshal(data, &v); err != nil {
|
||||||
panic(err)
|
panic(fmt.Sprintf("[%s:%q] => %s", rv.Kind(), data, err))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user