database

package
v0.0.0-...-cd49aae Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBManager

type DBManager struct {
	DSN    string
	DBs    []string
	Tables map[string][]string
	DbPool *sql.DB
}

func NewDBManager

func NewDBManager(mysqlConfig config.MySQLConfig) *DBManager

NewDBManager initializes DBManager with the provided MySQL configuration and creates a new connection pool.

func (*DBManager) Conn

func (dbm *DBManager) Conn(ctx context.Context) (*sql.Conn, error)

func (*DBManager) InitializeDatabases

func (dbm *DBManager) InitializeDatabases(cfg config.MainConfig, sysLog syslogwrapper.SyslogWrapperInterface, apiPlugin api_plugins.APIPlugin)

func (*DBManager) PingIdleConnections

func (dbm *DBManager) PingIdleConnections(sysLog syslogwrapper.SyslogWrapperInterface)

PingIdleConnections pings all idle connections in the pool to keep them healthy

type DBManagerInterface

type DBManagerInterface interface {
	Conn(ctx context.Context) (*sql.Conn, error)
}

Jump to

Keyboard shortcuts

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