utils

package
v0.0.0-...-34a7f13 Latest Latest
Warning

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

Go to latest
Published: May 12, 2022 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Base64Decode

func Base64Decode(s string) []byte

Base64Decode -

func Base64Encode

func Base64Encode(s []byte) string

func ByteSizeFormat

func ByteSizeFormat(s int64) string

ByteSizeFormat -

func BytesToJSON

func BytesToJSON(byt []byte, jn interface{}) error

BytesToJSON -

func DirIsExistThenMkdir

func DirIsExistThenMkdir(path string) error

DirIsExistThenMkdir -

func Finalize

func Finalize()

Finalize - log recover

func GenMD5

func GenMD5(s string) string

GenMD5 - 计算MD5.

func GenNonce

func GenNonce() int64

GenNonce - 随机nonce数字.

func GenVerifyCode

func GenVerifyCode() string

GenVerifyCode - 随机验证码.

func InetAToI

func InetAToI(ip string) int64

InetAToI - ip to int64.

func Int64ToString

func Int64ToString(n int64) string

Int64ToString -

func IntToString

func IntToString(n int) string

IntToString -

func IsExistFile

func IsExistFile(path string) (bool, error)

IsExistFile - 文件是否存在

func JSONToBytes

func JSONToBytes(jn interface{}) []byte

JSONToBytes -

func Logger

func Logger(f map[string]interface{}) *logrus.Entry

Logger - 返回唯一实例.

func MapStringToSlice

func MapStringToSlice(om map[string]interface{}) (ret []string)

func MsFormat

func MsFormat(ts int64) string

MsFormat - ms format.

func MsFormatDay

func MsFormatDay(ts int64) string

MsFormatDay - ms format day peroid.

func MsFormatFN

func MsFormatFN(ts int64) string

MsFormatFN - ms format filename.

func MsFormatMonth

func MsFormatMonth(ts int64) string

MsFormatMonth - ms format.

func NowMs

func NowMs() int64

NowMs - 当前时间ms.

func RandomBytes

func RandomBytes(len int, r []byte) []byte

RandomBytes -

func RandomBytesQ

func RandomBytesQ(len int, r []byte) []byte

RandomBytesQ -

func SetLogout

func SetLogout(path string)

SetLogout - 设置日志输出位置.

func StringToInt

func StringToInt(s string) int

StringToInt -

func StringToInt64

func StringToInt64(s string) int64

StringToInt64 -

func StringToSlice

func StringToSlice(d string, s string) []string

StringToSlice -

func TimestampFormat

func TimestampFormat(ts int64) string

TimestampFormat - ms format.

Types

type Duration

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

Duration -

func NewDuration

func NewDuration() *Duration

func (*Duration) DuraMs

func (d *Duration) DuraMs() int64

DuraMs - Ms间隔.

func (*Duration) DuraNano

func (d *Duration) DuraNano() int64

DuraNano - 纳秒间隔.

func (*Duration) DuraS

func (d *Duration) DuraS() int64

DuraS - 秒间隔.

func (*Duration) String

func (d *Duration) String() string

DuraNano - 纳秒间隔.

type Fields

type Fields map[string]interface{}

Fields logrus.Fields

type StatBandwidth

type StatBandwidth struct {
	BeginTime time.Time
	EndTime   time.Time
	Count     int64
	Bytes     int64
	// contains filtered or unexported fields
}

StatBandwidth - 统计带宽bps.

func (*StatBandwidth) Begin

func (s *StatBandwidth) Begin()

Begin -

func (*StatBandwidth) Bps

func (s *StatBandwidth) Bps(ms int64) int64

Bps -

func (*StatBandwidth) Bps1s

func (s *StatBandwidth) Bps1s() int64

Bps1s -

func (*StatBandwidth) Bps3s

func (s *StatBandwidth) Bps3s() int64

Bps3s -

func (*StatBandwidth) Bps5s

func (s *StatBandwidth) Bps5s() int64

Bps5s -

func (*StatBandwidth) End

func (s *StatBandwidth) End()

End -

func (*StatBandwidth) Inc

func (s *StatBandwidth) Inc(b int64)

Inc -

func (*StatBandwidth) Info

func (s *StatBandwidth) Info() string

Info -

func (*StatBandwidth) InfoAll

func (s *StatBandwidth) InfoAll() string

func (*StatBandwidth) String

func (s *StatBandwidth) String() string

String -

Jump to

Keyboard shortcuts

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