util

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AsciiChars = []byte("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789!@#$%^&*()-_=+,.?/:;{}[]`~")

Functions

func CheckPwd added in v0.1.19

func CheckPwd(reqPwd, dataPwd string) error

不同数据的加密值一定不同,相同数据的加密值一定相同,因此,在处理用户登录时只需要对用户传递的密码做加密处理,并与原加密值做比较是否一致即可

func Encrypt added in v0.1.19

func Encrypt(password string) (encryptPwd string)

MD5单向加密

func FatalOnError

func FatalOnError(err error, msg string, data ...interface{})

func LogOnError added in v0.1.18

func LogOnError(code string, err error, data ...interface{})

func NewLen added in v0.1.20

func NewLen(length int) string

func NewLenChars added in v0.1.20

func NewLenChars(length int, chars []byte) string

NewLenChars returns a new random string of the provided length, consisting of the provided byte slice of allowed characters(maximum 256).

func WipeOutZero added in v0.1.20

func WipeOutZero(buf []byte) []byte

去除[]byte中的0 适用于提取ascII码

Types

type Exception added in v0.1.27

type Exception uint16
var (
	Success Exception = 2000

	InvalidParams Exception = 3000

	UnmarshalFailed Exception = 6000
	MarshalFailed   Exception = 6001

	SetCacheFailed Exception = 7001
	GetCacheFailed Exception = 7002
)

func (Exception) Error added in v0.1.27

func (m Exception) Error() error

func (Exception) String added in v0.1.27

func (m Exception) String() string

Jump to

Keyboard shortcuts

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