Documentation
¶
Index ¶
- Variables
- type Client
- type ClientConfig
- type Component
- type ComponentConfig
- type ConnectConfig
- type Logger
- func (l *Logger) Error(ctx context.Context, msg string, data ...interface{})
- func (l *Logger) Info(ctx context.Context, msg string, data ...interface{})
- func (l *Logger) LogMode(level logger.LogLevel) logger.Interface
- func (l *Logger) SetLogger(log glogger.Interface)
- func (l *Logger) Trace(ctx context.Context, begin time.Time, fc func() (string, int64), err error)
- func (l *Logger) Warn(ctx context.Context, msg string, data ...interface{})
Constants ¶
This section is empty.
Variables ¶
View Source
var CreateClient = defaultNewClient
Functions ¶
This section is empty.
Types ¶
type Client ¶ added in v0.3.0
type Client struct {
Client *gorm.DB
Cfg ClientConfig
}
type ClientConfig ¶ added in v0.3.0
type ClientConfig struct {
Master ConnectConfig `json:"master" yaml:"master"`
Slave []ConnectConfig `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 Component ¶
type Component struct {
DSNPrint bool
Cfg ComponentConfig
Clts map[string]*Client
// contains filtered or unexported fields
}
func (*Component) SetLogLevel ¶
type ComponentConfig ¶ added in v0.3.0
type ConnectConfig ¶ added in v0.3.0
type ConnectConfig 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"`
}
func (*ConnectConfig) GetConnectDSN ¶ added in v0.3.0
func (c *ConnectConfig) GetConnectDSN() string
func (*ConnectConfig) GetPrintDSN ¶ added in v0.3.0
func (c *ConnectConfig) GetPrintDSN() string
func (*ConnectConfig) ParserDSN ¶ added in v0.3.0
func (c *ConnectConfig) ParserDSN(val string) error
Click to show internal directories.
Click to hide internal directories.