scanner.Scan() can fail, so the error should be forwarded

This commit is contained in:
deoxxa 2015-03-16 11:22:31 +11:00
parent df33db6ff9
commit e77fbed442
1 changed files with 6 additions and 2 deletions

View File

@ -27,9 +27,13 @@ func (field *Field) Set(value interface{}) error {
if scanner, ok := field.Field.Addr().Interface().(sql.Scanner); ok {
if v, ok := value.(reflect.Value); ok {
scanner.Scan(v.Interface())
if err := scanner.Scan(v.Interface()); err != nil {
return err
}
} else {
scanner.Scan(value)
if err := scanner.Scan(value); err != nil {
return err
}
}
} else {
reflectValue, ok := value.(reflect.Value)