utils

package
v0.0.0-...-d527111 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: MIT Imports: 21 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvDefault

func EnvDefault(nm string, defs ...string) string

func GenerateRSAKey

func GenerateRSAKey(bits int) error

GenerateRSAKey 生成RSA私钥和公钥,保存到文件中

func HomePath

func HomePath() string

func Md5String

func Md5String(data string) string

func NewXid

func NewXid() string

NewXid 生成唯一ID

func NewXid64

func NewXid64() string

NewXid64 生成唯一ID-base64

func RSADecrypt

func RSADecrypt(cipherText []byte, privateKey interface{}) ([]byte, error)

RSADecrypt RSA解密

func RSAEncrypt

func RSAEncrypt(plainText []byte, publicKey interface{}) ([]byte, error)

RSAEncrypt RSA加密

func RSAGetSign

func RSAGetSign(data []byte, privateKey interface{}) ([]byte, error)

func RSALoadKey

func RSALoadKey(o interface{}) (rt *pem.Block, rterr error)

func RSAVerifySign

func RSAVerifySign(data, sign []byte, publicKey interface{}) error

func RandomString

func RandomString(l int) string

RandomString 随机生成字符串

Types

type Map

type Map map[string]interface{}

func NewMap

func NewMap() *Map

func NewMaps

func NewMaps(body interface{}) *Map

func (*Map) Get

func (e *Map) Get(key string) (interface{}, bool)

func (*Map) GetBool

func (e *Map) GetBool(key string) bool

func (*Map) GetFloat

func (e *Map) GetFloat(key string) (float64, error)

func (*Map) GetInt

func (e *Map) GetInt(key string) (int64, error)

func (*Map) GetString

func (e *Map) GetString(key string) string

func (*Map) Map

func (e *Map) Map() map[string]interface{}

func (*Map) Set

func (e *Map) Set(key string, val interface{})

func (*Map) ToBytes

func (e *Map) ToBytes() []byte

func (*Map) ToString

func (e *Map) ToString() string

type Timer

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

func NewTimer

func NewTimer(tmd time.Duration, now ...bool) *Timer

func (*Timer) Reset

func (c *Timer) Reset(now bool, tmd ...time.Duration)

func (*Timer) Tick

func (c *Timer) Tick() bool

Jump to

Keyboard shortcuts

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