Use github.com/pkg/errors
This commit is contained in:
+5
-5
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user