mehpg

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 6 Imported by: 12

Documentation

Overview

Package mehpg provides error functionality regarding postgres-errors.

Index

Constants

View Source
const (
	ErrCodePrefixDataException                  = "22"
	ErrCodePrefixIntegrityConstraintViolation   = "23"
	ErrCodePrefixSyntaxErrOrAccessRuleViolation = "42"
)

Prefixes for PostgreSQL error codes.

See: https://www.postgresql.org/docs/13/errcodes-appendix.html.

Variables

This section is empty.

Functions

func NewQueryAndScanRowsErr added in v1.8.0

func NewQueryAndScanRowsErr(err error, message string, query string) error

NewQueryAndScanRowsErr is used for errors returned from QueryRow with Scan. Further logic might be added in the future.

func NewQueryDBErr

func NewQueryDBErr(err error, message string, query string, args ...any) error

NewQueryDBErr creates a new meh.Error with the given error and message and sets a field in details to the provided query. If the error is related to constraint violation or data exceptions, a meh.ErrBadInput will be returned. Otherwise, meh.ErrInternal.

func NewScanRowsErr

func NewScanRowsErr(err error, message string, query string, args ...any) error

NewScanRowsErr creates a new meh.ErrInternal with the given error and message and saves the provided query to details. The used logic is currently the same as NewQueryDBErr but placed in a separate method for future adjustments.

Types

This section is empty.

Jump to

Keyboard shortcuts

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