mysql

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const AddressConfigKey = "mysql-address"
View Source
const DriverName = "mysql"

Variables

This section is empty.

Functions

func Flags

func Flags() *pflag.FlagSet

Types

type MySQL

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

func New

func New(dsn string, options ...Option) (*MySQL, error)

New will connect to the MySQL server using the given DSN

func (MySQL) Close

func (m MySQL) Close() error

Close is just a proxy for convenient access to db.Close()

func (MySQL) DB

func (m MySQL) DB() *sqlx.DB

DB is just a proxy for convenient access to the underlying sqlx implementation This method is used a lot, therefore it's name is abbreviated.

func (MySQL) Migrate

func (m MySQL) Migrate(version uint) error

Migrate to a specific version. It's assumed t

func (MySQL) Options

func (m MySQL) Options() *Options

Options returns the currently set options.

type Option

type Option func(*Options)

func MaxConnectionLifetime

func MaxConnectionLifetime(maxLifetime time.Duration) Option

func MaxIdleConnections

func MaxIdleConnections(connLimit int) Option

func MaxOpenConnections

func MaxOpenConnections(connLimit int) Option

func MigrationPath

func MigrationPath(path string) Option

type Options

type Options struct {
	MigrationPath         string
	MaxOpenConnections    int
	MaxIdleConnections    int
	MaxConnectionLifetime time.Duration
}

Jump to

Keyboard shortcuts

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