mysql

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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(proxys ...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 MonitorProxy added in v0.0.9

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

func NewMonitorProxy

func NewMonitorProxy(options ...MonitorProxyOption) *MonitorProxy

func (*MonitorProxy) Begin added in v0.0.9

func (mp *MonitorProxy) Begin() (*sql.Tx, error)

func (*MonitorProxy) BeginTx added in v0.0.9

func (mp *MonitorProxy) BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)

func (*MonitorProxy) Close added in v0.0.9

func (mp *MonitorProxy) Close() error

func (*MonitorProxy) Exec added in v0.0.9

func (mp *MonitorProxy) Exec(query string, args ...interface{}) (sql.Result, error)

func (*MonitorProxy) NextProxy added in v0.0.9

func (mp *MonitorProxy) NextProxy(db interface{})

implement Proxy interface

func (*MonitorProxy) Prepare added in v0.0.9

func (mp *MonitorProxy) Prepare(query string) (*sql.Stmt, error)

func (*MonitorProxy) ProxyName added in v0.0.9

func (mp *MonitorProxy) ProxyName() string

implement Proxy interface

func (*MonitorProxy) Query added in v0.0.9

func (mp *MonitorProxy) Query(query string, args ...interface{}) (*sql.Rows, error)

func (*MonitorProxy) QueryRow added in v0.0.9

func (mp *MonitorProxy) QueryRow(query string, args ...interface{}) *sql.Row

type MonitorProxyOption

type MonitorProxyOption func(c *MonitorProxy)

type MonitorProxyOptions

type MonitorProxyOptions struct{}

func (MonitorProxyOptions) WithConf

func (MonitorProxyOptions) WithLogger

func (MonitorProxyOptions) WithLogger(logger log.Logger) MonitorProxyOption

func (MonitorProxyOptions) WithTracer

type Option

type Option func(c *Client)

type SQLClose added in v0.0.9

type SQLClose interface {
	Close() error
}

type SQLCommon added in v0.0.9

type SQLCommon interface {
	gorm.SQLCommon

	SQLClose

	Begin() (*sql.Tx, error)

	BeginTx(ctx context.Context, opts *sql.TxOptions) (*sql.Tx, error)
}

Jump to

Keyboard shortcuts

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