Documentation
¶
Index ¶
- Constants
- Variables
- 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 GZipCompress(data []byte) []byte
- func GZipUnCompress(data []byte) ([]byte, error)
- func GetIPv4ByInterface(name string) ([]string, error)
- 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 NewRandom(randomStringSeed string) *random
- 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 ZlibCompress(data []byte) []byte
- func ZlibUnCompress(data []byte) ([]byte, error)
- type Address
- type CryptoType
- type DateTime
- func (this *DateTime) Add(d time.Duration) *DateTime
- func (this *DateTime) AddDate(years int, months int, days int) *DateTime
- func (this *DateTime) Daily(addDays int) *DateTime
- func (this *DateTime) Expire(t, v int) (ttl *DateTime, err error)
- func (this *DateTime) Format(layout ...string) string
- func (this *DateTime) Monthly(addMonth int) *DateTime
- func (this *DateTime) New(t time.Time) *DateTime
- func (this *DateTime) Now() time.Time
- func (this *DateTime) Parse(value string, layout ...string) (*DateTime, error)
- func (this *DateTime) Sign(addDays int) (sign int32, str string)
- func (this *DateTime) String() string
- func (this *DateTime) TimeReset(args ...int)
- func (this *DateTime) TimeZone(zone string)
- func (this *DateTime) Timestamp(v int64) *DateTime
- func (this *DateTime) Unix() int64
- func (this *DateTime) Weekly(addWeeks int) *DateTime
- type Emitter
- type EventsFunc
- 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
- type Worker
Constants ¶
View Source
const ( DaySecond int64 = 24 * 60 * 60 WeekSecond int64 = DaySecond * 7 )
View Source
const ( DateTimeExpireNone int = 0 DateTimeExpireDaily = 1 DateTimeExpireWeekly = 2 DateTimeExpireMonthly = 3 DateTimeExpireSecond = 4 DateTimeExpireCustomize = 5 )
Variables ¶
View Source
var Crypto *crypto
View Source
var Random *random
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 GZipCompress ¶
func GZipUnCompress ¶
func GetIPv4ByInterface ¶
GetIPv4ByInterface return IPv4 address from a specific interface IPv4 addresses
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 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 DateTime ¶
type DateTime struct { WeekStartDay int //每周开始时间,默认周一 1:周一,0:周日 // contains filtered or unexported fields }
var Time *DateTime
type Emitter ¶
type Emitter struct {
// contains filtered or unexported fields
}
func NewEmitter ¶
func (*Emitter) On ¶
func (this *Emitter) On(ename string, callback EventsFunc)
type EventsFunc ¶
type EventsFunc func() error
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.