postgres

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

README

postgres DB errors package

This is a fork of gmkit's errors package.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewError

func NewError(resource string, err error) error

NewError creates a new PG error from a provided error.

Types

type Err

type Err struct {
	// contains filtered or unexported fields
}

Err provides meaningful behavior to the postgres error.

func (*Err) Conflict

func (e *Err) Conflict() bool

Conflict returns where this error refers to the behavior of a resource that conflicts. At this time the conflict is determiend from a foreign key violation, but can be expanded in the future.

func (*Err) Error

func (e *Err) Error() string

Error returns the error string.

func (*Err) Exists

func (e *Err) Exists() bool

Exists returns whether this error refers to the behavior of a resource that already exists in the datastore and a violation is thrown. This will be true for a unique key violation in the PG store, but can be expanded in the future.

func (*Err) NotFound

func (e *Err) NotFound() bool

NotFound returns whether this error refers to the behavior of a resource that was not found.

Jump to

Keyboard shortcuts

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