rotator

package module
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

README

rotator Go Reference

Helper database driver for databases that use credential rotation

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterRotationDriver

func RegisterRotationDriver(opt Opt)

RegisterRotationDriver registers the custom driver with defined opt

Types

type Fetcher

type Fetcher interface {
	// Fetch should returns the database datasource name / error
	Fetch(ctx context.Context) (dsn string, err error)
}

Fetcher interface helps you to fetch the database datasource name fetcher

type FetcherFunc

type FetcherFunc func(ctx context.Context) (dsn string, err error)

FetcherFunc is a single function form of Fetcher

func (FetcherFunc) Fetch

func (f FetcherFunc) Fetch(ctx context.Context) (dsn string, err error)

type Opt

type Opt struct {
	// MaxRetry is used for defining how many times the fetcher will be retried
	MaxRetry int

	// DriverName is used for identifying the custom drivfer
	DriverName string

	// DriverBase is used for opening the database connection
	DriverBase driver.Driver

	// Fetcher is used for fetching the database datasource name
	Fetcher Fetcher
}

Opt is used for registering a new driver

Jump to

Keyboard shortcuts

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