mysqlpkg

package
v0.2.17 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 4 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewDB

func NewDB(conf *Config, opts ...gormpkg.Option) (db *gorm.DB, err error)

NewDB 初始化

func NewMysqlDB

func NewMysqlDB(conf *Config, opts ...gormpkg.Option) (db *gorm.DB, err error)

NewMysqlDB .

Types

type Config

type Config struct {
	Dsn string
	// SlowThreshold 慢查询
	SlowThreshold  *durationpb.Duration
	LoggerEnable   bool
	LoggerColorful bool
	// LoggerLevel 日志级别;值:DEBUG、INFO、WARN、ERROR、FATAL
	LoggerLevel string
	// conn_max_active 连接可复用的最大时间
	ConnMaxActive uint32
	// conn_max_lifetime 可复用的最大时间
	ConnMaxLifetime *durationpb.Duration
	// conn_max_idle 连接池中空闲连接的最大数量
	ConnMaxIdle uint32
	// conn_max_idle_time 设置连接空闲的最长时间
	ConnMaxIdleTime *durationpb.Duration
}

Config MySQL config

Jump to

Keyboard shortcuts

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