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,10 +3,10 @@ package pgtype
import (
"database/sql/driver"
"encoding/binary"
"fmt"
"time"
"github.com/jackc/pgx/pgio"
"github.com/pkg/errors"
)
type DateArray struct {
@@ -41,7 +41,7 @@ func (dst *DateArray) Set(src interface{}) error {
if originalSrc, ok := underlyingSliceType(src); ok {
return dst.Set(originalSrc)
}
return fmt.Errorf("cannot convert %v to Date", value)
return errors.Errorf("cannot convert %v to Date", value)
}
return nil
@@ -81,7 +81,7 @@ func (src *DateArray) 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 *DateArray) DecodeText(ci *ConnInfo, src []byte) error {
@@ -234,7 +234,7 @@ func (src *DateArray) EncodeBinary(ci *ConnInfo, buf []byte) ([]byte, error) {
if dt, ok := ci.DataTypeForName("date"); ok {
arrayHeader.ElementOID = int32(dt.OID)
} else {
return nil, fmt.Errorf("unable to find oid for type name %v", "date")
return nil, errors.Errorf("unable to find oid for type name %v", "date")
}
for i := range src.Elements {
@@ -278,7 +278,7 @@ func (dst *DateArray) 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.