Documentation
¶
Index ¶
- Constants
- Variables
- func Assert(ps ...func() error) (err error)
- func BytesToInt(b []byte, n interface{}) error
- func ConditionalOperator(op bool, a, b interface{}) interface{}
- func Empty(data interface{}) bool
- func EmptyReflect(object interface{}) bool
- func FloatPrecision(value float64, precision float64) float64
- func GZipCompress(data []byte) []byte
- func GZipUnCompress(data []byte) ([]byte, error)
- func GetIPv4ByInterface(name string) ([]string, error)
- func IncludeNotPrintableChar(s string) bool
- func Int32SliceIndexOf(s []int32, tar int32) int
- func IntToBuffer(buffer *bytes.Buffer, n interface{}) error
- func IntToBytes(n interface{}) ([]byte, error)
- func Ipv4Decode(code uint64) string
- func Ipv4Encode(address string) uint64
- func IsOsBindError(err error) bool
- func LocalIPv4s() ([]string, error)
- func MD5(data string) string
- func NewCrypto(encoding *base64.Encoding) *crypto
- func NewUrl(address, scheme string) (*url.URL, error)
- func PKCS7Padding(data []byte, blockSize int) []byte
- func PKCS7UnPadding(data []byte) []byte
- func SHA256(message string) string
- func SliceStringToInt32(s []string) []int32
- func Sprintf(format interface{}, args ...interface{}) (r string)
- func StringSliceIndexOf(s []string, tar string) int
- func Timeout(d time.Duration, fn func() error) error
- func Try(f func(), handle ...TryHandle)
- func UTF8StringLen(str string) int
- func ZlibCompress(data []byte) []byte
- func ZlibUnCompress(data []byte) ([]byte, error)
- type Address
- func (this *Address) Empty() bool
- func (this *Address) Handle(handle func(network, address string) error) (err error)
- func (this *Address) HandleWithNetwork(handle func(address string) error) (err error)
- func (this *Address) Parse(address string)
- func (this *Address) String(withScheme ...bool) string
- type CryptoType
- type Job
- type TaskData
- type TimeWheel
- func (tw *TimeWheel) AddTask(interval time.Duration, times int, key interface{}, data TaskData, job Job) error
- func (tw *TimeWheel) RemoveTask(key interface{}) error
- func (tw *TimeWheel) Start()
- func (tw *TimeWheel) Stop()
- func (tw *TimeWheel) UpdateTask(key interface{}, interval time.Duration, taskData TaskData) error
- type TryHandle
Constants ¶
Variables ¶
View Source
var Crypto *crypto
Functions ¶
func BytesToInt ¶
BytesToInt 字节转换成整形,n 必须是指针 var a int32 BytesToInt([]byte{1},&a)
func ConditionalOperator ¶
func ConditionalOperator(op bool, a, b interface{}) interface{}
func EmptyReflect ¶ added in v0.0.2
func EmptyReflect(object interface{}) bool
EmptyReflect 通过反射判断复杂类型是否为空,一般确定参数不为基础类型时才直接使用,否则应该使用 IsEmpty
func FloatPrecision ¶ added in v1.1.0
FloatPrecision 四舍五入,保留到Precision位小数
func GZipCompress ¶
func GZipUnCompress ¶
func GetIPv4ByInterface ¶
GetIPv4ByInterface return IPv4 address from a specific interface IPv4 addresses
func IncludeNotPrintableChar ¶ added in v1.0.7
func Int32SliceIndexOf ¶
func IntToBuffer ¶
IntToBuffer 将数字写入BUFFER, buffer := bytes.NewBuffer([]byte{})
func Ipv4Decode ¶
func LocalIPv4s ¶
LocalIPs return all non-loopback IPv4 addresses
func SliceStringToInt32 ¶
func StringSliceIndexOf ¶
func UTF8StringLen ¶ added in v1.1.0
func ZlibCompress ¶
func ZlibUnCompress ¶
Types ¶
type Address ¶
type Address struct { Port int `json:"port"` Host string `json:"host"` Retry int `json:"retry"` Scheme string `json:"scheme"` }
func (*Address) HandleWithNetwork ¶
HandleWithNetwork network 写入地址中,tcp://0.0.0.0:80
type CryptoType ¶
type CryptoType int
const ( CryptoTypeDES CryptoType = iota //秘钥长度8字节 也就是64位 CryptoTypeAES //秘钥长度位16 24 32 字节 也就是128 192 256位。 CryptoType3DES )
type TimeWheel ¶
type TimeWheel struct {
// contains filtered or unexported fields
}
time wheel struct
func (*TimeWheel) AddTask ¶
func (tw *TimeWheel) AddTask(interval time.Duration, times int, key interface{}, data TaskData, job Job) error
AddTask add new task to the time wheel
func (*TimeWheel) RemoveTask ¶
RemoveTask remove the task from time wheel
Source Files
¶
Click to show internal directories.
Click to hide internal directories.