db

package
v3.0.0-...-5669fa1 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: GPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DBPool = NewDBPool()
View Source
var Logger = logging.Logger

Functions

func ConnectToDB

func ConnectToDB(ctx ftp_context.Context)

Types

type DBPoolStruct

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

func NewDBPool

func NewDBPool() (dbp *DBPoolStruct)

func (*DBPoolStruct) GetConn

func (dbp *DBPoolStruct) GetConn(ctx ftp_context.Context) *pgx.Conn

panics if connection is closed checks if connection is nil makes 3 reconnect attempts in 3mins

func (*DBPoolStruct) KillConns

func (dbp *DBPoolStruct) KillConns(ctx ftp_context.Context, i int)

func (*DBPoolStruct) Len

func (dbp *DBPoolStruct) Len() int

func (*DBPoolStruct) PopulateConns

func (dbp *DBPoolStruct) PopulateConns(ctx ftp_context.Context, i int)

func (*DBPoolStruct) Return

func (dbp *DBPoolStruct) Return(pc *pgx.Conn, ctx ftp_context.Context)

returns a connection to the connection pool if connection is nill or closed it retries to connect 3x

func (*DBPoolStruct) SignalConnLost

func (dbp *DBPoolStruct) SignalConnLost(pc *pgx.Conn)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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