Fix test failures
Add bool type alias conversion in `elemKindToPointerTypes` and `underlyingNumberType`
This commit is contained in:
committed by
Jack Christensen
parent
c1c67e4e58
commit
70a200cff4
@@ -64,6 +64,9 @@ func underlyingNumberType(val any) (any, bool) {
|
|||||||
case reflect.String:
|
case reflect.String:
|
||||||
convVal := refVal.String()
|
convVal := refVal.String()
|
||||||
return convVal, reflect.TypeOf(convVal) != refVal.Type()
|
return convVal, reflect.TypeOf(convVal) != refVal.Type()
|
||||||
|
case reflect.Bool:
|
||||||
|
convVal := refVal.Bool()
|
||||||
|
return convVal, reflect.TypeOf(convVal) != refVal.Type()
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, false
|
return nil, false
|
||||||
|
|||||||
@@ -666,6 +666,7 @@ var elemKindToPointerTypes map[reflect.Kind]reflect.Type = map[reflect.Kind]refl
|
|||||||
reflect.Float32: reflect.TypeOf(new(float32)),
|
reflect.Float32: reflect.TypeOf(new(float32)),
|
||||||
reflect.Float64: reflect.TypeOf(new(float64)),
|
reflect.Float64: reflect.TypeOf(new(float64)),
|
||||||
reflect.String: reflect.TypeOf(new(string)),
|
reflect.String: reflect.TypeOf(new(string)),
|
||||||
|
reflect.Bool: reflect.TypeOf(new(bool)),
|
||||||
}
|
}
|
||||||
|
|
||||||
type underlyingTypeScanPlan struct {
|
type underlyingTypeScanPlan struct {
|
||||||
|
|||||||
@@ -881,6 +881,7 @@ func TestEncodeTypeRename(t *testing.T) {
|
|||||||
conn.TypeMap().RegisterDefaultPgType(inUint32, "int8")
|
conn.TypeMap().RegisterDefaultPgType(inUint32, "int8")
|
||||||
conn.TypeMap().RegisterDefaultPgType(inUint64, "int8")
|
conn.TypeMap().RegisterDefaultPgType(inUint64, "int8")
|
||||||
conn.TypeMap().RegisterDefaultPgType(inString, "text")
|
conn.TypeMap().RegisterDefaultPgType(inString, "text")
|
||||||
|
conn.TypeMap().RegisterDefaultPgType(inBool, "bool")
|
||||||
|
|
||||||
err := conn.QueryRow(context.Background(), "select $1::int, $2::int, $3::int2, $4::int4, $5::int8, $6::int, $7::int, $8::int, $9::int, $10::int, $11::text, $12::bool",
|
err := conn.QueryRow(context.Background(), "select $1::int, $2::int, $3::int2, $4::int4, $5::int8, $6::int, $7::int, $8::int, $9::int, $10::int, $11::text, $12::bool",
|
||||||
inInt, inInt8, inInt16, inInt32, inInt64, inUint, inUint8, inUint16, inUint32, inUint64, inString, inBool,
|
inInt, inInt8, inInt16, inInt32, inInt64, inUint, inUint8, inUint16, inUint32, inUint64, inString, inBool,
|
||||||
|
|||||||
Reference in New Issue
Block a user