okmysql

package
v0.0.0-...-164ee4d Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2022 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DbLoggerConfig *oklogger.LoggerConfig = &oklogger.LoggerConfig{
		LogFileFolder:     "/var/log",
		LogFileName:       "db.log",
		LogLevel:          logrus.InfoLevel,
		LogFileMaxSizeMb:  500,
		LogFileMaxBackups: 5,
		LogFileMaxAge:     30,
		LogFileCompress:   false,
		EnableConsole:     true,
		EnableFile:        true,
	}
)

Functions

func AddConnConfig

func AddConnConfig(name string, config *DbConfig) error

func GetDBConnFromConfig

func GetDBConnFromConfig(c *DbConfig) (*gorm.DB, error)

GetDBConnFromConfig :

func GetDbConn

func GetDbConn(connName string) (*gorm.DB, error)

func NewDbLogger

func NewDbLogger() *dblogger

Types

type DbConfig

type DbConfig struct {
	Host         string `json:"host" yaml:"host"`
	Port         int    `json:"port" yaml:"port"`
	DbName       string `json:"dbName" yaml:"dbName"`
	User         string `json:"user" yaml:"user"`
	Password     string `json:"password" yaml:"password"`
	MaxIdleConns int    `json:"maxIdleConns" yaml:"maxIdleConns"`
	MaxOpenConns int    `json:"maxOpenConns" yaml:"maxOpenConns"`
	Dsn          string `json:"dsn" yaml:"dsn"`
}

Jump to

Keyboard shortcuts

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