tool

package
v0.0.0-...-c6cfeb0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultCacheFile string

Functions

func Debug

func Debug(args ...interface{})

func DebugFields

func DebugFields(fields Field, args ...interface{})

func Error

func Error(args ...interface{})

func ErrorFields

func ErrorFields(fields Field, args ...interface{})

func Fatal

func Fatal(args ...interface{})

func FatalFields

func FatalFields(fields Field, args ...interface{})

func Info

func Info(args ...interface{})

func InfoFields

func InfoFields(fields Field, args ...interface{})

func LogError

func LogError(msg string, err error)

func Md5

func Md5(text string, salt ...string) string

func Md5Byte

func Md5Byte(text []byte, salt ...string) string

Md5Byte MD5加密byte数组

func Md5File

func Md5File(file string) string

Md5File 获取文件MD5值

func Panic

func Panic(args ...interface{})

func PanicFields

func PanicFields(fields Field, args ...interface{})

func SetLogLevel

func SetLogLevel(level string)

func Trace

func Trace(args ...interface{})

func TraceFields

func TraceFields(fields Field, args ...interface{})

func UUID

func UUID() string

func Warn

func Warn(args ...interface{})

func WarnFields

func WarnFields(fields Field, args ...interface{})

func WriteCacheToFile

func WriteCacheToFile()

Types

type Cache

type Cache struct {
	// contains filtered or unexported fields
}

func NewCache

func NewCache(file string, defaultExpiration, cleanupInterval time.Duration) *Cache

func NewDefaultCache

func NewDefaultCache() *Cache

func (*Cache) Get

func (cache *Cache) Get(key string) (interface{}, bool)

func (*Cache) LoadFile

func (cache *Cache) LoadFile() error

func (*Cache) SaveFile

func (cache *Cache) SaveFile() error

func (*Cache) Set

func (cache *Cache) Set(key string, value interface{})

func (*Cache) SetWithExpired

func (cache *Cache) SetWithExpired(key string, value interface{}, expired time.Duration)

type Field

type Field logrus.Fields

type ViperConfig

type ViperConfig struct {
	// contains filtered or unexported fields
}

func CreateViperConfig

func CreateViperConfig(file string) *ViperConfig

func (*ViperConfig) GetBool

func (v *ViperConfig) GetBool(key string) bool

func (*ViperConfig) GetDuration

func (v *ViperConfig) GetDuration(key string) time.Duration

func (*ViperConfig) GetInt

func (v *ViperConfig) GetInt(key string) int

func (*ViperConfig) GetInt32

func (v *ViperConfig) GetInt32(key string) int32

func (*ViperConfig) GetInt64

func (v *ViperConfig) GetInt64(key string) int64

func (*ViperConfig) GetIntSlice

func (v *ViperConfig) GetIntSlice(key string) []int

func (*ViperConfig) GetString

func (v *ViperConfig) GetString(key string) string

func (*ViperConfig) GetStringMap

func (v *ViperConfig) GetStringMap(key string) map[string]interface{}

func (*ViperConfig) GetStringMapString

func (v *ViperConfig) GetStringMapString(key string) map[string]string

func (*ViperConfig) GetStringMapStringSlice

func (v *ViperConfig) GetStringMapStringSlice(key string) map[string][]string

func (*ViperConfig) GetTime

func (v *ViperConfig) GetTime(key string) time.Time

func (*ViperConfig) GetUint

func (v *ViperConfig) GetUint(key string) uint

func (*ViperConfig) LoadConfig

func (v *ViperConfig) LoadConfig() error

func (*ViperConfig) Set

func (v *ViperConfig) Set(key string, value interface{})

func (*ViperConfig) WatchConfig

func (v *ViperConfig) WatchConfig(onConfigChange func(v *ViperConfig))

func (*ViperConfig) WriteConfig

func (v *ViperConfig) WriteConfig(key string) error

Jump to

Keyboard shortcuts

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