utils

package
v0.0.0-...-a5d5012 Latest Latest
Warning

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

Go to latest
Published: May 22, 2021 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Base62DecodeMin6Max11 = Base62Decode

Functions

func Base34Decode

func Base34Decode(bs []byte) uint64

func Base34DecodeString

func Base34DecodeString(str string) uint64

func Base34Encode

func Base34Encode(id uint64) []byte

func Base34EncodeToString

func Base34EncodeToString(id uint64) string

func Base62Decode

func Base62Decode(token string) int64

converts base62 token to int

func Base62Encode

func Base62Encode(number int64) string

converts number to base62

func Base62EncodeMin6Max11

func Base62EncodeMin6Max11(number int64) string

func BytesToString

func BytesToString(b []byte) string

func CheckAndCreate

func CheckAndCreate(path string) error

CheckAndCreate 检查文件或者目录是否存在,不存在则创建 error==nil,创建成功,否则创建失败

func CheckIsSameIP

func CheckIsSameIP(addr string, selfIPS ...string) string

func CheckPathExists

func CheckPathExists(path string) bool

CheckPathExists 检查文件目录是否存在 存在返回true,否则返回false

func CreateCaptcha

func CreateCaptcha() (id, data string)

func CreateCaptchaWithWH

func CreateCaptchaWithWH(width, height int64) (id, data string)

func CreatePath

func CreatePath(path string) error

CreatePath 递归创建文件 error==nil,创建成功,否则创建失败 内部调用 MkdirAll

func DesDecrypt

func DesDecrypt(crypt, key []byte) ([]byte, error)

func DesEncrypt

func DesEncrypt(origData, key []byte) ([]byte, error)

func EncodeNumString

func EncodeNumString(src string) string

func GetDirFromPath

func GetDirFromPath(path string) string

GetDirFromPath 从path获取当前文件所在目录 返回目录路径

func GetFileNameFromPath

func GetFileNameFromPath(path string) string

GetDirFromPath 从path获取当前文件名字 返回文件名字

func I64ToStr

func I64ToStr(i int64) string

func InitRedisCaptchaStore

func InitRedisCaptchaStore(client redis.Cmdable)

func MD5Bytes

func MD5Bytes(bs []byte) string

func MD5String

func MD5String(str string) string

func MD5StringUpper

func MD5StringUpper(str string) string

func NewLogFileName

func NewLogFileName(serverName string, addr string) string

func PKCS5Padding

func PKCS5Padding(cipherText []byte, blockSize int) []byte

ECB PKCS5Padding

func PKCS5UNPadding

func PKCS5UNPadding(origData []byte) []byte

ECB PKCS5UNPadding

func Recover

func Recover(panicPrint func(e interface{}))

func RecoverWithFunc

func RecoverWithFunc(panicPrint func(e interface{}), f func())

func SafeGO

func SafeGO(errF func(interface{}), f func())

func StringToBytes

func StringToBytes(s string) []byte

func StringToBytesNotNil

func StringToBytesNotNil(s string) []byte

func TrimLeftRight

func TrimLeftRight(str string) string

func TripleEcbDesDecrypt

func TripleEcbDesDecrypt(crypt, key []byte) ([]byte, error)

[golang ECB 3DES Decrypt]

func TripleEcbDesEncrypt

func TripleEcbDesEncrypt(origData, key []byte) ([]byte, error)

[golang ECB 3DES Encrypt]

func VerifyCaptcha

func VerifyCaptcha(idKey, verifyValue string) bool

func WalkFiles

func WalkFiles(fileDir string, suffix ...string) ([]string, error)

Types

type Duration

type Duration struct {
	time.Duration
}

func (*Duration) FromString

func (d *Duration) FromString(str string) error

FromString 从字符串解析Duration,例如:5s,7m,9ms

func (*Duration) MarshalText

func (d *Duration) MarshalText() string

func (*Duration) UnmarshalText

func (d *Duration) UnmarshalText(text []byte) error

type HTTPHeader

type HTTPHeader struct {
	http.Header
}

func NewHTTPHeader

func NewHTTPHeader() *HTTPHeader

func (*HTTPHeader) Add

func (this_ *HTTPHeader) Add(key string, value interface{}) *HTTPHeader

func (*HTTPHeader) Del

func (this_ *HTTPHeader) Del(key string) *HTTPHeader

func (*HTTPHeader) Len

func (this_ *HTTPHeader) Len() int64

func (*HTTPHeader) Nil

func (this_ *HTTPHeader) Nil() bool

func (*HTTPHeader) Set

func (this_ *HTTPHeader) Set(key string, value interface{}) *HTTPHeader

type RedisStore

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

func (*RedisStore) Get

func (this_ *RedisStore) Get(id string, clear bool) string

func (*RedisStore) Set

func (this_ *RedisStore) Set(id string, value string)

type SpinLock

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

func (*SpinLock) Lock

func (l *SpinLock) Lock()

func (*SpinLock) Unlock

func (l *SpinLock) Unlock()

type URLValues

type URLValues struct {
	url.Values
}

func NewURLValues

func NewURLValues() *URLValues

func (*URLValues) Add

func (this_ *URLValues) Add(key string, value interface{}) *URLValues

func (*URLValues) Clone

func (this_ *URLValues) Clone() *URLValues

func (*URLValues) Del

func (this_ *URLValues) Del(key string) *URLValues

func (*URLValues) Encode

func (this_ *URLValues) Encode() string

func (*URLValues) Len

func (this_ *URLValues) Len() int64

func (*URLValues) Nil

func (this_ *URLValues) Nil() bool

func (*URLValues) RawEncode

func (this_ *URLValues) RawEncode() string

func (*URLValues) Set

func (this_ *URLValues) Set(key string, value interface{}) *URLValues

func (*URLValues) SortRawEncode

func (this_ *URLValues) SortRawEncode() string

Jump to

Keyboard shortcuts

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