File tree Expand file tree Collapse file tree 2 files changed +3
-9
lines changed
Expand file tree Collapse file tree 2 files changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ func ToScannerHookFunc() mapstructure.DecodeHookFunc {
134134
135135 // Call the Scan method with the data
136136 if err := scanner .Scan (scanData ); err != nil {
137- return data , err
137+ return nil , err
138138 }
139139
140140 return result .Elem ().Interface (), nil
@@ -159,7 +159,7 @@ func ToSliceHookFunc() mapstructure.DecodeHookFunc {
159159
160160 result := reflect .New (t ).Interface ()
161161 if err := json .Unmarshal ([]byte (str ), result ); err != nil {
162- return data , nil
162+ return nil , err
163163 }
164164
165165 return reflect .ValueOf (result ).Elem ().Interface (), nil
@@ -184,7 +184,7 @@ func ToMapHookFunc() mapstructure.DecodeHookFunc {
184184
185185 result := reflect .MakeMap (t ).Interface ()
186186 if err := json .Unmarshal ([]byte (str ), & result ); err != nil {
187- return data , nil
187+ return nil , err
188188 }
189189
190190 return result , nil
Original file line number Diff line number Diff line change @@ -2,7 +2,6 @@ package tests
22
33import (
44 "context"
5- "database/sql/driver"
65 "encoding/json"
76 "fmt"
87 "strconv"
@@ -763,11 +762,6 @@ type ResultData struct {
763762 }
764763}
765764
766- func (r * ResultData ) Value () (driver.Value , error ) {
767- bytes , err := json .Marshal (r )
768- return string (bytes ), err
769- }
770-
771765func (r * ResultData ) Scan (value any ) (err error ) {
772766 if data , ok := value .([]byte ); ok && len (data ) > 0 {
773767 err = json .Unmarshal (data , & r )
You can’t perform that action at this time.
0 commit comments