Documentation ¶
Index ¶
Constants ¶
View Source
const ( // FetcherDefaultMaxRetry defined the least retry number FetcherDefaultMaxRetry int = 2 )
Variables ¶
This section is empty.
Functions ¶
func RegisterRotationDriver ¶
func RegisterRotationDriver(opt Opt)
RegisterRotationDriver registers the custom driver with the given opt. RegisterRotationDriver may trigger panic if the given opt is invalid
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 ¶
FetcherFunc is a single function form of Fetcher
type Opt ¶
type Opt struct { // MaxRetry is used for defining how many times the fetcher will be retried // if there something wrong when fetching / re-open the connection. // If MaxRetry is less than FetcherDefaultMaxRetry, Opt will use FetcherDefaultMaxRetry instead. MaxRetry int // DriverName is used for identifying the custom driver 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
Click to show internal directories.
Click to hide internal directories.