common

package
v0.0.0-...-b403586 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2021 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AccessLogger *zap.Logger
View Source
var DateFormat = "2006-01-02"
View Source
var DefLogger *zap.Logger
View Source
var DefaultDbPool *gorm.DB
View Source
var DefaultRedisPool *redis.Pool
View Source
var Destroyables []Destroyable
View Source
var LocalIP = net.ParseIP("127.0.0.1")
View Source
var TimeFormat = "2006-01-02 15:04:05"
View Source
var TimeLocation *time.Location

Functions

func GetConfig

func GetConfig() *goconfig.ConfigFile

func GetLocalIPs

func GetLocalIPs() (ips []net.IP)

func GetTraceId

func GetTraceId() (traceId string)

func InArrayString

func InArrayString(s string, arr []string) bool

func InitConfigFile

func InitConfigFile(configFile string)

func InitDatabase

func InitDatabase() error

func InitLogs

func InitLogs()

func InitRedis

func InitRedis()

func New

func New(l *Logger) (*zap.Logger, error)

New 创建新日志客户端

func NewSpanId

func NewSpanId() string

func RegisterComponent

func RegisterComponent(c Destroyable)

func Substr

func Substr(str string, start int64, end int64) string

Substr 字符串的截取

Types

type Config

type Config struct {
}

func (Config) Destroy

func (c Config) Destroy()

type Db

type Db struct {
}

func (Db) Destroy

func (c Db) Destroy()

type Destroyable

type Destroyable interface {
	Destroy()
}

type LogConfig

type LogConfig struct {
	Logger Logger
}

type Logger

type Logger struct {
	Mode                                 string
	Level                                string
	Name, Alone, Path, UUIDPath, ErrPath string
	MaxSize                              int
	MaxBackups                           int
	MaxAge                               int
	Compress                             bool
	//日志是否为json结构
	Json bool
}

Logger 参数

type RedisPool

type RedisPool struct {
}

func (RedisPool) Destroy

func (r RedisPool) Destroy()

type Trace

type Trace struct {
	TraceId     string
	SpanId      string
	Caller      string
	SrcMethod   string
	HintCode    int64
	HintContent string
}

type TraceContext

type TraceContext struct {
	Trace
	CSpanId string
}

func NewTrace

func NewTrace() *TraceContext

Jump to

Keyboard shortcuts

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