Documentation ¶
Index ¶
- func ConnMYSQL(item MYSQLConfig) (*sql.DB, error)
- func EnableLog()
- func GoquSQL(ctx context.Context, fn DBHandler, handler GoquSQLHandler) (err error)
- func GoquTransactionSQL(ctx context.Context, fn DBHandler, handler GoquTranscationSQLHandler) error
- func IsEnable() bool
- type DBHandler
- type GoquSQLHandler
- type GoquTranscationSQLHandler
- type MYSQLConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GoquTransactionSQL ¶
func GoquTransactionSQL(ctx context.Context, fn DBHandler, handler GoquTranscationSQLHandler) error
Types ¶
type GoquSQLHandler ¶
type GoquSQLHandler func(tx *goqu.Database) error
TranscationSQLHandler func(tx *goqu.TxDatabase) (commmit bool, err error)
type GoquTranscationSQLHandler ¶
type GoquTranscationSQLHandler func(tx *goqu.TxDatabase) error
type MYSQLConfig ¶
type MYSQLConfig struct { DNS string `json:"DNS" yaml:"DNS"` MaxIdleConns int `json:"MaxIdleConns" yaml:"MaxIdleConns"` MaxPoolSize int `json:"MaxPoolSize" yaml:"MaxPoolSize"` MaxIdleTime int64 `json:"MaxIdleTime" yaml:"MaxIdleTime"` //毫秒 1000=1s ConnMaxLifetime int `json:"ConnMaxLifetime" yaml:"ConnMaxLifetime"` // 秒 Log int `json:"Log" yaml:"Log"` //是否开启日志 0 开启 }
MysqlConfig mysql 连接配置
Click to show internal directories.
Click to hide internal directories.