init
This commit is contained in:
commit
b15b95781c
108 changed files with 14802 additions and 0 deletions
19
internal/db/errors.go
Normal file
19
internal/db/errors.go
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
package db
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrNotFound = errors.New("record not found")
|
||||
ErrConflict = errors.New("record conflict")
|
||||
)
|
||||
|
||||
func isUniqueConstraintError(err error) bool {
|
||||
if err == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
return strings.Contains(strings.ToLower(err.Error()), "unique constraint failed")
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue