-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwire_gen.go
136 lines (128 loc) · 4.84 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
// Code generated by Wire. DO NOT EDIT.
//go:generate go run -mod=mod github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package cmd
import (
"context"
"github.com/google/wire"
"github.com/michaljurecko/ch-demo/internal/pkg/app/demo/ares"
"github.com/michaljurecko/ch-demo/internal/pkg/app/demo/biz/playerbiz"
"github.com/michaljurecko/ch-demo/internal/pkg/app/demo/config"
"github.com/michaljurecko/ch-demo/internal/pkg/app/demo/model/gen"
"github.com/michaljurecko/ch-demo/internal/pkg/app/demo/server"
"github.com/michaljurecko/ch-demo/internal/pkg/app/demo/service"
"github.com/michaljurecko/ch-demo/internal/pkg/common/cachestore"
"github.com/michaljurecko/ch-demo/internal/pkg/common/dataverse/webapi"
"github.com/michaljurecko/ch-demo/internal/pkg/common/distlock"
"github.com/michaljurecko/ch-demo/internal/pkg/common/httpclient"
"github.com/michaljurecko/ch-demo/internal/pkg/common/log"
"github.com/michaljurecko/ch-demo/internal/pkg/common/redis"
"github.com/michaljurecko/ch-demo/internal/pkg/common/shutdown"
"github.com/michaljurecko/ch-demo/internal/pkg/common/telemetry"
config2 "github.com/michaljurecko/ch-demo/internal/pkg/common/telemetry/config"
"github.com/michaljurecko/ch-demo/internal/pkg/common/validate"
)
// Injectors from wire.go:
func NewServer(ctx context.Context) (*server.Server, error) {
validatorValidate := validate.New()
configConfig, err := config.Load(validatorValidate)
if err != nil {
return nil, err
}
config3 := configConfig.Server
stack := shutdown.NewStack(ctx)
config4 := configConfig.Logger
logger, err := log.NewLogger(ctx, stack, config4)
if err != nil {
return nil, err
}
webapiConfig := configConfig.Model
config5 := configConfig.Telemetry
traceConfig := config2.GetTraceConfig(config5)
tracerProvider, err := telemetry.NewTracerProvider(ctx, logger, stack, traceConfig)
if err != nil {
return nil, err
}
metricConfig := config2.GetMetricConfig(config5)
meterProvider, err := telemetry.NewMeterProvider(ctx, logger, stack, metricConfig)
if err != nil {
return nil, err
}
client := httpclient.New(tracerProvider, meterProvider)
webapiClient, err := webapi.NewClient(ctx, webapiConfig, client)
if err != nil {
return nil, err
}
repository := model.NewRepository(webapiClient)
config6 := configConfig.Redis
redisClient, err := redis.NewClient(ctx, stack, logger, config6, tracerProvider, meterProvider)
if err != nil {
return nil, err
}
store := cachestore.New(redisClient)
locker := distlock.NewLocker(redisClient)
aresClient := ares.NewClient(client)
playerbizService := playerbiz.NewService(aresClient)
serviceService, err := service.New(ctx, logger, configConfig, repository, store, locker, playerbizService)
if err != nil {
return nil, err
}
serverServer, err := server.New(config3, serviceService, logger, stack, tracerProvider, meterProvider)
if err != nil {
return nil, err
}
return serverServer, nil
}
func NewServerForTest(ctx context.Context, cfgFn config.Decorator) (*server.Server, error) {
validatorValidate := validate.New()
configConfig, err := config.ForTest(validatorValidate, cfgFn)
if err != nil {
return nil, err
}
config3 := configConfig.Server
stack := shutdown.NewStack(ctx)
config4 := configConfig.Logger
logger, err := log.NewLogger(ctx, stack, config4)
if err != nil {
return nil, err
}
webapiConfig := configConfig.Model
config5 := configConfig.Telemetry
traceConfig := config2.GetTraceConfig(config5)
tracerProvider, err := telemetry.NewTracerProvider(ctx, logger, stack, traceConfig)
if err != nil {
return nil, err
}
metricConfig := config2.GetMetricConfig(config5)
meterProvider, err := telemetry.NewMeterProvider(ctx, logger, stack, metricConfig)
if err != nil {
return nil, err
}
client := httpclient.New(tracerProvider, meterProvider)
webapiClient, err := webapi.NewClient(ctx, webapiConfig, client)
if err != nil {
return nil, err
}
repository := model.NewRepository(webapiClient)
config6 := configConfig.Redis
redisClient, err := redis.NewClient(ctx, stack, logger, config6, tracerProvider, meterProvider)
if err != nil {
return nil, err
}
store := cachestore.New(redisClient)
locker := distlock.NewLocker(redisClient)
aresClient := ares.NewClient(client)
playerbizService := playerbiz.NewService(aresClient)
serviceService, err := service.New(ctx, logger, configConfig, repository, store, locker, playerbizService)
if err != nil {
return nil, err
}
serverServer, err := server.New(config3, serviceService, logger, stack, tracerProvider, meterProvider)
if err != nil {
return nil, err
}
return serverServer, nil
}
// wire.go:
var set = wire.NewSet(log.WireSet, shutdown.WireSet, telemetry.WireSet, validate.WireSet, config.WireSet, httpclient.WireSet, redis.WireSet, cachestore.WireSet, distlock.WireSet, webapi.NewClient, ares.NewClient, model.NewRepository, playerbiz.WireSet, service.New, server.New)