Documentation
¶
Index ¶
- Variables
- type MysqlClient
- type MysqlClientConfig
- type MysqlComponent
- func (c *MysqlComponent) CliFlags() []cli.Flag
- func (c *MysqlComponent) Close(_ int, _ bool, _, _, _ func(string, ...interface{})) error
- func (c *MysqlComponent) Init(env int, logMore bool, ctx *cli.Context, ...) error
- func (c *MysqlComponent) LoadOne(name string) (err error)
- func (c *MysqlComponent) Run(_ int, _ bool, _, _, _ func(string, ...interface{})) error
- type MysqlConfig
- type MysqlConnConfig
- type MysqlLogger
- func (l *MysqlLogger) Error(ctx context.Context, msg string, data ...interface{})
- func (l *MysqlLogger) Info(ctx context.Context, msg string, data ...interface{})
- func (l *MysqlLogger) LogMode(level logger.LogLevel) logger.Interface
- func (l *MysqlLogger) SetLogger(info, warn, error func(string, ...interface{}))
- func (l *MysqlLogger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l *MysqlLogger) Warn(ctx context.Context, msg string, data ...interface{})
Constants ¶
This section is empty.
Variables ¶
View Source
var MysqlCreateClient = mysqlDefaultNewClient
Functions ¶
This section is empty.
Types ¶
type MysqlClient ¶
type MysqlClient struct {
Client *gorm.DB
Cfg MysqlClientConfig
// contains filtered or unexported fields
}
func (*MysqlClient) Load ¶
func (c *MysqlClient) Load(r *MysqlComponent, name string, cfg *MysqlConfig, log logger.Interface) (err error)
func (*MysqlClient) Ref ¶
func (c *MysqlClient) Ref() *MysqlComponent
type MysqlClientConfig ¶
type MysqlClientConfig struct {
Master MysqlConnConfig `json:"master" yaml:"master"`
Slave []MysqlConnConfig `json:"slave" yaml:"slave"`
MaxOpenNum int `json:"max_open_num" yaml:"max_open_num"`
MaxIdleNum int `json:"max_idle_num" yaml:"max_idle_num"`
}
type MysqlComponent ¶
type MysqlComponent struct {
DSNPrint bool
Cfg MysqlConfig
Clts map[string]*MysqlClient
Log MysqlLogger
}
func (*MysqlComponent) CliFlags ¶
func (c *MysqlComponent) CliFlags() []cli.Flag
func (*MysqlComponent) Close ¶
func (c *MysqlComponent) Close(_ int, _ bool, _, _, _ func(string, ...interface{})) error
func (*MysqlComponent) LoadOne ¶
func (c *MysqlComponent) LoadOne(name string) (err error)
type MysqlConfig ¶
type MysqlConnConfig ¶
type MysqlConnConfig struct {
Host string `json:"host" yaml:"host"`
UserName string `json:"user" yaml:"user"`
Password string `json:"password" yaml:"password"`
Database string `json:"db" yaml:"db"`
Options string `json:"options" yaml:"options"`
// contains filtered or unexported fields
}
func (*MysqlConnConfig) GetConnectDSN ¶
func (c *MysqlConnConfig) GetConnectDSN() string
func (*MysqlConnConfig) GetPrintDSN ¶
func (c *MysqlConnConfig) GetPrintDSN() string
func (*MysqlConnConfig) ParserDSN ¶
func (c *MysqlConnConfig) ParserDSN(val string) error
type MysqlLogger ¶
type MysqlLogger struct {
// contains filtered or unexported fields
}
func (*MysqlLogger) Error ¶
func (l *MysqlLogger) Error(ctx context.Context, msg string, data ...interface{})
func (*MysqlLogger) Info ¶
func (l *MysqlLogger) Info(ctx context.Context, msg string, data ...interface{})
func (*MysqlLogger) SetLogger ¶
func (l *MysqlLogger) SetLogger(info, warn, error func(string, ...interface{}))
Click to show internal directories.
Click to hide internal directories.