File tree 1 file changed +29
-0
lines changed
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -636,6 +636,35 @@ func ExampleWithContext() {
636
636
)
637
637
}
638
638
639
+ var _ gocron.Cron = (* customCron )(nil )
640
+
641
+ type customCron struct {}
642
+
643
+ func (c customCron ) IsValid (crontab string , location * time.Location , now time.Time ) error {
644
+ return nil
645
+ }
646
+
647
+ func (c customCron ) Next (lastRun time.Time ) time.Time {
648
+ return time .Now ().Add (time .Second )
649
+ }
650
+
651
+ func ExampleWithCronImplementation () {
652
+ s , _ := gocron .NewScheduler ()
653
+ defer func () { _ = s .Shutdown () }()
654
+ _ , _ = s .NewJob (
655
+ gocron .CronJob (
656
+ "* * * * *" ,
657
+ false ,
658
+ ),
659
+ gocron .NewTask (
660
+ func () {},
661
+ ),
662
+ gocron .WithCronImplementation (
663
+ & customCron {},
664
+ ),
665
+ )
666
+ }
667
+
639
668
func ExampleWithDisabledDistributedJobLocker () {
640
669
// var _ gocron.Locker = (*myLocker)(nil)
641
670
//
You can’t perform that action at this time.
0 commit comments