db

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBx

type DBx struct {
	*sql.DB
	// contains filtered or unexported fields
}

func Init

func Init(cfg *config.DB, pm *metrics.Storage) (*DBx, error)

func (*DBx) QueryContext

func (db *DBx) QueryContext(ctx context.Context, query string, args ...any) (*sql.Rows, error)

type StatsCollector

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

func NewStatsCollector

func NewStatsCollector(dbName string, sg StatsGetter) *StatsCollector

func (StatsCollector) Collect

func (c StatsCollector) Collect(ch chan<- prometheus.Metric)

func (StatsCollector) Describe

func (c StatsCollector) Describe(ch chan<- *prometheus.Desc)

type StatsGetter

type StatsGetter interface {
	Stats() sql.DBStats
}

StatsGetter is an interface that gets sql.DBStats. It's implemented by e.g. *sql.DB or *sqlx.DB.

Jump to

Keyboard shortcuts

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