database

package
v1.3.9 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQLService

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

MySQLService manages MySQL database connections

func NewMySQLService

func NewMySQLService(cfg *config.Config) (*MySQLService, error)

NewMySQLService creates a new instance of MySQLService with advanced configurations

func (*MySQLService) Close

func (dbService *MySQLService) Close()

Close closes the database connection gracefully

func (*MySQLService) GetDB

func (dbService *MySQLService) GetDB() *sql.DB

GetDB returns the underlying *sql.DB instance

func (*MySQLService) HealthCheck

func (dbService *MySQLService) HealthCheck() error

HealthCheck performs a health check by pinging the database

func (*MySQLService) LogStats

func (dbService *MySQLService) LogStats()

LogStats logs the current connection pool statistics

type PgxDatabaseService

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

func NewPgxDatabaseService

func NewPgxDatabaseService(cfg *config.Config) (*PgxDatabaseService, error)

NewPgxDatabaseService initializes a new database service using pgxpool

func (*PgxDatabaseService) Close

func (db *PgxDatabaseService) Close()

func (*PgxDatabaseService) GetDB

func (db *PgxDatabaseService) GetDB() *pgxpool.Pool

func (*PgxDatabaseService) HealthCheck

func (db *PgxDatabaseService) HealthCheck() error

func (*PgxDatabaseService) LogStats

func (db *PgxDatabaseService) LogStats()

Jump to

Keyboard shortcuts

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