Documentation
¶
Index ¶
- Constants
- Variables
- func Assert(ps ...func() error) (err error)
- func BytesToInt(b []byte, n interface{}) error
- func Ceil[T constraints.Integer](a, b T) (r T)
- func CloneMap[T1 comparable, T2 comparable](src map[T1]T2) map[T1]T2
- 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 IPv4Decode(code uint64) string
- func IPv4Encode(address string) uint64
- func IncludeNotPrintableChar(s string) bool
- func IntToBuffer(buffer *bytes.Buffer, n interface{}) error
- func IntToBytes(n interface{}) ([]byte, error)
- func IsOsBindError(err error) bool
- func LocalIPv4() (ip string, err error)
- func LocalIPv4s() ([]string, error)
- func LocalValid(ip string) bool
- func MD5(data string) string
- func MapKeys[T1 comparable, T2 comparable](src map[T1]T2) []T1
- func Max[T constraints.Integer](nums ...T) (r T)
- func Min[T constraints.Integer](nums ...T) (r T)
- 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 Sprintf(format interface{}, args ...interface{}) (r string)
- 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) Encode() uint64
- 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) Local(withPort ...bool) string
- func (this *Address) Parse(address string)
- func (this *Address) String(withScheme ...bool) string
- func (this *Address) Valid() bool
- 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 CloneMap ¶ added in v1.3.0
func CloneMap[T1 comparable, T2 comparable](src map[T1]T2) map[T1]T2
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 IPv4Decode ¶ added in v1.2.0
func IPv4Encode ¶ added in v1.2.0
IPv4Encode Ip2Int Ipv4 转uint64
func IncludeNotPrintableChar ¶ added in v1.0.7
func IntToBuffer ¶
IntToBuffer 将数字写入BUFFER, buffer := bytes.NewBuffer([]byte{})
func LocalIPv4s ¶
LocalIPv4s return all non-loopback IPv4 addresses
func MapKeys ¶ added in v1.5.3
func MapKeys[T1 comparable, T2 comparable](src map[T1]T2) []T1
func Max ¶ added in v1.3.0
func Max[T constraints.Integer](nums ...T) (r T)
func Min ¶ added in v1.3.0
func Min[T constraints.Integer](nums ...T) (r T)
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
Click to show internal directories.
Click to hide internal directories.