utils

package
v0.0.0-...-c716174 Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPlatformSignals

func AddPlatformSignals(sigs map[os.Signal]func(), logger Logger) map[os.Signal]func()

func HandleSignals

func HandleSignals(handlers map[os.Signal]func(), logger Logger)

func NewError

func NewError(code e.ErrCode, err error) error

给第三方包添加本地错误编码 成功或者nil直接返回不需要包装

func PrintStack

func PrintStack(err error) string

打印详细信息,附带堆栈信息。

func ToErr

func ToErr(err error, format string, args ...interface{}) error

第三方包和自定义错误,封装stack

Types

type Cache

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

func NewCache

func NewCache() *Cache

func (*Cache) Close

func (c *Cache) Close()

func (*Cache) Del

func (c *Cache) Del(key string)

func (*Cache) Get

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

func (*Cache) Set

func (c *Cache) Set(key string, value interface{}, ttl int64)

type Logger

type Logger interface {
	Infof(template string, args ...interface{})
	Errorf(template string, args ...interface{})
}

Jump to

Keyboard shortcuts

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