bserr

package
v0.0.0-...-49c89df Latest Latest
Warning

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

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CodeStrings

func CodeStrings() []string

CodeStrings returns a slice of all String values of the enum

Types

type Code

type Code uint32

Code is a sql driver independent error code, used to determine the type of the error.

const (
	// OK is returned when there is no error.
	OK Code = 0

	// NotFound is returned when a row is not found.
	NotFound Code = 1

	// UniqueViolation is returned when a unique constraint is violated.
	UniqueViolation Code = 2

	// TableNotFound is returned when a table is not found.
	TableNotFound Code = 3

	// DataException is returned when a data exception is detected.
	DataException Code = 4

	// ConcurrentUpdate is returned when a concurrent update is detected.
	ConcurrentUpdate Code = 5

	// AuthenticationFailed is returned when authentication failed.
	AuthenticationFailed Code = 6

	// InternalError is returned when an internal error occurred.
	InternalError Code = 7

	// ForeignKeyViolation is returned when a foreign key constraint is violated.
	ForeignKeyViolation Code = 8

	// ConstraintViolation is returned when a not null, check or exclusion constraint is violated.
	// It is not used for unique or foreign key constraints.
	ConstraintViolation Code = 9

	// InvalidInputSyntax is returned when an invalid input syntax is detected.
	InvalidInputSyntax Code = 10

	// PermissionDenied is returned when authorization failed.
	PermissionDenied Code = 11

	// OutOfDisk is returned when the disk is full.
	OutOfDisk Code = 12

	// OutOfMemory is returned when the memory is full.
	OutOfMemory Code = 13

	// TooManyConnections is returned when the maximum number of connections is reached.
	TooManyConnections Code = 14

	// TxDone is returned when the transaction is already closed.
	TxDone Code = 15

	// Timeout is returned when the query timed out.
	Timeout Code = 16

	// Unknown is returned when the error is unknown.
	Unknown Code = 17
)

func CodeString

func CodeString(s string) (Code, error)

CodeString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func CodeValues

func CodeValues() []Code

CodeValues returns all values of the enum

func (Code) IsACode

func (i Code) IsACode() bool

IsACode returns "true" if the value is listed in the enum definition. "false" otherwise

func (Code) MarshalText

func (i Code) MarshalText() ([]byte, error)

MarshalText implements the encoding.TextMarshaler interface for Code

func (Code) String

func (i Code) String() string

func (*Code) UnmarshalText

func (i *Code) UnmarshalText(text []byte) error

UnmarshalText implements the encoding.TextUnmarshaler interface for Code

Jump to

Keyboard shortcuts

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