Documentation ¶
Index ¶
- Constants
- Variables
- func Base58Decode(input []byte) []byte
- func Base58Encode(input []byte) []byte
- func CutRune(str string, n int) string
- func RandByte(length int) []byte
- func RandHumanStr(length int) string
- func RandStr(n int) string
- func ReverseBytes(data []byte)
- func UsernameType(username string) int
Constants ¶
View Source
const ( TypeUnknown = iota TypeEmail TypeMobile TypeId TypeName )
View Source
const (
CacheAuthToken = "auth_token_user_%s"
)
Variables ¶
View Source
var ( EmailRegex = regexp.MustCompile(`^([a-zA-Z0-9_.-])+@(([a-zA-Z0-9-])+\.)+([a-zA-Z0-9]{2,4})+$`) MobileRegex = regexp.MustCompile(`^1[345789]\d{9}$`) DigitRegex = regexp.MustCompile(`^\d{1,20}$`) LetterRegex = regexp.MustCompile(`^[a-zA-Z]\w+$`) MD5Regex = regexp.MustCompile(`^[0-9a-fA-F]{32}$`) )
View Source
var DBC2SBC = unicode.SpecialCase{ unicode.CaseRange{ Lo: 0x3002, Hi: 0x3002, Delta: [unicode.MaxCase]rune{ 0, 0x002e - 0x3002, 0, }, }, unicode.CaseRange{ Lo: 0xFF01, Hi: 0xFF19, Delta: [unicode.MaxCase]rune{ 0, 0x0021 - 0xFF01, 0, }, }, }
View Source
var (
ImageFormat = []string{".jpg", ".jpeg", ".png", ".bmp", ".gif"}
)
Functions ¶
func RandHumanStr ¶ added in v0.5.5
RandHumanStr 获取便于人类识别的随机字符串(避开了易混淆的字符1l0O等)
func UsernameType ¶ added in v0.5.1
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.