dbconn

package
v0.0.0-...-ebb372c Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConnCollection

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

ConnCollection is a collection of connections to the database. Allows managing multiple connections.

func (*ConnCollection) Close

func (c *ConnCollection) Close()

Close closes all connections in the collection.

func (*ConnCollection) Init

func (c *ConnCollection) Init(keepAlive, queryTimeout int, logr log.Logger)

Init initializes a pre-allocated connection collection.

func (*ConnCollection) PingHandler

func (c *ConnCollection) PingHandler(
	metricParams map[string]string, _ ...string,
) (any, error)

PingHandler tries to ping the database, returning 1 on success 0 on failure.

func (*ConnCollection) WithConnHandlerFunc

func (c *ConnCollection) WithConnHandlerFunc(
	handler handlers.ConnHandlerFunc,
) handlers.HandlerFunc

WithConnHandlerFunc creates a new function that creates or gets cached DB connection for the given metric parameters and calls the given handler function with the connection.

Jump to

Keyboard shortcuts

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