2
0

Use github.com/pkg/errors

This commit is contained in:
Jack Christensen
2017-06-04 21:30:03 -05:00
parent 3ea41e6972
commit 8f4178b3d3
86 changed files with 639 additions and 597 deletions
+5 -5
View File
@@ -3,9 +3,9 @@ package pgtype
import (
"database/sql/driver"
"encoding/binary"
"fmt"
"github.com/jackc/pgx/pgio"
"github.com/pkg/errors"
)
type Float4Array struct {
@@ -40,7 +40,7 @@ func (dst *Float4Array) Set(src interface{}) error {
if originalSrc, ok := underlyingSliceType(src); ok {
return dst.Set(originalSrc)
}
return fmt.Errorf("cannot convert %v to Float4", value)
return errors.Errorf("cannot convert %v to Float4", value)
}
return nil
@@ -80,7 +80,7 @@ func (src *Float4Array) AssignTo(dst interface{}) error {
return NullAssignTo(dst)
}
return fmt.Errorf("cannot decode %v into %T", src, dst)
return errors.Errorf("cannot decode %v into %T", src, dst)
}
func (dst *Float4Array) DecodeText(ci *ConnInfo, src []byte) error {
@@ -233,7 +233,7 @@ func (src *Float4Array) EncodeBinary(ci *ConnInfo, buf []byte) ([]byte, error) {
if dt, ok := ci.DataTypeForName("float4"); ok {
arrayHeader.ElementOID = int32(dt.OID)
} else {
return nil, fmt.Errorf("unable to find oid for type name %v", "float4")
return nil, errors.Errorf("unable to find oid for type name %v", "float4")
}
for i := range src.Elements {
@@ -277,7 +277,7 @@ func (dst *Float4Array) Scan(src interface{}) error {
return dst.DecodeText(nil, srcCopy)
}
return fmt.Errorf("cannot scan %T", src)
return errors.Errorf("cannot scan %T", src)
}
// Value implements the database/sql/driver Valuer interface.