Skip to content

Commit 8d49f7b

Browse files
committed
Add conversions for additional types in ConvertValue
ref golang/go@d7c0de9
1 parent 589314c commit 8d49f7b

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

statement.go

+10
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,16 @@ func (c converter) ConvertValue(v interface{}) (driver.Value, error) {
157157
return int64(u64), nil
158158
case reflect.Float32, reflect.Float64:
159159
return rv.Float(), nil
160+
case reflect.Bool:
161+
return rv.Bool(), nil
162+
case reflect.Slice:
163+
ek := rv.Type().Elem().Kind()
164+
if ek == reflect.Uint8 {
165+
return rv.Bytes(), nil
166+
}
167+
return nil, fmt.Errorf("unsupported type %T, a slice of %s", v, ek)
168+
case reflect.String:
169+
return rv.String(), nil
160170
}
161171
return nil, fmt.Errorf("unsupported type %T, a %s", v, rv.Kind())
162172
}

0 commit comments

Comments
 (0)