mysql

package
v0.0.0-...-fb1bee7 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DEFAULT_MYSQL_MIN_OPEN       = 3
	DEFAULT_MYSQL_MAX_OPEN       = 10
	DEFAULT_MYSQL_MIN_OPEN_LIMIT = DEFAULT_MYSQL_MIN_OPEN
	DEFAULT_MYSQL_MAX_OPEN_LIMIT = DEFAULT_MYSQL_MAX_OPEN
)
View Source
const QueryPerLimit int64 = 50

Variables

View Source
var DB *sql.DB

Functions

func InitMySQL

func InitMySQL(c *Config) (func() error, error)

Types

type Config

type Config struct {
	StartupRetryPeriod time.Duration `json:"startup_retry_period" toml:"-" mapstructure:"-"`
	StartupRetryTimes  int           `json:"startup_retry_times" toml:"-" mapstructure:"-"`
	ConnectTimeout     time.Duration `json:"connect_timeout" toml:"-" mapstructure:"-"`

	DSN         string        `json:"dsn" toml:"dsn" mapstructure:"dsn"`
	MinOpen     int           `json:"min_open" toml:"min_open" mapstructure:"min_open"`
	MaxOpen     int           `json:"max_open" toml:"max_open" mapstructure:"max_open"`
	MaxLifetime time.Duration `json:"max_lifetime" toml:"-" mapstructure:"-"`
}

func (*Config) String

func (m *Config) String() string

func (*Config) VerifyConfig

func (c *Config) VerifyConfig() error

type Exec

type Exec interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

Exec exec mysql

Jump to

Keyboard shortcuts

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