-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwire_gen.go
101 lines (85 loc) · 3.03 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
// 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/ddatdt12/kapo-play-ws-server/clients/answer"
"github.com/ddatdt12/kapo-play-ws-server/clients/game"
"github.com/ddatdt12/kapo-play-ws-server/infras/db"
"github.com/ddatdt12/kapo-play-ws-server/internal/protocols/http"
"github.com/ddatdt12/kapo-play-ws-server/internal/protocols/http/ws"
"github.com/ddatdt12/kapo-play-ws-server/src/handlers"
"github.com/ddatdt12/kapo-play-ws-server/src/repositories"
"github.com/ddatdt12/kapo-play-ws-server/src/services"
"github.com/google/wire"
)
// Injectors from wire.go:
func InitHttpProtocol() *http.HttpImpl {
redisImpl := db.NewRedisClient()
gameRepository := repositories.NewGameRepository(redisImpl)
gameGameClient := game.NewGameClient()
gameService := services.NewGameService(gameRepository, redisImpl, gameGameClient)
userRepository := repositories.NewUserRepository(redisImpl)
userService := services.NewUserService(userRepository, gameRepository)
questionRepository := repositories.NewQuestionRepository(redisImpl)
leaderboardService := services.NewLeaderboardService(redisImpl)
answerAnswerClient := answer.NewAnswerClient()
answerService := services.NewAnswerService(redisImpl, leaderboardService, answerAnswerClient)
questionService := services.NewQuestionService(questionRepository, gameService, userService, leaderboardService, answerService)
hub := ws.NewHub(gameService, userService, questionService, leaderboardService)
httpHandlerImpl := handlers.NewHttpHandler(gameService)
httpImpl := http.NewHttpProtocol(hub, httpHandlerImpl)
return httpImpl
}
// wire.go:
var questionRepo = wire.NewSet(repositories.NewQuestionRepository, wire.Bind(
new(repositories.IQuestionRepository),
new(*repositories.QuestionRepository),
),
)
var questionSvc = wire.NewSet(services.NewQuestionService, wire.Bind(
new(services.IQuestionService),
new(*services.QuestionService),
),
)
var leaderboardSvc = wire.NewSet(services.NewLeaderboardService, wire.Bind(
new(services.ILeaderboardService),
new(*services.LeaderboardService),
),
)
var gameRepo = wire.NewSet(repositories.NewGameRepository, wire.Bind(
new(repositories.IGameRepository),
new(*repositories.GameRepository),
),
)
var gameSvc = wire.NewSet(services.NewGameService, wire.Bind(
new(services.IGameService),
new(*services.GameService),
),
)
var userRepo = wire.NewSet(repositories.NewUserRepository, wire.Bind(
new(repositories.IUserRepository),
new(*repositories.UserRepository),
),
)
var userSvc = wire.NewSet(services.NewUserService, wire.Bind(
new(services.IUserService),
new(*services.UserService),
),
)
var answerSvc = wire.NewSet(services.NewAnswerService, wire.Bind(
new(services.IAnswerService),
new(*services.AnswerService),
),
)
var answerClient = wire.NewSet(answer.NewAnswerClient, wire.Bind(
new(answer.IAnswerClient),
new(*answer.AnswerClient),
),
)
var gameClient = wire.NewSet(game.NewGameClient, wire.Bind(
new(game.IGameClient),
new(*game.GameClient),
),
)