common

package
v0.0.0-...-3716ba0 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Conf          *Config
	DB            *gorm.DB
	RedisConnPool *redis.Pool
)
View Source
var (
	ROOT_PATH string // 项目启动位置
)

Functions

func GetDB

func GetDB() *gorm.DB

func GetRedis

func GetRedis() (redis.Conn, error)

func GetRedisPool

func GetRedisPool() *redis.Pool

Types

type Config

type Config struct {
	System struct {
		LogLevel string `json:"log_level"`
		LogPath  string `json:"log_path"`
	} `json:"system"`
	DB struct {
		Host      string `json:"host"`
		Port      string `json:"port"`
		Name      string `json:"name"`
		Username  string `json:"username"`
		Password  string `json:"password"`
		Config    string `json:"config"`
		MaxIdle   int    `json:"max_idle"`
		MaxOpen   int    `json:"max_open"`
		DbLogMode bool   `json:"db_log_mode"`
		LogZap    string `json:"log_zap"` // 留空不写到日志文件,gorm日志级别:"silent", "Silent"  |  "error", "Error"  | "warn", "Warn" | "info", "Info" | "zap", "Zap"
	}
	Redis struct {
		Host       string `json:"host"`
		Port       int    `json:"port"`
		MaxIdle    int    `json:"max_idle"`
		MasterName string `json:"master_name"`
		RedisType  string `json:"redis_type"`
		Password   string `json:"password"`
		Db         int    `json:"db"`
	}
}

Jump to

Keyboard shortcuts

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