Files
crawlab/core/schedule/options.go
2024-06-14 15:42:50 +08:00

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) {
}
}