xmysql

package
v0.0.0-...-80fcaa9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConnMYSQL

func ConnMYSQL(item MYSQLConfig) (*sql.DB, error)

func EnableLog

func EnableLog()

func GoquSQL

func GoquSQL(ctx context.Context, fn DBHandler, handler GoquSQLHandler) (err error)

func GoquTransactionSQL

func GoquTransactionSQL(ctx context.Context, fn DBHandler, handler GoquTranscationSQLHandler) error

func IsEnable

func IsEnable() bool

Types

type DBHandler

type DBHandler func() (*sql.DB, error)

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 连接配置

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL