forked from mirror/gorm
Merge pull request #422 from macropodhq/relay-scanner-errors
scanner.Scan() can fail, so the error should be forwarded
This commit is contained in:
commit
faae729b20
8
field.go
8
field.go
|
@ -27,9 +27,13 @@ func (field *Field) Set(value interface{}) error {
|
||||||
|
|
||||||
if scanner, ok := field.Field.Addr().Interface().(sql.Scanner); ok {
|
if scanner, ok := field.Field.Addr().Interface().(sql.Scanner); ok {
|
||||||
if v, ok := value.(reflect.Value); ok {
|
if v, ok := value.(reflect.Value); ok {
|
||||||
scanner.Scan(v.Interface())
|
if err := scanner.Scan(v.Interface()); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
scanner.Scan(value)
|
if err := scanner.Scan(value); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
reflectValue, ok := value.(reflect.Value)
|
reflectValue, ok := value.(reflect.Value)
|
||||||
|
|
Loading…
Reference in New Issue