Help us shape the future of Go! Take the 2026 Go Developer Survey

mysql

package
v0.9.82 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mysql

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

func Open

func Open(ctx context.Context, masterDSN string, slaveDSN string, opts ...Option) (*Mysql, error)

func (*Mysql) IsDuplicateKeyError

func (w *Mysql) IsDuplicateKeyError(err error) bool

func (*Mysql) IsNotFoundError

func (w *Mysql) IsNotFoundError(err error) bool

func (*Mysql) Master

func (w *Mysql) Master() *gorm.DB

func (*Mysql) Ping

func (w *Mysql) Ping(ctx context.Context) error

func (*Mysql) Shutdown

func (w *Mysql) Shutdown(ctx context.Context) error

func (*Mysql) Slave

func (w *Mysql) Slave() *gorm.DB

type Option

type Option func(w *Mysql)

func WithConnMaxIdleTime

func WithConnMaxIdleTime(d time.Duration) Option

func WithConnMaxLifetime

func WithConnMaxLifetime(d time.Duration) Option

func WithConnectRetryBackoff

func WithConnectRetryBackoff(initial time.Duration, max time.Duration) Option

func WithConnectRetryTimeout

func WithConnectRetryTimeout(timeout time.Duration) Option

func WithLogger

func WithLogger(logger *slog.Logger) Option

func WithMaxIdleConns

func WithMaxIdleConns(n int) Option

func WithMaxOpenConns

func WithMaxOpenConns(n int) Option

func WithQueryLogging

func WithQueryLogging(do bool) Option

func WithQueryTimeout

func WithQueryTimeout(timeout time.Duration) Option

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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