added Cron.Jobs() method

This commit is contained in:
Gani Georgiev
2024-12-22 16:05:38 +02:00
parent f27d9f1dc9
commit bae5421d62
5 changed files with 163 additions and 22 deletions

View File

@@ -35,6 +35,8 @@ type Schedule struct {
Days map[int]struct{} `json:"days"`
Months map[int]struct{} `json:"months"`
DaysOfWeek map[int]struct{} `json:"daysOfWeek"`
rawExpr string
}
// IsDue checks whether the provided Moment satisfies the current Schedule.
@@ -130,6 +132,7 @@ func NewSchedule(cronExpr string) (*Schedule, error) {
Days: days,
Months: months,
DaysOfWeek: daysOfWeek,
rawExpr: cronExpr,
}, nil
}