util

package
v0.0.0-...-c649034 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RandomString = map[RandomKind]string{
		RandomNum:      "0123456789",
		RandomLower:    "abcdefghijklmnopqrstuvwxyz",
		RandomUpper:    "ABCDEFGHIJKLMNOPQRSTUVWXYZ",
		RandomLowerNum: "0123456789abcdefghijklmnopqrstuvwxyz",
		RandomUpperNum: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ",
		RandomAll:      "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
	}
)

RandomString defines

Functions

func DecryptJWT

func DecryptJWT(key []byte, token string) (string, error)

DecryptJWT ...

func EncryptJWT

func EncryptJWT(key []byte, sub []byte) (string, error)

EncryptJWT ...

func GenerateRandomString

func GenerateRandomString(size int, kind ...RandomKind) string

GenerateRandomString 随机字符串

func GenerateRandomString2

func GenerateRandomString2(size int, kind int) []byte

GenerateRandomString2 随机字符串

func MarshalJSON

func MarshalJSON(v interface{}) ([]byte, error)

MarshalJSON ...

func UnmarshalJSON

func UnmarshalJSON(reader io.Reader, v interface{}) error

UnmarshalJSON ...

Types

type RandomKind

type RandomKind int

RandomKind RandomKind

const (
	RandomNum      RandomKind = iota // 纯数字
	RandomLower                      // 小写字母
	RandomUpper                      // 大写字母
	RandomLowerNum                   // 数字、小写字母
	RandomUpperNum                   // 数字、大写字母
	RandomAll                        // 数字、大小写字母
)

random kinds

Jump to

Keyboard shortcuts

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