-
Notifications
You must be signed in to change notification settings - Fork 0
/
wire_gen.go
52 lines (47 loc) · 1.65 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
// 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/elct9620/wvs/internal/app"
"github.com/elct9620/wvs/internal/app/api"
"github.com/elct9620/wvs/internal/app/web"
"github.com/elct9620/wvs/internal/app/ws"
"github.com/elct9620/wvs/internal/config"
"github.com/elct9620/wvs/internal/db"
"github.com/elct9620/wvs/internal/repository/inmemory"
"github.com/elct9620/wvs/internal/subscriber"
"github.com/elct9620/wvs/internal/usecase"
)
// Injectors from wire.go:
func Initialize() (*app.Application, error) {
scene := web.NewScene()
webWeb := web.New(scene)
database, err := db.NewDatabase()
if err != nil {
return nil, err
}
matchRepository := inmemory.NewMatchRepository(database)
streamRepository := ws.NewStreamRepository()
createMatchCommand := usecase.NewCreateMatchCommand(matchRepository, streamRepository)
v := api.ProvideRoutes(createMatchCommand)
apiApi := api.New(v...)
subscribeCommand := usecase.NewSubscribeCommand(streamRepository)
webSocket := ws.New(subscribeCommand, streamRepository)
viper, err := config.NewViperWithDefaults()
if err != nil {
return nil, err
}
appConfig := app.NewConfig(viper)
mux := app.ProvideHttpServer(webWeb, apiApi, webSocket, appConfig)
notifyJoinMatchCommand := usecase.NewNotifyJoinMatchCommand(streamRepository)
v2 := subscriber.ProvideDatabaseSubscribers(notifyJoinMatchCommand)
v3 := app.ProvideEventSubscribers(database, v2)
router, err := app.ProvideEventBus(v3...)
if err != nil {
return nil, err
}
application := app.New(mux, appConfig, router)
return application, nil
}