global

package
v0.0.0-...-4e82913 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ConfigEnv  = "GVA_CONFIG"
	ConfigFile = "config.yaml"
)
View Source
const MaxRedirectCount = 5

todo 提取为公共方法

Variables

View Source
var (
	GVA_DB                  *gorm.DB
	GVA_REDIS               *redis.Client
	GVA_CONFIG              config.Server
	GVA_VP                  *viper.Viper
	GVA_LOG                 *zap.Logger
	GVA_Timer               = timer.NewTimerTask()
	GVA_Concurrency_Control = &singleflight.Group{}

	BlackCache local_cache.Cache
	Validate   *validator.Validate
)

Functions

func Config

func Config() *gorm.Config

Config gorm 自定义配置 Author [SliverHorn](https://github.com/SliverHorn)

func CustomTimeEncoder

func CustomTimeEncoder(t time.Time, enc zapcore.PrimitiveArrayEncoder)

自定义日志输出时间格式

func GetWriteSyncer

func GetWriteSyncer(file string) zapcore.WriteSyncer

func Gorm

func Gorm() *gorm.DB

Gorm 初始化数据库并产生数据库全局变量 Author SliverHorn

func GormMysql

func GormMysql() *gorm.DB

GormMysql 初始化Mysql数据库 Author [piexlmax](https://github.com/piexlmax) Author [SliverHorn](https://github.com/SliverHorn)

func NewWriter

func NewWriter(w logger.Writer) *writer

NewWriter writer 构造函数 Author [SliverHorn](https://github.com/SliverHorn)

func PathExists

func PathExists(path string) (bool, error)

func RedirectConfigFile

func RedirectConfigFile(path string) string

一直往上级目录寻到文件

func Viper

func Viper(path ...string) *viper.Viper

func Zap

func Zap() (logger *zap.Logger)

Types

type GVA_MODEL

type GVA_MODEL struct {
	ID        uint           `gorm:"primarykey"` // 主键ID
	CreatedAt time.Time      // 创建时间
	UpdatedAt time.Time      // 更新时间
	DeletedAt gorm.DeletedAt `gorm:"index" json:"-"` // 删除时间
}

Jump to

Keyboard shortcuts

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