init
This commit is contained in:
22
local/utl/cron/cron.go
Normal file
22
local/utl/cron/cron.go
Normal file
@@ -0,0 +1,22 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user