-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
wire_gen.go
43 lines (35 loc) · 1.14 KB
/
wire_gen.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Code generated by Wire. DO NOT EDIT.
//go:generate go run github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package main
import (
"github.com/SkYNewZ/gh-stars-search-engine/internal/logging"
"github.com/SkYNewZ/gh-stars-search-engine/internal/slogx"
"github.com/robfig/cron/v3"
"log/slog"
"time"
)
// Injectors from wire.go:
// setupScheduler is used by wire to inject the scheduler.
func setupScheduler(location string, logger *slog.Logger) (*cron.Cron, error) {
timeLocation, err := provideSchedulerLocation(location)
if err != nil {
return nil, err
}
v := provideSchedulerOptions(timeLocation, logger)
cronCron := cron.New(v...)
return cronCron, nil
}
func provideSchedulerLocation(location string) (*time.Location, error) {
timeLocation, err := time.LoadLocation(location)
if err != nil {
return nil, err
}
return timeLocation, nil
}
// wire.go:
func provideSchedulerOptions(loc *time.Location, logger *slog.Logger) []cron.Option {
schedulerLogger := logger.With(slogx.Component("scheduler"))
return []cron.Option{cron.WithLocation(loc), cron.WithLogger(logging.NewLoggerScheduler(schedulerLogger))}
}