mysql

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMysql

func NewMysql(opts ...DBConfigOption) (*sql.DB, func(), error)

Types

type DBConfig

type DBConfig struct {
	Host   string `json:"host" yaml:"host" env:"DEFAULT_MYSQL_HOST"`
	Port   uint32 `json:"port" yaml:"port" env:"DEFAULT_MYSQL_PORT"`
	User   string `json:"user" yaml:"user" env:"DEFAULT_MYSQL_USER"`
	Pass   string `json:"pass" yaml:"pass" env:"DEFAULT_MYSQL_PASS"`
	DBName string `json:"db_name" yaml:"dbName" env:"DEFAULT_MYSQL_DB_NAME"`

	ConnMaxIdleTime uint32 `json:"conn_max_idle_time" yaml:"connMaxIdleTime" env:"DEFAULT_MYSQL_CONN_MAX_IDLE_TIME"`
	ConnMaxLifetime uint32 `json:"conn_max_lifetime" yaml:"connMaxLifetime" env:"DEFAULT_MYSQL_CONN_MAX_LIFETIME"`
	MaxIdleConns    uint32 `json:"max_idle_conns" yaml:"maxIdleConns" env:"DEFAULT_MYSQL_MAX_IDLE_CONNS"`
	MaxOpenConns    uint32 `json:"max_open_conns" yaml:"maxOpenConns" env:"DEFAULT_MYSQL_MAX_OPEN_CONNS"`

	TracerProvider trace.TracerProvider `json:"-"`
	MeterProvider  metric.MeterProvider `json:"-"`
}

type DBConfigOption

type DBConfigOption func(c *DBConfig)

Jump to

Keyboard shortcuts

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