driver

package
v0.0.0-...-f0e227c Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const MySQL = "icinga-mysql"
View Source
const PostgreSQL = "icinga-pgsql"

Variables

This section is empty.

Functions

func Register

func Register(logger *logging.Logger, options ...Option)

Register makes our database Driver available under the name "icinga-*sql".

Types

type Driver

type Driver struct {
	Logger *logging.Logger
	// contains filtered or unexported fields
}

Driver wraps a driver.Driver that also must implement driver.DriverContext with logging capabilities and provides our RetryConnector.

func (Driver) OpenConnector

func (d Driver) OpenConnector(name string) (driver.Connector, error)

OpenConnector implements the DriverContext interface.

type Option

type Option func(*RetryConnector)

func WithOnError

func WithOnError(f retry.OnErrorFunc) Option

func WithOnSuccess

func WithOnSuccess(f retry.OnSuccessFunc) Option

type PgSQLDriver

type PgSQLDriver struct {
	pq.Driver
}

PgSQLDriver extends pq.Driver with driver.DriverContext compliance.

func (PgSQLDriver) OpenConnector

func (PgSQLDriver) OpenConnector(name string) (driver.Connector, error)

OpenConnector implements the driver.DriverContext interface.

type RetryConnector

type RetryConnector struct {
	driver.Connector
	// contains filtered or unexported fields
}

RetryConnector wraps driver.Connector with retry logic.

func (RetryConnector) Connect

func (c RetryConnector) Connect(ctx context.Context) (driver.Conn, error)

Connect implements part of the driver.Connector interface.

func (RetryConnector) Driver

func (c RetryConnector) Driver() driver.Driver

Driver implements part of the driver.Connector interface.

Jump to

Keyboard shortcuts

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