global

package
v0.0.0-...-11946d1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package global @Description: 全局实例

Index

Constants

This section is empty.

Variables

View Source
var (
	MysqlDb    *gorm.DB               // mysql数据库实例
	PostgresDb *gorm.DB               // postgre数据库实例
	Redis      *redis.Client          // redis内存数据库实例
	Validator  *Validate              // 结构体验证器
	Casbin     *casbin.SyncedEnforcer // Casbin策略服务
	Vp         *viper.Viper           // 命令行处理实例
	Log        *zap.Logger            // 日志实例
	Config     config.Server          // 程序配置
	Route      *gin.Engine            // 程序路由组

)

Functions

This section is empty.

Types

type Validate

type Validate struct {
	Validate *validator.Validate // 验证器引用
	Trans    *ut.Translator      // 汉化器引用
}

func (*Validate) FormatError

func (v *Validate) FormatError(u interface{}, err error) error

FormatError

@Description: 格式化错误信息
@receiver v
@param err
@return error

func (*Validate) ValidateStruct

func (v *Validate) ValidateStruct(u interface{}) error

ValidateStruct

@Description: 验证结构体
@receiver v
@param u
@return error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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