errx

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 13, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrMissingIdentity indicates SQL generation/execution cannot proceed because
	// identity (primary key) columns were not detected.
	ErrMissingIdentity = errors.New("missing identity")

	// ErrDuplicateKey indicates an insert/update violated a unique constraint.
	// Note: many drivers return opaque error types; use IsDuplicateKey to detect.
	ErrDuplicateKey = errors.New("duplicate key")

	// ErrConstraint indicates a generic constraint violation (FK/CK/NOT NULL/etc).
	ErrConstraint = errors.New("constraint violation")
)

Functions

func Constraint

func Constraint(op, table string, cause error) error

func DuplicateKey

func DuplicateKey(op, table string, cause error) error

func IsConstraint

func IsConstraint(err error) bool

func IsDuplicateKey

func IsDuplicateKey(err error) bool

func IsMissingIdentity

func IsMissingIdentity(err error) bool

func MissingIdentity

func MissingIdentity(op, table string, columns []string, identityIndex int) error

Types

type Error

type Error struct {
	Kind          error
	Op            string
	Table         string
	Columns       []string
	IdentityIndex int
	Cause         error
}

Error carries structured context while remaining compatible with errors.Is().

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(target error) bool

func (*Error) Unwrap

func (e *Error) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL