mysql

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 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 Client added in v0.0.5

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

func NewClient added in v0.0.5

func NewClient(options ...Option) *Client

func (*Client) Close added in v0.0.5

func (c *Client) Close()

func (*Client) GetCtxDb added in v0.0.5

func (c *Client) GetCtxDb(ctx context.Context, dbName string) *gorm.DB

func (*Client) GetDb added in v0.0.5

func (c *Client) GetDb(dbName string) *gorm.DB

func (*Client) Ping added in v0.0.5

func (c *Client) Ping() []error

func (*Client) Stats added in v0.0.5

func (c *Client) Stats()

type ClientOptions added in v0.0.5

type ClientOptions struct{}

func (ClientOptions) WithConf added in v0.0.5

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

func (ClientOptions) WithDB added in v0.0.5

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

func (ClientOptions) WithDbConfig added in v0.0.5

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

func (ClientOptions) WithLogger added in v0.0.5

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

func (ClientOptions) WithProxy added in v0.0.5

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

func (ClientOptions) WithStateTicker added in v0.0.5

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

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 Option

type Option func(c *Client)

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