Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdjustDBTimeZone ¶
AdjustDBTimeZone force adjust session `time_zone`.
Types ¶
type DBConfig ¶
type DBConfig struct { Host string `toml:"host" json:"host" yaml:"host"` Port int `toml:"port" json:"port" yaml:"port"` User string `toml:"user" json:"user" yaml:"user"` Password string `toml:"password" json:"-" yaml:"password"` // omit it for privacy // deprecated, mysql driver could automatically fetch this value MaxAllowedPacket *int `toml:"max-allowed-packet" json:"max-allowed-packet" yaml:"max-allowed-packet"` Session map[string]string `toml:"session" json:"session" yaml:"session"` // security config Security *security.Security `toml:"security" json:"security" yaml:"security"` RawDBCfg *RawDBConfig `toml:"-" json:"-" yaml:"-"` Net string `toml:"-" json:"-" yaml:"-"` }
DBConfig is the DB configuration.
func (*DBConfig) AdjustWithTimeZone ¶
func (*DBConfig) Clone ¶
Clone returns a deep copy of DBConfig. This function only fixes data race when adjusting Session.
type RawDBConfig ¶
RawDBConfig contains some low level database config.
func DefaultRawDBConfig ¶
func DefaultRawDBConfig() *RawDBConfig
DefaultRawDBConfig returns a default raw database config.
func (*RawDBConfig) SetMaxIdleConns ¶
func (c *RawDBConfig) SetMaxIdleConns(value int) *RawDBConfig
SetMaxIdleConns set maxIdleConns for raw database config set value <= 0 then no idle connections are retained. set value > 0 then `value` idle connections are retained.
func (*RawDBConfig) SetReadTimeout ¶
func (c *RawDBConfig) SetReadTimeout(readTimeout string) *RawDBConfig
SetReadTimeout set readTimeout for raw database config.
func (*RawDBConfig) SetWriteTimeout ¶
func (c *RawDBConfig) SetWriteTimeout(writeTimeout string) *RawDBConfig
SetWriteTimeout set writeTimeout for raw database config.
Click to show internal directories.
Click to hide internal directories.