dberr

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package dberr classifies driver-specific database errors into a small set of dialect-neutral sentinel errors that callers can match with errors.Is, without importing pgconn or the sqlite driver themselves.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUniqueViolation      = errors.New("drel: unique constraint violation")
	ErrForeignKeyViolation  = errors.New("drel: foreign key constraint violation")
	ErrNotNullViolation     = errors.New("drel: not-null constraint violation")
	ErrCheckViolation       = errors.New("drel: check constraint violation")
	ErrSerializationFailure = errors.New("drel: serialization failure (retry the transaction)")
)

Sentinel errors for common, actionable database conditions. They are matched with errors.Is; the original driver error remains available via errors.As / Unwrap.

Functions

func Classify

func Classify(err error) error

Classify returns err annotated with a sentinel kind when it represents a known constraint or serialization condition, or err unchanged otherwise. nil in, nil out.

Types

This section is empty.

Jump to

Keyboard shortcuts

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