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 ¶
Functions ¶
func NewInstance ¶ added in v1.8.2
NewInstance connect to database and create a db instance
Types ¶
type Config ¶
type Config struct { Driver string Name string Addr string UserName string Password string ShowLog bool MaxIdleConn int MaxOpenConn int Timeout string // connect timeout ReadTimeout string WriteTimeout string ConnMaxLifeTime time.Duration SlowThreshold time.Duration // 慢查询时长,默认500ms EnableTrace bool }
Config database config
type LoggerWriter ¶ added in v1.10.0
type LoggerWriter struct {
// contains filtered or unexported fields
}
func (*LoggerWriter) Printf ¶ added in v1.10.0
func (l *LoggerWriter) Printf(s string, v ...interface{})
Click to show internal directories.
Click to hide internal directories.