db

package
v1.2.1-0...-f94cca8 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DriverMysql = "mysql"
	DriverNone  = ""
)
View Source
const (
	RemovedPassword = "[removed]"

	DeadlockDBErrorMessage = "Deadlock found when trying to get lock; try restarting transaction"
	TimeoutDBErrorMessage  = "Lock wait timeout exceeded; try restarting transaction"
)

Variables

This section is empty.

Functions

func ErrIsDuplicateEntryError

func ErrIsDuplicateEntryError(err error) bool

func ErrIsLockError

func ErrIsLockError(err error) bool

Types

type Conn

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

Conn is a wrapper around a dbr connection and a health stream

func New

func New(stream *health.Stream, conf cfg.DB, ro bool) (*Conn, error)

New creates a new DB for the given config

func (*Conn) Close

func (c *Conn) Close(context.Context) error

func (*Conn) NewSession

func (c *Conn) NewSession(name string, timeout time.Duration) (*dbr.Session, error)

func (*Conn) NewSessionForEventReceiver

func (c *Conn) NewSessionForEventReceiver(er health.EventReceiver) *dbr.Session

func (*Conn) SetConnMaxIdleTime

func (c *Conn) SetConnMaxIdleTime(d time.Duration)

func (*Conn) SetConnMaxLifetime

func (c *Conn) SetConnMaxLifetime(d time.Duration)

func (*Conn) SetMaxIdleConns

func (c *Conn) SetMaxIdleConns(n int)

func (*Conn) SetMaxOpenConns

func (c *Conn) SetMaxOpenConns(n int)

Jump to

Keyboard shortcuts

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