infra

package
v0.0.0-...-457da86 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2017 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Uppercase    string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
	Lowercase           = "abcdefghijklmnopqrstuvwxyz"
	Alphabetic          = Uppercase + Lowercase
	Numeric             = "0123456789"
	Alphanumeric        = Alphabetic + Numeric
	Symbols             = "`" + `~!@#$%^&*()-_+={}[]|\;:"<>,./?`
	Hex                 = Numeric + "abcdef"
)

Charsets

Variables

This section is empty.

Functions

func JSONDecode

func JSONDecode(encodeStr string) map[string]interface{}

JSONDecode if input is json format,return a map if input is empty, wrong format, return nil can't handle json array,e.g., [1,2,3],use JSONDecodeArr instead

func JSONDecodeArr

func JSONDecodeArr(encodeStr string) []interface{}

JSONDecodeArr handle json array,e.g., [1,2,3]

func JSONEncode

func JSONEncode(obj interface{}) string

JSONEncode return encoded json string if no error, return "" if error occurs

func RandomPercent

func RandomPercent() int

RandomPercent get random value from 0 ~ 99

func RandomString

func RandomString(length uint8, charsets ...string) string

RandomString returns a random string length: str length charsets:

  • uppercase,
  • lowercase,
  • include uppercase & lowercase,
  • numbers,
  • include uppercase & lowercase & numbers,
  • symbols,
  • hex

Types

This section is empty.

Jump to

Keyboard shortcuts

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