Documentation
¶
Index ¶
Constants ¶
View Source
const ( // DriverMySQL mysql driver DriverMySQL = "mysql" // DriverPostgres postgresSQL driver DriverPostgres = "postgres" // 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
}
Config database config
Click to show internal directories.
Click to hide internal directories.