mirror of
https://github.com/crawlab-team/crawlab.git
synced 2026-01-21 17:21:09 +01:00
38 lines
718 B
Go
38 lines
718 B
Go
package schedule
|
|
|
|
import (
|
|
"github.com/crawlab-team/crawlab/core/interfaces"
|
|
"time"
|
|
)
|
|
|
|
type Option func(svc interfaces.ScheduleService)
|
|
|
|
func WithConfigPath(path string) Option {
|
|
return func(svc interfaces.ScheduleService) {
|
|
svc.SetConfigPath(path)
|
|
}
|
|
}
|
|
|
|
func WithLocation(loc *time.Location) Option {
|
|
return func(svc interfaces.ScheduleService) {
|
|
svc.SetLocation(loc)
|
|
}
|
|
}
|
|
|
|
func WithDelayIfStillRunning() Option {
|
|
return func(svc interfaces.ScheduleService) {
|
|
svc.SetDelay(true)
|
|
}
|
|
}
|
|
|
|
func WithSkipIfStillRunning() Option {
|
|
return func(svc interfaces.ScheduleService) {
|
|
svc.SetSkip(true)
|
|
}
|
|
}
|
|
|
|
func WithUpdateInterval(interval time.Duration) Option {
|
|
return func(svc interfaces.ScheduleService) {
|
|
}
|
|
}
|