db_err

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2022 License: GPL-3.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NotFound = DBErrType{
		Code: 404200,
		Name: "db_not_found",
	}

	IntegrityConstraintViolation = DBErrType{
		Code: 500200,
		Name: "db_integrity_constraint_violation",
	}

	RestrictViolation = DBErrType{
		Code: 500201,
		Name: "db_restrict_violation",
	}

	NotNullViolation = DBErrType{
		Code: 500202,
		Name: "db_not_null_violation",
	}

	ForeignKeyViolation = DBErrType{
		Code: 500203,
		Name: "db_foreign_key_violation",
	}

	UniqueViolation = DBErrType{
		Code: 500204,
		Name: "db_unique_violation",
	}

	CheckViolation = DBErrType{
		Code: 500205,
		Name: "db_check_violation",
	}

	ExclusionViolation = DBErrType{
		Code: 500206,
		Name: "db_exclusion_violation",
	}

	OperatorIntervention = DBErrType{
		Code: 500207,
		Name: "db_operator_intervention",
	}

	TransactionIntegrityConstraintViolation = DBErrType{
		Code: 500208,
		Name: "db_transaction_integrity_constraint_violation",
	}

	TransactionRollback = DBErrType{
		Code: 503200,
		Name: "db_transaction_rollback",
	}

	SerializationFailure = DBErrType{
		Code: 503201,
		Name: "db_serialization_failure",
	}

	DeadLockDetected = DBErrType{
		Code: 503202,
		Name: "db_deadlock_detected",
	}

	QueryCanceled = DBErrType{
		Code: 503203,
		Name: "db_query_canceled",
	}

	Conflict = DBErrType{
		Code: 409200,
		Name: "db_conflict",
	}
)

Functions

func Wrap

func Wrap(err error) error

Types

type DBErr

type DBErr struct {
	Code    int
	Name    string
	Message string
	Payload any
}

func (*DBErr) Error

func (d *DBErr) Error() string

func (*DBErr) ToHttpError added in v0.4.1

func (d *DBErr) ToHttpError() *http_err.ResponseError

func (*DBErr) Unwrap

func (d *DBErr) Unwrap() error

type DBErrType

type DBErrType struct {
	Code int
	Name string
}

func (DBErrType) Is

func (D DBErrType) Is(err error) bool

Jump to

Keyboard shortcuts

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