mysql

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMonitorProxy

func NewMonitorProxy(options ...MonitorProxyOption) *monitorProxy

Types

type DbConfig

type DbConfig struct {
	Db          string `json:"db",yaml:"db"`
	Dsn         string `json:"dns",yaml:"dsn"`
	MaxIdle     int    `json:"max_idle",yaml:"maxidle"`
	MaxOpen     int    `json:"max_open",yaml:"maxopen"`
	MaxLifetime int    `json:"max_lifetime",yaml:"maxlifetime"`
}

type MonitorProxyOption

type MonitorProxyOption func(c *monitorProxy)

type MonitorProxyOptions

type MonitorProxyOptions struct{}

func (MonitorProxyOptions) WithConf

func (MonitorProxyOptions) WithLogger

func (MonitorProxyOptions) WithTracer

type MysqlClient

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

func NewMysqlClient

func NewMysqlClient(options ...Option) *MysqlClient

func (*MysqlClient) Close

func (this *MysqlClient) Close()

func (*MysqlClient) GetCtxDb

func (this *MysqlClient) GetCtxDb(ctx context.Context, db_name string) *gorm.DB

func (*MysqlClient) GetDb

func (this *MysqlClient) GetDb(db_name string) *gorm.DB

func (*MysqlClient) Ping

func (this *MysqlClient) Ping() []error

func (*MysqlClient) Stats

func (this *MysqlClient) Stats()

type MysqlClientOptions

type MysqlClientOptions struct{}

func (MysqlClientOptions) WithConf

func (MysqlClientOptions) WithConf(conf config.Config) Option

func (MysqlClientOptions) WithDB

func (MysqlClientOptions) WithDB(db *sql.DB) Option

func (MysqlClientOptions) WithDbConfig

func (MysqlClientOptions) WithDbConfig(dbConfigs []DbConfig) Option

func (MysqlClientOptions) WithLogger

func (MysqlClientOptions) WithLogger(logger log.Logger) Option

func (MysqlClientOptions) WithProxy

func (MysqlClientOptions) WithProxy(proxy ...func() interface{}) Option

func (MysqlClientOptions) WithStateTicker

func (MysqlClientOptions) WithStateTicker(stateTicker time.Duration) Option

type Option

type Option func(c *MysqlClient)

type SqlCommon

type SqlCommon interface {
	gorm.SQLCommon

	Begin() (*sql.Tx, error)

	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
	// contains filtered or unexported methods
}

Jump to

Keyboard shortcuts

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