connection

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2026 License: MIT Imports: 9 Imported by: 1 module, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Limiter

type Limiter struct {
	dbClient.Client
	// contains filtered or unexported fields
}

Limiter implements a circuit breaker pattern for database connections. It tracks consecutive errors and blocks requests for a duration when the error limit is reached. After the duration, it allows requests again.

func NewLimiter

func NewLimiter(client dbClient.Client, limit int64, duration time.Duration) *Limiter

func (*Limiter) Close

func (l *Limiter) Close() error

func (*Limiter) Driver

func (l *Limiter) Driver() dbClient.Driver

func (*Limiter) Exec

func (l *Limiter) Exec(s string, i ...interface{}) (sql.Result, error)

func (*Limiter) ExecContext

func (l *Limiter) ExecContext(ctx context.Context, s string, i ...interface{}) (sql.Result, error)

func (*Limiter) Query

func (l *Limiter) Query(s string, i ...interface{}) (*sql.Rows, error)

func (*Limiter) QueryContext

func (l *Limiter) QueryContext(ctx context.Context, s string, i ...interface{}) (*sql.Rows, error)

func (*Limiter) QueryRow

func (l *Limiter) QueryRow(s string, i ...interface{}) *sql.Row

func (*Limiter) QueryRowContext

func (l *Limiter) QueryRowContext(ctx context.Context, s string, i ...interface{}) *sql.Row

func (*Limiter) SQL

func (l *Limiter) SQL() *sql.DB

Jump to

Keyboard shortcuts

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