19 lines
313 B
Go
19 lines
313 B
Go
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")
|
|
}
|