mysql

package
v0.0.0-...-b08fcc5 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2023 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ClusterMaster = "master"
	ClusterSlave  = "slave"
)

Variables

This section is empty.

Functions

func NewConnected

func NewConnected(srvName string, confName string, cluster string) (res *gorm.DB, err error)

NewConnected mysql cluster client

func NewGORMLogger

func NewGORMLogger(config GormConfig, log *loggers.Logger, slowLog *loggers.Logger) gormLogger.Interface

Types

type GormConfig

type GormConfig struct {
	SlowThreshold             time.Duration       // 慢sql
	IgnoreRecordNotFoundError bool                // 记录不存在是否记录
	LogLevel                  gormLogger.LogLevel // 日志等级  dev 4 | online 2

	SrvName    string // 服务名
	ConfigName string // 配置名
	ConnName   string // 连接名称
}

Jump to

Keyboard shortcuts

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