dberrors

package
v1.14.2 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: BSD-3-Clause Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrType

type ErrType int

ErrType describes one among possible DB-related errors

const (
	DoesNotExist ErrType = iota
	AlreadyExists
	IntegrityConstraintViolation
	InvalidInput
	Other
)

enumerate all recognized db errors

type Interpreter

type Interpreter struct {
	Analyzer   func(error) ErrType
	ErrFactory func(error, ErrType) error
}

Interpreter generates standard errors using two components: - an Analyzer, which is specific to a given DB (postgres, mysql, ...) - an ErrFactory, which generates a standard error from the ErrType output by the Analyzer

func (Interpreter) Interpret

func (i Interpreter) Interpret(err error) error

Interpret converts an error from a specific db library into a different error type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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