postgres

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: May 26, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrUniqueViolation  = iota
	ErrNotNullViolation = iota
	ErrRecordNotFound   = iota
	ErrInvalidValue     = iota
	ErrOther            = iota
)

Variables

This section is empty.

Functions

func ApplyProperties

func ApplyProperties(properties *Properties) postgresOpt

func DSN

func DSN(dsn string) postgresOpt

func NewDB

func NewDB(opts ...postgresOpt) (*gorm.DB, func(), error)

func Pool

func Pool(maxOpen int, maxIdle int, maxLifetime int64, maxIdleTime int64) postgresOpt

func PrintQueries

func PrintQueries(printQueries bool) postgresOpt

Types

type Error

type Error struct {
	Err        error
	Code       int
	Constraint string
}

func TranslateError

func TranslateError(err error) *Error

func (*Error) Error

func (err *Error) Error() string

type PoolProperties

type PoolProperties struct {
	MaxOpen     int   `json:"maxOpen" yaml:"maxOpen"`
	MaxIdle     int   `json:"maxIdle" yaml:"maxIdle"`
	MaxLifetime int64 `json:"maxLifetime" yaml:"maxLifetime"`
	MaxIdleTime int64 `json:"maxIdleTime" yaml:"maxIdleTime"`
}

type Properties

type Properties struct {
	DSN          string          `json:"dsn" yaml:"dsn"`
	Pool         *PoolProperties `json:"pool" yaml:"pool"`
	PrintQueries bool            `json:"printQueries" yaml:"printQueries"`
}

Jump to

Keyboard shortcuts

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