summaryrefslogtreecommitdiff
path: root/vendor/github.com/go-pg/pg/v10/internal/error.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/go-pg/pg/v10/internal/error.go')
-rw-r--r--vendor/github.com/go-pg/pg/v10/internal/error.go61
1 files changed, 0 insertions, 61 deletions
diff --git a/vendor/github.com/go-pg/pg/v10/internal/error.go b/vendor/github.com/go-pg/pg/v10/internal/error.go
deleted file mode 100644
index ae6524aeb..000000000
--- a/vendor/github.com/go-pg/pg/v10/internal/error.go
+++ /dev/null
@@ -1,61 +0,0 @@
-package internal
-
-import (
- "fmt"
-)
-
-var (
- ErrNoRows = Errorf("pg: no rows in result set")
- ErrMultiRows = Errorf("pg: multiple rows in result set")
-)
-
-type Error struct {
- s string
-}
-
-func Errorf(s string, args ...interface{}) Error {
- return Error{s: fmt.Sprintf(s, args...)}
-}
-
-func (err Error) Error() string {
- return err.s
-}
-
-type PGError struct {
- m map[byte]string
-}
-
-func NewPGError(m map[byte]string) PGError {
- return PGError{
- m: m,
- }
-}
-
-func (err PGError) Field(k byte) string {
- return err.m[k]
-}
-
-func (err PGError) IntegrityViolation() bool {
- switch err.Field('C') {
- case "23000", "23001", "23502", "23503", "23505", "23514", "23P01":
- return true
- default:
- return false
- }
-}
-
-func (err PGError) Error() string {
- return fmt.Sprintf("%s #%s %s",
- err.Field('S'), err.Field('C'), err.Field('M'))
-}
-
-func AssertOneRow(l int) error {
- switch {
- case l == 0:
- return ErrNoRows
- case l > 1:
- return ErrMultiRows
- default:
- return nil
- }
-}