diff --git a/schema/scan.go b/schema/scan.go index 1b7f05b7..9db46cd6 100644 --- a/schema/scan.go +++ b/schema/scan.go @@ -38,8 +38,8 @@ func init() { reflect.Uint32: scanUint64, reflect.Uint64: scanUint64, reflect.Uintptr: scanUint64, - reflect.Float32: scanFloat64, - reflect.Float64: scanFloat64, + reflect.Float32: scanFloat, + reflect.Float64: scanFloat, reflect.Complex64: nil, reflect.Complex128: nil, reflect.Array: nil, @@ -214,11 +214,14 @@ func scanUint64(dest reflect.Value, src interface{}) error { } } -func scanFloat64(dest reflect.Value, src interface{}) error { +func scanFloat(dest reflect.Value, src interface{}) error { switch src := src.(type) { case nil: dest.SetFloat(0) return nil + case float32: + dest.SetFloat(float64(src)) + return nil case float64: dest.SetFloat(src) return nil