New returns a new Cron job runner, modified by the given options. Available Settings Time Zone Description: The time zone in which schedules are interpreted Default: time.Local Parser Description: Parser converts cron spec strings into cron.Schedules. Default: Accepts this spec: https://e
(opts ...Option)
| 111 | // |
| 112 | // See "cron.With*" to modify the default behavior. |
| 113 | func New(opts ...Option) *Cron { |
| 114 | c := &Cron{ |
| 115 | entries: nil, |
| 116 | chain: NewChain(), |
| 117 | add: make(chan *Entry), |
| 118 | stop: make(chan struct{}), |
| 119 | snapshot: make(chan chan []Entry), |
| 120 | remove: make(chan EntryID), |
| 121 | running: false, |
| 122 | runningMu: sync.Mutex{}, |
| 123 | logger: DefaultLogger, |
| 124 | location: time.Local, |
| 125 | parser: standardParser, |
| 126 | } |
| 127 | for _, opt := range opts { |
| 128 | opt(c) |
| 129 | } |
| 130 | return c |
| 131 | } |
| 132 | |
| 133 | // FuncJob is a wrapper that turns a func() into a cron.Job |
| 134 | type FuncJob func() |