2
0

Use github.com/pkg/errors

This commit is contained in:
Jack Christensen
2017-06-04 21:30:03 -05:00
parent 654adbdd4a
commit a5f166bd21
65 changed files with 556 additions and 530 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 NumericArray struct {
@@ -59,7 +59,7 @@ func (dst *NumericArray) Set(src interface{}) error {
if originalSrc, ok := underlyingSliceType(src); ok {
return dst.Set(originalSrc)
}
return fmt.Errorf("cannot convert %v to Numeric", value)
return errors.Errorf("cannot convert %v to Numeric", value)
}
return nil
@@ -108,7 +108,7 @@ func (src *NumericArray) 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 *NumericArray) DecodeText(ci *ConnInfo, src []byte) error {
@@ -261,7 +261,7 @@ func (src *NumericArray) EncodeBinary(ci *ConnInfo, buf []byte) ([]byte, error)
if dt, ok := ci.DataTypeForName("numeric"); ok {
arrayHeader.ElementOID = int32(dt.OID)
} else {
return nil, fmt.Errorf("unable to find oid for type name %v", "numeric")
return nil, errors.Errorf("unable to find oid for type name %v", "numeric")
}
for i := range src.Elements {
@@ -305,7 +305,7 @@ func (dst *NumericArray) 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.