Documentation ¶
Index ¶
- func After(n int, fun interface{}) interface{}
- func Before(n int, fun interface{}) interface{}
- func Bytes2String(b []byte) string
- func CamelCase(s string, sep ...string) string
- func Concat(arr1 interface{}, arr2 ...interface{}) interface{}
- func DropFields(v interface{}, fields ...string) ([]byte, error)
- func DropMapFields(m map[string]interface{}, keys ...string) (map[string]interface{}, error)
- func Fill(arr interface{}, value interface{}, options ...int)
- func Filter(arr interface{}, callback func(ele interface{}, index int) bool) (interface{}, bool)
- func Find(arr interface{}, callback func(ele interface{}, index int) bool) (interface{}, bool)
- func Hash(str string) uint64
- func If(condition bool, trueValue, falseValue interface{}) interface{}
- func IsEqual(obj1 interface{}, obj2 interface{}) bool
- func IsFunc(fun interface{}) bool
- func IsNum(s string) bool
- func JSON2Map(jsonStr []byte) (map[string]interface{}, error)
- func LowerFirst(s string) string
- func Map2JSON(mapValue map[string]interface{}) (string, error)
- func Map2Struct(mapValue map[string]interface{}, obj interface{}) error
- func RandStrWithLower(n ...int) string
- func RandStrWithNum(n ...int) string
- func RandStrWithUpper(n ...int) string
- func RandString(n ...int) string
- func Remove(arr interface{}, index int, order ...bool)
- func SelectFields(v interface{}, fields ...string) ([]byte, error)
- func Shuffle(arr interface{})
- func SnakeCase(s string, sep ...string) string
- func Str2MD5(str []byte) string
- func String2Bytes(s string) []byte
- func Struct2Map(obj interface{}) map[string]interface{}
- func UUID() string
- func UpperFirst(s string) string
- type CronTime
- type Crontab
- type Job
- type Multimap
- func (multimap *Multimap) At(key interface{}) ([]interface{}, bool)
- func (multimap *Multimap) Count(key interface{}) int
- func (multimap *Multimap) Insert(key interface{}, value interface{})
- func (multimap *Multimap) InsertValues(key interface{}, values []interface{})
- func (multimap *Multimap) IsEmpty() bool
- func (multimap *Multimap) Remove(key interface{}, value interface{})
- func (multimap *Multimap) RemoveAll(key interface{})
- func (multimap *Multimap) Size() int
- type Queue
- func (q *Queue) Get() (interface{}, bool, uint64)
- func (q *Queue) GetCapacity() uint64
- func (q *Queue) GetQuantity() uint64
- func (q *Queue) Gets(values []interface{}) (int, uint64)
- func (q *Queue) Put(value interface{}) (bool, uint64)
- func (q *Queue) Puts(values []interface{}) (int, uint64)
- func (q *Queue) ToString() string
- type ScheduleType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Concat ¶ added in v0.1.4
func Concat(arr1 interface{}, arr2 ...interface{}) interface{}
Concat 拼接切片
func DropFields ¶
DropFields 选择性的抛弃struct的一些字段
func DropMapFields ¶ added in v0.2.4
DropMapFields 针对map选择性字段
func If ¶ added in v0.2.2
func If(condition bool, trueValue, falseValue interface{}) interface{}
If 三元表达式 If(a > b, c, d)
func IsEqual ¶ added in v0.1.5
func IsEqual(obj1 interface{}, obj2 interface{}) bool
IsEqual 判断两个对象是否相同
func Map2Struct ¶
Map2Struct 将map对象转换成结构体
func RandStrWithLower ¶ added in v0.2.0
RandStrWithLower 随机生成小写字母字符串
func RandStrWithUpper ¶ added in v0.2.0
RandStrWithUpper 随机生成大写字母字符串
func SelectFields ¶
SelectFields 针对性的选择struct字段输出
Types ¶
type CronTime ¶ added in v0.2.5
type CronTime struct { Type ScheduleType `json:"type"` Year string `json:"year"` Month string `json:"month"` Day string `json:"day"` Hour string `json:"hour"` Minute string `json:"minute"` Week string `json:"week"` Key string `json:"key"` }
CronTime 时间结构
func (*CronTime) ToSpec ¶ added in v0.2.5
ToSpec 转换成spec函数 【周期性】 【每年】 输入[月][日][时][分] -- 30 22 1 1 * 每年的1月1日22点30分执行 【已验证】 【每月】 输入[日][时][分] -- 30 22 1 * * 每月1日22点30分执行 【已验证】 【每天】 输入[时][分] -- 30 22 * * * 每天22点30分执行,【已验证】 【每周】 输入[星期][时][分] -- 30 22 * * 1 每周一22点30分执行 【已验证】 【每小时】输入[分] -- 15 * * * * 每小时的15分执行 【已验证】 【每隔几月】 输入[月][日][时][分] -- 30 22 3 */3 * 【每隔几天】 输入[日][时][分] -- 30 22 */3 * * 每隔3天的22点30分执行 【每隔小时】 输入[时][分] -- @every 1h30m 每隔1小时30分执行 【一次性】 输入[年][月][日][时][分] 由于cron不支持一次性任务,所以只能通过周期性时间删除自身解决。
type Crontab ¶ added in v0.2.5
type Crontab struct {
// contains filtered or unexported fields
}
Crontab 定时任务调度器
func (*Crontab) GetEntries ¶ added in v0.2.5
func (c *Crontab) GetEntries() []cron.Entry
GetEntries 获得所有实体
type Multimap ¶ added in v0.2.3
type Multimap struct {
// contains filtered or unexported fields
}
Multimap 允许key值重复
func (*Multimap) Insert ¶ added in v0.2.3
func (multimap *Multimap) Insert(key interface{}, value interface{})
Insert 插入一条记录
func (*Multimap) InsertValues ¶ added in v0.2.3
func (multimap *Multimap) InsertValues(key interface{}, values []interface{})
InsertValues 插入多条记录
func (*Multimap) Remove ¶ added in v0.2.3
func (multimap *Multimap) Remove(key interface{}, value interface{})
Remove 移除一条记录
type Queue ¶ added in v0.2.4
type Queue struct {
// contains filtered or unexported fields
}
Queue 无锁队列
func (*Queue) GetQuantity ¶ added in v0.2.4
GetQuantity 获取当前队列剩余多少条记录
type ScheduleType ¶ added in v0.2.5
type ScheduleType int32
ScheduleType 时间表类型
const ( Yearly ScheduleType = 1 // 每年 Monthly ScheduleType = 2 // 每月 Weekly ScheduleType = 3 // 每周 Daily ScheduleType = 4 // 每天 Hourly ScheduleType = 5 // 每小时 IntervalMonth ScheduleType = 6 // 每隔几个月 IntervalDay ScheduleType = 7 // 每隔几天 Every ScheduleType = 8 // 间隔时间,只支持[时][分] Once ScheduleType = 9 // 一次性 )
定时任务的时间表类型