mysqlx

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsRecordNotFoundErr

func IsRecordNotFoundErr(err error) bool

IsRecordNotFoundErr 是否

func NewGormDB

func NewGormDB(cfg *DBConfig) (*gorm.DB, error)

NewGormDB 初始MysqlDB 仓储实例

Types

type DBConfig

type DBConfig struct {
	// 连接配置
	DSN string `json:"dsn"`
	// 连接池
	ConnMaxLifetime string `json:"conn_max_lifetime"`  // 连接可以被复用多久
	ConnMaxIdleTime string `json:"conn_max_idle_time"` // 连接可以被闲置多久
	MaxIdleConns    int    `json:"max_idle_conns"`     // 连接池最大闲置连接数
	MaxOpenConns    int    `json:"max_open_conns"`     // 连接池最大开启连接数
	// 日志
	LoggerConfig *LoggerConfig `json:"logger"`
}

DBConfig Mysql DB配置

func (*DBConfig) String

func (cfg *DBConfig) String() string

String 配置字符串序列化返回,用于信息展示

type LoggerConfig

type LoggerConfig struct {
	LogFile       string          `json:"log_file"`       // 日志存储位置
	LogLevel      logger.LogLevel `json:"log_level"`      // 日志级别, 4:info
	SlowThreshold string          `json:"slow_threshold"` // 慢日志阈值
	Colorful      bool            `json:"colorful"`       // 颜色区分
}

LoggerConfig db日志配置

Jump to

Keyboard shortcuts

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