utils

package
v0.0.0-...-4e1a854 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2018 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DateFormat = "yyyy-MM-dd hh:mm:ss"
	TimeLayout = "2006-01-02 15:04:05"
	DateLayout = "2006-01-02"
)

Variables

This section is empty.

Functions

func Date

func Date() string

func GenerateRandNum

func GenerateRandNum() int

GenerateRandNum 生成最大范围内随机数

func GenerateRangeNum

func GenerateRangeNum(min, max int) int

GenerateRangeNum 生成一个区间范围的随机数

func Now

func Now() string

func RandNumCrypto

func RandNumCrypto() string

RandNumCrypto return 6 bit random num by crypto

func RandNumMath

func RandNumMath() string

RandNumMath return 6 bit random num by math

func RandStringBytesMaskImpr

func RandStringBytesMaskImpr(n int) string

func Random

func Random(length int) string

Random return length bit random num

func ReadJSON

func ReadJSON(r *http.Request, obj interface{}) error

func WriteJson

func WriteJson(w http.ResponseWriter, v interface{}) error

Types

type Hook

type Hook struct {
	Field string
	Skip  int

	Formatter func(file, function string, line int) string
	// contains filtered or unexported fields
}

Hook for logrus with filename

func NewHook

func NewHook(levels ...logrus.Level) *Hook

func (*Hook) Fire

func (hook *Hook) Fire(entry *logrus.Entry) error

func (*Hook) Levels

func (hook *Hook) Levels() []logrus.Level

Jump to

Keyboard shortcuts

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