Documentation ¶
Index ¶
- Variables
- func ConnectToDB(ctx ftp_context.Context)
- type DBPoolStruct
- func (dbp *DBPoolStruct) GetConn(ctx ftp_context.Context) *pgx.Conn
- func (dbp *DBPoolStruct) KillConns(ctx ftp_context.Context, i int)
- func (dbp *DBPoolStruct) Len() int
- func (dbp *DBPoolStruct) PopulateConns(ctx ftp_context.Context, i int)
- func (dbp *DBPoolStruct) Return(pc *pgx.Conn, ctx ftp_context.Context)
- func (dbp *DBPoolStruct) SignalConnLost(pc *pgx.Conn)
Constants ¶
This section is empty.
Variables ¶
View Source
var DB = &db_access.Queries{}
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)
Click to show internal directories.
Click to hide internal directories.