23 lines
274 B
Go
23 lines
274 B
Go
package cronhu
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/robfig/cron/v3"
|
|
"go.uber.org/dig"
|
|
)
|
|
|
|
func Init(di *dig.Container) *cron.Cron {
|
|
|
|
c := cron.New()
|
|
err := di.Provide(func() *cron.Cron {
|
|
return c
|
|
})
|
|
|
|
if err != nil {
|
|
log.Panic("unable to initialize cron!")
|
|
}
|
|
|
|
return c
|
|
}
|