global

package
v0.0.0-...-8ba3890 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ResponseOK  = 0  // 成功返回
	ResponseErr = -1 //失败返回
	GinContext  = "ginContext"
	ServerName  = "grpc-server"
)

Variables

View Source
var (
	ServerConfig Config
	Logger       *zap.Logger
	RpcConn      proto.GreeterClient
)

Functions

func InitConfig

func InitConfig(env string)

func InitDB

func InitDB()

func InitLogger

func InitLogger()

func Initialize

func Initialize()

func LoggerMiddleware

func LoggerMiddleware(logger *zap.Logger) gin.HandlerFunc

LoggerMiddleware for request

func RecoveryMiddleware

func RecoveryMiddleware(logger *zap.Logger, stack bool) gin.HandlerFunc

func SrvConnService

func SrvConnService()

Types

type Config

type Config struct {
	Db     MysqlConfig  `yaml:"db"`
	Log    LogConfig    `yaml:"log"`
	Consul ConsulConfig `yaml:"consul"`
}

type ConsulConfig

type ConsulConfig struct {
	Host string `yaml:"host"`
	Port string `yaml:"port"`
}

type LogConfig

type LogConfig struct {
	Path  string `yaml:"path"`
	File  string `yaml:"file"`
	Level string `yaml:"level"`
}

type MysqlConfig

type MysqlConfig struct {
	Host     string `yaml:"host"`
	Port     string `yaml:"port"`
	Password string `yaml:"password"`
	Database string `yaml:"database"`
	Username string `yaml:"username"`
	Charset  string `yaml:"charset"`
}

Jump to

Keyboard shortcuts

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