Documentation ¶
Index ¶
- Constants
- Variables
- func CloseMysqlClient(clientName string) error
- func InitMysqlClient(clientName, username, password, host, dbName string) error
- func InitMysqlClientWithOptions(clientName, username, password, host, dbName string, options ...Option) error
- type DB
- type Option
- func WithConnMaxLifeSecond(connMaxLifeTime time.Duration) Option
- func WithEnableSqlLog(enableSqlLog bool) Option
- func WithLogName(logName string) Option
- func WithMaxIdleConn(maxIdleConn int) Option
- func WithMaxOpenConn(maxOpenConn int) Option
- func WithPrepareStmt(prepareStmt bool) Option
- func WithSlowLogMillisecond(slowLogMillisecond int64) Option
Constants ¶
View Source
const ( DefaultMaxOpenConn = 1000 DefaultMaxIdleConn = 100 DefaultConnMaxLifeSecond = 30 * time.Minute DefaultLogName = "gorm" DefaultSlowLogMillisecond = 200 DefaultClient = "default-mysql-client" ReadClient = "read-mysql" WriteClient = "write-mysql" TxClient = "tx-mysql" )
Variables ¶
View Source
var (
MysqltdLogger stdLogger
)
Functions ¶
func CloseMysqlClient ¶
func InitMysqlClient ¶
Types ¶
type DB ¶
type DB struct { *gorm.DB ClientName string Username string Host string DBName string // contains filtered or unexported fields }
func GetMysqlClient ¶
type Option ¶
type Option func(*option)
func WithConnMaxLifeSecond ¶
func WithEnableSqlLog ¶
func WithLogName ¶
func WithMaxIdleConn ¶
func WithMaxOpenConn ¶
func WithPrepareStmt ¶
func WithSlowLogMillisecond ¶
Click to show internal directories.
Click to hide internal directories.