util

package
v0.0.0-...-82b086f Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Close

func Close()

Close .

func CloserAdd

func CloserAdd(level int, event func() (errs []error))

CloserAdd 添加关闭事件 level 等级越低越先关闭

func Inject

func Inject(handler func(err error))

Inject 关闭时发生错误处理方法

func IsProd

func IsProd() bool

IsProd 是否生产环境

func JSON

func JSON(data interface{}) []byte

JSON 屏蔽错误返回json字节

func JSONWithColor

func JSONWithColor(data interface{}) []byte

JSONWithColor 屏蔽错误返回json格式化带颜色字节

func PrintJSONWithColor

func PrintJSONWithColor(data interface{})

PrintJSONWithColor .

func TimeFormat

func TimeFormat(time time.Time) string

TimeFormat 时间格式化

Types

type ResultCode

type ResultCode string

ResultCode 结果码

const (
	// Success 成功
	Success ResultCode = "success"
	// Error 异常
	Error ResultCode = "error"
	// Default 默认
	Default ResultCode = ""
	//ErrorParameterIsIncorrect 参数不正确
	ErrorParameterIsIncorrect ResultCode = "ErrorParameterIsIncorrect"
)

Jump to

Keyboard shortcuts

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