@@ -246,7 +246,7 @@ func (rows *Rows) Scan(dest ...interface{}) (err error) {
|
|||||||
rows.Fatal(err)
|
rows.Fatal(err)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
rows.Fatal(errors.New("Unknown type"))
|
rows.Fatal(fmt.Errorf("Scan cannot decode into %T", d))
|
||||||
}
|
}
|
||||||
|
|
||||||
if vr.Err() != nil {
|
if vr.Err() != nil {
|
||||||
|
|||||||
@@ -439,6 +439,7 @@ func TestQueryRowErrors(t *testing.T) {
|
|||||||
|
|
||||||
type allTypes struct {
|
type allTypes struct {
|
||||||
i16 int16
|
i16 int16
|
||||||
|
i int
|
||||||
s string
|
s string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,6 +456,7 @@ func TestQueryRowErrors(t *testing.T) {
|
|||||||
{"SYNTAX ERROR", []interface{}{}, []interface{}{&actual.i16}, "SQLSTATE 42601"},
|
{"SYNTAX ERROR", []interface{}{}, []interface{}{&actual.i16}, "SQLSTATE 42601"},
|
||||||
{"select $1::text", []interface{}{"Jack"}, []interface{}{&actual.i16}, "Cannot decode oid 25 into int16"},
|
{"select $1::text", []interface{}{"Jack"}, []interface{}{&actual.i16}, "Cannot decode oid 25 into int16"},
|
||||||
{"select $1::int8range", []interface{}{int(705)}, []interface{}{&actual.s}, "Cannot encode int into oid 3926 - int must implement Encoder or be converted to a string"},
|
{"select $1::int8range", []interface{}{int(705)}, []interface{}{&actual.s}, "Cannot encode int into oid 3926 - int must implement Encoder or be converted to a string"},
|
||||||
|
{"select 42::int4", []interface{}{}, []interface{}{&actual.i}, "Scan cannot decode into *int"},
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, tt := range tests {
|
for i, tt := range tests {
|
||||||
|
|||||||
Reference in New Issue
Block a user