Documentation ¶
Index ¶
- func Close()
- func Date() string
- func DateStr(str string) string
- func DiffMs(pre, back int64) int64
- func GetAge(birth string, parseStr string) int
- func GetDateStr(ts int64, day int, hour int) string
- func GetDayBegin(ts int64, day int, hour int) int64
- func GetDeltaDays(t1, t2 int64) int
- func GetMondayUnix(hour int) int64
- func IsHoliday() bool
- func IsToday(ts int64) bool
- func IsoCalendar(nowTime int64) (year, week, weekday int)
- func Now() time.Time
- func NowHour() int
- func NowWeekDay() time.Weekday
- func ParseTime(str string) (time.Time, error)
- func PushTask(task Task)
- func Sched()
- func Unix() int64
- func UnixMs() int64
- func UnixNano() int64
- func UnixTime(sec, nsec int64) time.Time
- func YearMonth() int
- func YearMonthDay() int
- type Hook
- type LocalScheduler
- type Task
- type Timer
- type TimerCondition
- type TimerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetDeltaDays ¶
func YearMonthDay ¶
func YearMonthDay() int
Types ¶
type LocalScheduler ¶
type LocalScheduler interface {
Schedule(Task)
}
LocalScheduler schedules task to a customized goroutine
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer represents a cron job
func NewAfterTimer ¶
NewAfterTimer returns a new Timer containing a function that will be called after duration that specified by the duration argument. The duration d must be greater than zero; if not, NewAfterTimer will panic. Stop the timer to release associated resources.
func NewCondTimer ¶
func NewCondTimer(condition TimerCondition, fn TimerFunc) *Timer
NewCondTimer returns a new Timer containing a function that will be called when condition satisfied that specified by the condition argument. The duration d must be greater than zero; if not, NewCondTimer will panic. Stop the timer to release associated resources.
func NewCountTimer ¶
NewCountTimer returns a new Timer containing a function that will be called with a period specified by the duration argument. After count times, timer will be stopped automatically, It adjusts the intervals for slow receivers. The duration d must be greater than zero; if not, NewCountTimer will panic. Stop the timer to release associated resources.
func NewTimer ¶
NewTimer returns a new Timer containing a function that will be called with a period specified by the duration argument. It adjusts the intervals for slow receivers. The duration d must be greater than zero; if not, NewTimer will panic. Stop the timer to release associated resources.
type TimerCondition ¶
TimerCondition represents a checker that returns true when cron job needs to execute