2
0

Register more default types and handle unknown types better

This commit is contained in:
Jack Christensen
2022-03-05 21:19:58 -06:00
parent 2831eedef3
commit 0905d1f452
2 changed files with 49 additions and 9 deletions
+6 -2
View File
@@ -30,9 +30,13 @@ func convertSimpleArgument(m *pgtype.Map, arg interface{}) (interface{}, error)
return nil, nil
}
if dv, ok := arg.(driver.Valuer); ok {
return dv.Value()
}
// All these could be handled by m.Encode below. However, that transforms the argument to a string. That could change
// the type of the argument. e.g. '42' instead of 42. So standard types are special cased.
switch arg := arg.(type) {
case driver.Valuer:
return arg.Value()
case float32:
return float64(arg), nil
case float64: