Documentation
¶
Index ¶
- Constants
- Variables
- func CurrentTimeStamp() int64
- func CurrentTimeStampMS() int64
- func CurrentTimeStampNS() int64
- func CurrentTimeStampString() string
- func GenerateNonceStr() string
- func GenerateRandomString(size int, kind ...RandomKind) string
- func GenerateRandomString2(size int, kind int) []byte
- func GenerateUUID() string
- func In(source []string, v string) bool
- func MapToString(data Map, skip []string) string
- func MapToXML(m Map) (string, error)
- func ParseInt(v interface{}) (int64, bool)
- func ParseNumber(v interface{}) (float64, bool)
- func ParseString(v interface{}) (string, bool)
- func SHA1(s string) string
- func Time(t ...time.Time) string
- func ToURLParams(data Map, skip []string) string
- type CDATA
- type Map
- func (m Map) Check(s ...string) int
- func (m Map) Clone() Map
- func (m Map) Delete(key string) bool
- func (m Map) DeletePath(keys []string) bool
- func (m Map) Expect(keys []string) Map
- func (m Map) Get(key string) interface{}
- func (m Map) GetBool(s string) bool
- func (m Map) GetBoolD(s string, b bool) bool
- func (m Map) GetBytes(s string) []byte
- func (m Map) GetD(s string, d interface{}) interface{}
- func (m Map) GetInt64(s string) (int64, bool)
- func (m Map) GetInt64D(s string, d int64) int64
- func (m Map) GetMap(s string) Map
- func (m Map) GetMapArray(s string) []Map
- func (m Map) GetMapArrayD(s string, d []Map) []Map
- func (m Map) GetMapD(s string, d Map) Map
- func (m Map) GetNumber(s string) (float64, bool)
- func (m Map) GetNumberD(s string, d float64) float64
- func (m Map) GetPath(keys []string) interface{}
- func (m Map) GetString(s string) string
- func (m Map) GetStringD(s string, d string) string
- func (m Map) Has(key string) bool
- func (m Map) HasPath(keys []string) bool
- func (m Map) Join(s Map) Map
- func (m Map) Map() map[string]interface{}
- func (m Map) Only(keys []string) Map
- func (m Map) ParseJSON(b []byte) Map
- func (m Map) ParseXML(b []byte)
- func (m Map) Range(f func(key string, value interface{}) bool)
- func (m Map) ReplaceJoin(s Map) Map
- func (m Map) Set(key string, v interface{}) Map
- func (m Map) SetGet(s string, v Map) Map
- func (m Map) SetHas(s string, v interface{}) Map
- func (m Map) SetNil(s string, v interface{}) Map
- func (m Map) SetPath(keys []string, v interface{}) Map
- func (m Map) SortKeys() []string
- func (m Map) String() string
- func (m Map) ToJSON() []byte
- func (m Map) ToXML() string
- func (m Map) URLEncode() string
- func (m Map) URLToSHA1() string
- type RandomKind
- type String
- type StringAble
Constants ¶
const CustomHeader = `<?xml version="1.0" encoding="UTF-8" standalone="no"?>`
CustomHeader xml header
Variables ¶
var ( ErrorSignType = errors.New("sign type error") ErrorParameter = errors.New("JsonApiParameters() check error") ErrorToken = errors.New("EditAddressParameters() token is nil") )
error types
var ( RandomString = map[RandomKind]string{ RandomNum: "0123456789", RandomLower: "abcdefghijklmnopqrstuvwxyz", RandomUpper: "ABCDEFGHIJKLMNOPQRSTUVWXYZ", RandomLowerNum: "0123456789abcdefghijklmnopqrstuvwxyz", RandomUpperNum: "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ", RandomAll: "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", } )
RandomString defines
Functions ¶
func CurrentTimeStampMS ¶
func CurrentTimeStampMS() int64
CurrentTimeStampMS get current time with millisecond
func CurrentTimeStampNS ¶
func CurrentTimeStampNS() int64
CurrentTimeStampNS get current time with nanoseconds
func CurrentTimeStampString ¶
func CurrentTimeStampString() string
CurrentTimeStampString get current time to string
func GenerateRandomString ¶
func GenerateRandomString(size int, kind ...RandomKind) string
GenerateRandomString 随机字符串
func GenerateRandomString2 ¶
GenerateRandomString2 随机字符串
func ParseNumber ¶
ParseNumber parse interface to number
func ParseString ¶ added in v1.0.1
ParseString parse interface to string
Types ¶
type Map ¶
type Map map[string]interface{}
Map Map
func (Map) Check ¶ added in v1.0.1
Check check all input keys return -1 if all is exist return index when not found
func (Map) GetMapArray ¶ added in v1.0.1
GetMapArray get map from map with out default
func (Map) GetMapArrayD ¶ added in v1.0.1
GetMapArrayD get map from map with default
func (Map) GetNumberD ¶
GetNumberD get float64 from map with default
func (Map) GetPath ¶ added in v1.0.1
GetPath returns the element in the tree indicated by 'keys'. If keys is of length zero, the current tree is returned.
func (Map) GetStringD ¶
GetStringD get string from map with default
func (Map) HasPath ¶ added in v1.0.1
HasPath returns true if the given path of keys exists, false otherwise.
func (Map) ReplaceJoin ¶
ReplaceJoin insert map s to m with replace
type RandomKind ¶
type RandomKind int
RandomKind RandomKind
const ( RandomNum RandomKind = iota // 纯数字 RandomLower // 小写字母 RandomUpper // 大写字母 RandomLowerNum // 数字、小写字母 RandomUpperNum // 数字、大写字母 RandomAll // 数字、大小写字母 )
random kinds