Documentation ¶
Index ¶
- func ComparatorByte(a, b interface{}) int
- func ComparatorFloat32(a, b interface{}) int
- func ComparatorFloat64(a, b interface{}) int
- func ComparatorInt(a, b interface{}) int
- func ComparatorInt16(a, b interface{}) int
- func ComparatorInt32(a, b interface{}) int
- func ComparatorInt64(a, b interface{}) int
- func ComparatorInt8(a, b interface{}) int
- func ComparatorRune(a, b interface{}) int
- func ComparatorString(a, b interface{}) int
- func ComparatorTime(a, b interface{}) int
- func ComparatorUint(a, b interface{}) int
- func ComparatorUint16(a, b interface{}) int
- func ComparatorUint32(a, b interface{}) int
- func ComparatorUint64(a, b interface{}) int
- func ComparatorUint8(a, b interface{}) int
- func IsEmpty(value interface{}) bool
- func ItemValue(item interface{}, key interface{}) (value interface{}, found bool)
- func Keys(mapOrStruct interface{}) (keysOrAttrs []string)
- func ListItemValues(list interface{}, key interface{}, subKey ...interface{}) (values []interface{})
- func ListItemValuesUnique(list interface{}, key string, subKey ...interface{}) []interface{}
- func NiceCallFunc(f func())
- func ProtoMarshal(msg proto.Message) (uint32, []byte)
- func RandFloat64(min float64, max float64) float64
- func RandFloat64Max(max float64) float64
- func RandInt(min int, max int) int
- func RandInt32(min int32, max int32) int32
- func RandInt32Max(max int32) int32
- func RandInt64(min int64, max int64) int64
- func RandInt64Max(max int64) int64
- func RandIntMax(max int) int
- func RandPerm(n int) []int
- func RandSeq(size int) string
- func Random() float64
- func SliceCopy(data []interface{}) []interface{}
- func SliceDelete(data []interface{}, index int) (newSlice []interface{})
- func Try(try func()) (err error)
- func TryCatch(try func(), catch ...func(exception error))
- func Values(mapOrStruct interface{}) (values []interface{})
- type Comparator
- type Jwt
- func (j *Jwt) Decode(auth string) (fieldValue interface{}, err error)
- func (j *Jwt) DecodeInt(auth string) (fieldValue int, err error)
- func (j *Jwt) DecodeInt32(auth string) (fieldValue int32, err error)
- func (j *Jwt) DecodeInt64(auth string) (fieldValue int64, err error)
- func (j *Jwt) DecodeInt8(auth string) (fieldValue int8, err error)
- func (j *Jwt) DecodeString(auth string) (fieldValue string, err error)
- func (j *Jwt) DecodeUint(auth string) (fieldValue uint, err error)
- func (j *Jwt) DecodeUint32(auth string) (fieldValue uint32, err error)
- func (j *Jwt) DecodeUint64(auth string) (fieldValue uint64, err error)
- func (j *Jwt) DecodeUint8(auth string) (fieldValue uint8, err error)
- func (j *Jwt) Encode(fieldValue interface{}) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ComparatorByte ¶
func ComparatorByte(a, b interface{}) int
ComparatorByte provides a basic comparison on byte.
func ComparatorFloat32 ¶
func ComparatorFloat32(a, b interface{}) int
ComparatorFloat32 provides a basic comparison on float32.
func ComparatorFloat64 ¶
func ComparatorFloat64(a, b interface{}) int
ComparatorFloat64 provides a basic comparison on float64.
func ComparatorInt ¶
func ComparatorInt(a, b interface{}) int
ComparatorInt provides a basic comparison on int.
func ComparatorInt16 ¶
func ComparatorInt16(a, b interface{}) int
ComparatorInt16 provides a basic comparison on int16.
func ComparatorInt32 ¶
func ComparatorInt32(a, b interface{}) int
ComparatorInt32 provides a basic comparison on int32.
func ComparatorInt64 ¶
func ComparatorInt64(a, b interface{}) int
ComparatorInt64 provides a basic comparison on int64.
func ComparatorInt8 ¶
func ComparatorInt8(a, b interface{}) int
ComparatorInt8 provides a basic comparison on int8.
func ComparatorRune ¶
func ComparatorRune(a, b interface{}) int
ComparatorRune provides a basic comparison on rune.
func ComparatorString ¶
func ComparatorString(a, b interface{}) int
ComparatorString provides a fast comparison on strings.
func ComparatorTime ¶
func ComparatorTime(a, b interface{}) int
ComparatorTime provides a basic comparison on time.Time.
func ComparatorUint ¶
func ComparatorUint(a, b interface{}) int
ComparatorUint provides a basic comparison on uint.
func ComparatorUint16 ¶
func ComparatorUint16(a, b interface{}) int
ComparatorUint16 provides a basic comparison on uint16.
func ComparatorUint32 ¶
func ComparatorUint32(a, b interface{}) int
ComparatorUint32 provides a basic comparison on uint32.
func ComparatorUint64 ¶
func ComparatorUint64(a, b interface{}) int
ComparatorUint64 provides a basic comparison on uint64.
func ComparatorUint8 ¶
func ComparatorUint8(a, b interface{}) int
ComparatorUint8 provides a basic comparison on uint8.
func IsEmpty ¶
func IsEmpty(value interface{}) bool
IsEmpty checks whether given <value> empty. It returns true if <value> is in: 0, nil, false, "", len(slice/map/chan) == 0, or else it returns false.
func ItemValue ¶
func ItemValue(item interface{}, key interface{}) (value interface{}, found bool)
ItemValue retrieves and returns its value of which name/attribute specified by `key`. The parameter `battle` can be type of map/*map/struct/*struct.
func Keys ¶
func Keys(mapOrStruct interface{}) (keysOrAttrs []string)
Keys retrieves and returns the keys from given map or struct.
func ListItemValues ¶
func ListItemValues(list interface{}, key interface{}, subKey ...interface{}) (values []interface{})
ListItemValues retrieves and returns the elements of all battle struct/map with key `key`. Note that the parameter `list` should be type of slice which contains elements of map or struct, or else it returns an empty slice.
The parameter `list` supports types like: []map[string]interface{} []map[string]sub-map []struct []struct:sub-struct Note that the sub-map/sub-struct makes sense only if the optional parameter `subKey` is given.
func ListItemValuesUnique ¶
func ListItemValuesUnique(list interface{}, key string, subKey ...interface{}) []interface{}
ListItemValuesUnique retrieves and returns the unique elements of all struct/map with key `key`. Note that the parameter `list` should be type of slice which contains elements of map or struct, or else it returns an empty slice.
func NiceCallFunc ¶
func NiceCallFunc(f func())
NiceCallFunc calls function <f> with exception capture logic.
func ProtoMarshal ¶ added in v1.0.2
ProtoMarshal 获取MsgId/MsgData
func RandFloat64 ¶
func RandFloat64Max ¶
func RandInt32Max ¶
func RandInt64Max ¶
func RandIntMax ¶
func RandPerm ¶ added in v1.0.1
RandPerm returns, as a slice of n int numbers, a pseudo-random permutation of the integers [0,n).
func SliceCopy ¶
func SliceCopy(data []interface{}) []interface{}
SliceCopy does a shallow copy of slice `data` for most commonly used slice type []interface{}.
func SliceDelete ¶
func SliceDelete(data []interface{}, index int) (newSlice []interface{})
SliceDelete deletes an element at `index` and returns the new slice. It does nothing if the given `index` is invalid.
func Try ¶
func Try(try func()) (err error)
Try implements try... logistics using internal panic...recover. It returns error if any exception occurs, or else it returns nil.
Types ¶
type Comparator ¶
type Comparator func(a, b interface{}) int
Comparator is a function that compare a and b, and returns the result as int.
Should return a number:
negative , if a < b zero , if a == b positive , if a > b