21 lines
326 B
Go
Executable File
21 lines
326 B
Go
Executable File
package scheduler
|
|
|
|
import cron "github.com/robfig/cron/v3"
|
|
|
|
func getParser() cron.Parser {
|
|
return cron.NewParser(
|
|
cron.SecondOptional |
|
|
cron.Minute |
|
|
cron.Hour |
|
|
cron.Dom |
|
|
cron.Month |
|
|
cron.Dow |
|
|
cron.Descriptor,
|
|
)
|
|
}
|
|
|
|
func validCron(s string) bool {
|
|
_, err := getParser().Parse(s)
|
|
return err == nil
|
|
}
|