Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DriverMySQL mysql driver DriverMySQL = "mysql" // DriverPostgres postgresSQL driver DriverPostgres = "postgres" // DriverClickhouse DriverClickhouse = "clickhouse" // DefaultDatabase default db name DefaultDatabase = "default" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
Driver string
Name string
Addr string
UserName string
Password string
ShowLog bool
MaxIdleConn int
MaxOpenConn int
Timeout time.Duration // connect timeout
ReadTimeout time.Duration
WriteTimeout time.Duration
ConnMaxLifeTime time.Duration
SlowThreshold time.Duration // 慢查询时长,默认500ms
EnableTrace bool
}
Config database config
type LoggerWriter ¶
type LoggerWriter struct {
// contains filtered or unexported fields
}
func (*LoggerWriter) Printf ¶
func (l *LoggerWriter) Printf(s string, v ...interface{})
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager define a manager
func NewManager ¶
NewManager create a database manager
Click to show internal directories.
Click to hide internal directories.