util

package
v0.0.0-...-57b530e Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrNodeNotExists 配置节点不存在
	ErrNodeNotExists = errors.New("node not exists")
)

Functions

func Close

func Close(response *http.Response)

func HttpGet

func HttpGet(url string) ([]byte, error)

func Md5

func Md5(s string) string

生成 MD5

func NewLogger

func NewLogger(Logname string) *logrus.Logger

func PanicTrace

func PanicTrace(err interface{}) string

返回执行路径

Types

type Configuration

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

Configuration 应用配置

func Config

func Config() *Configuration

Config 得到config对象

func (*Configuration) Bind

func (conf *Configuration) Bind(node, key string, obj interface{}) error

Bind 将配置绑定到传入对象

node 其实是配置文件的文件名
key 是配置文件中的顶层key
具体可查看该方法的其他包的使用

type Items

type Items []Onestruct

func (Items) Len

func (p Items) Len() int

Len()方法和Swap()方法不用变化 获取此 slice 的长度

func (Items) Less

func (p Items) Less(i, j int) bool

func (Items) Swap

func (p Items) Swap(i, j int)

交换数据

type Onestruct

type Onestruct struct {
	Key   string
	Value string
}

Jump to

Keyboard shortcuts

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