pg

package module
v0.0.0-...-f8e9dc7 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: BSD-3-Clause Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const (
	IntegrityConstraintViolation = "23000"
	RestrictVioloation           = "23001"
	NotNullViolation             = "23502"
	ForeignKeyViolation          = "23503"
	UniqueViolation              = "23505"
	CheckViolation               = "23514"
	ExclusionViolation           = "23P01"
	TriggerException             = "P0000"
)

Variables

This section is empty.

Functions

func As

func As(err error) (*pq.Error, bool)

func IsCode

func IsCode(err error, code string) bool

func IsForeignKeyViolation

func IsForeignKeyViolation(err error) bool

IsForeignKeyViolation can be used to test if the row to hard delete contains foreign keys references. If this error is detected, then just soft delete.

func IsUniqueViolation

func IsUniqueViolation(err error) bool

func New

func New(dsn string) *sql.DB

func NewBun

func NewBun(dsn string) *bun.DB

Types

type Option

type Option struct {
	User     string
	Password string
	Host     string
	Port     string
	Database string
	Params   Params
}

func (Option) DSN

func (o Option) DSN() string

type Params

type Params map[string]string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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