Documentation ¶
Index ¶
- Constants
- Variables
- func AddList(left []uint16, right []uint16) []uint16
- func CharsToString(ca []int8) string
- func CombineList(left []uint16, right []uint16) []uint16
- func CounterDiff(a, b, max uint64) uint64
- func DiffList(left []uint16, right []uint16) []uint16
- func FirstCharToLower(str string) string
- func FirstCharToUpper(str string) string
- func FloatEquals(a, b float64) bool
- func GetDateTime() (localtime string, utctime string, zone int)
- func GetLocation() (country, city string, err error)
- func GetUTCTimestamp() string
- func Ip2uint32Littlendian(ip string) uint32
- func IsValidUrl(str string) bool
- func MD5(text string) string
- func MakePifFilePath(procName, runPath string) (string, error)
- func MaxUInt(x, y uint64) uint64
- func MinUInt(x, y uint64) uint64
- func PrintStruct(data interface{})
- func ReadLines(filename string) ([]string, error)
- func ScanPidLine(content []byte) int
- func TryToFloat64(number interface{}) (float64, bool)
- func TryToInt(key string) interface{}
- func TryToNumber(key string) interface{}
- func UInt32ToipLittlendian(nn uint32) string
- func ValidateIPAddress(val string) bool
- type DateTime
- type ErrNotImplemented
- type InterfaceSet
- type MapStr
- type Set
Constants ¶
const TimeFormat = "2006-01-02 15:04:05"
const TimeZoneFormat = "Z07"
Variables ¶
var EPSILON float64 = 0.0000001
Functions ¶
func CharsToString ¶
func CombineList ¶
CombineList: left + right, remove duplicate elements ex: left=[1,2,3], right=[2,3,4]. result=[1,2,3,4]
func DiffList ¶
DiffList : different list, return: left - right ex: left=[1,2,3], right=[2,3,4]. result=[1]
func FirstCharToLower ¶
func FloatEquals ¶
FloatEquals compare float64 values, can has EPSILON precision
func GetDateTime ¶
func GetLocation ¶
func GetUTCTimestamp ¶
func GetUTCTimestamp() string
func Ip2uint32Littlendian ¶
Ip2uint32Littlendian transport ip to uint32 127.0.0.1<=>16777343
func IsValidUrl ¶
IsValidUrl tests a string to determine if it is a url or not.
func MakePifFilePath ¶
MakePifFilePath make a new pid path default pid lock file: procPath/pid.file or pid lock file: pidFilePath/procName.pid if set runPath
func PrintStruct ¶
func PrintStruct(data interface{})
PrintStruct print struct to json just for debug
func TryToFloat64 ¶
TryToFloat64 try int, uint, float numbers to float64. not work with string and others type
func TryToInt ¶
func TryToInt(key string) interface{}
TryToInt converts value to int, if not a number, return the key
func TryToNumber ¶
func TryToNumber(key string) interface{}
TryToNumber converts string to number, if not a number, return the key
func UInt32ToipLittlendian ¶
UInt32ToipLittlendian transport uint to ip 16777343 <=> 127.0.0.1
func ValidateIPAddress ¶
ValidateIPAddress validates an Ip address.
Types ¶
type DateTime ¶
type DateTime struct { Zone int `json:"timezone"` Datetime string `json:"datetime"` UTCTime string `json:"utctime"` Country string `json:"country"` City string `json:"city"` }
DateTime
type ErrNotImplemented ¶
type ErrNotImplemented struct {
OS string
}
ErrNotImplemented
func (ErrNotImplemented) Error ¶
func (e ErrNotImplemented) Error() string
type InterfaceSet ¶
type InterfaceSet struct {
// contains filtered or unexported fields
}
InterfaceSet
func NewInterfaceSet ¶
func NewInterfaceSet() InterfaceSet
func (*InterfaceSet) Copy ¶
func (s *InterfaceSet) Copy() *InterfaceSet
func (*InterfaceSet) Delete ¶
func (s *InterfaceSet) Delete(key interface{})
func (*InterfaceSet) Exist ¶
func (s *InterfaceSet) Exist(key interface{}) bool
func (*InterfaceSet) Insert ¶
func (s *InterfaceSet) Insert(key interface{})
func (*InterfaceSet) Keys ¶
func (s *InterfaceSet) Keys() map[interface{}]bool
func (*InterfaceSet) Size ¶
func (s *InterfaceSet) Size() int