utils

package
v0.0.0-...-849f898 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2020 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CalMD5

func CalMD5(value string) string

CalMD5 ...

func CopyFile

func CopyFile(src string, dst string) int

func FileMd5

func FileMd5(path string) string

FileMd5 make md5 for the file

func Fingerprint

func Fingerprint(text string) string

func GetExecDirPath

func GetExecDirPath() (string, error)

func IsDir

func IsDir(path string) bool

func IsPathExist

func IsPathExist(path string) bool

IsPathExist check whether the path is exist or not

func MakeHMac

func MakeHMac(token string, body []byte) string

MakeHMac ...

func MakeParentDir

func MakeParentDir(path string) (bool, error)

MakeParentDir 生成指定路径的上级目录

如: /foo/bar/baz.js   会确保 /foo/bar 存在
    /foo/bar/baz      会确保 /foo/bar 存在
    /foo/bar/baz/     会确保 /foo/bar/baz 存在

func MakeSign

func MakeSign(appid, appSecret string, values url.Values) string

MakeSign 将key按字典序排列后拼接keyvalue最后再添加appSecret值,形成的字符串计算md5

func MoveFile

func MoveFile(src string, dst string) int

func NewToken

func NewToken(appname, uniqueID string) string

NewToken ...

func NewUUID

func NewUUID(appname, uniqueID string) string

NewUUID ...

func PathRelative2Bin

func PathRelative2Bin(relative string) (string, error)

func RemoveFile

func RemoveFile(path string) int

func TernaryString

func TernaryString(condition bool, s string, f string) string

Types

type ISafeRand

type ISafeRand interface {
	Int63() int64
	Uint32() uint32
	Uint64() uint64
	Int31() int32
	Int() int
	Int63n(n int64) int64
	Int31n(n int32) int32
	Intn(n int) int
	Float64() float64
	NormFloat64() float64
	Float32() float32
	Perm(n int) []int
}

func NewSafeRand

func NewSafeRand(seed int64) ISafeRand

type IntHeap

type IntHeap []int32

IntHeap ...

func (*IntHeap) Data

func (h *IntHeap) Data() []int32

Data ...

func (IntHeap) Len

func (h IntHeap) Len() int

Len sort interface in heap

func (IntHeap) Less

func (h IntHeap) Less(ia, ib int) bool

Less sort interface in heap

func (*IntHeap) Pop

func (h *IntHeap) Pop() interface{}

Pop interface of heap

func (*IntHeap) Push

func (h *IntHeap) Push(x interface{})

Push interface of heap

func (IntHeap) Swap

func (h IntHeap) Swap(ia, ib int)

Less sort interface in heap

Jump to

Keyboard shortcuts

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