-
Notifications
You must be signed in to change notification settings - Fork 27
/
wire_gen.go
85 lines (80 loc) · 2.53 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
// Code generated by Wire. DO NOT EDIT.
//go:generate go run github.com/google/wire/cmd/wire
//go:build !wireinject
// +build !wireinject
package service
import (
api4 "github.com/amuluze/amprobe/service/audit/api"
repository4 "github.com/amuluze/amprobe/service/audit/repository"
service4 "github.com/amuluze/amprobe/service/audit/service"
api3 "github.com/amuluze/amprobe/service/auth/api"
repository3 "github.com/amuluze/amprobe/service/auth/repository"
service3 "github.com/amuluze/amprobe/service/auth/service"
"github.com/amuluze/amprobe/service/container/api"
"github.com/amuluze/amprobe/service/container/repository"
"github.com/amuluze/amprobe/service/container/service"
api2 "github.com/amuluze/amprobe/service/host/api"
repository2 "github.com/amuluze/amprobe/service/host/repository"
service2 "github.com/amuluze/amprobe/service/host/service"
"github.com/amuluze/amprobe/service/model"
)
// Injectors from wire.go:
func BuildInjector(configFile string) (*Injector, func(), error) {
config, err := NewConfig(configFile)
if err != nil {
return nil, nil, err
}
store, cleanup, err := InitAuthStore(config)
if err != nil {
return nil, nil, err
}
models := model.NewModels()
db, err := NewDB(config, models)
if err != nil {
cleanup()
return nil, nil, err
}
auther, cleanup2, err := InitAuth(config, store, db)
if err != nil {
cleanup()
return nil, nil, err
}
containerRepo := repository.NewContainerRepo(db)
containerService := service.NewContainerService(containerRepo)
containerAPI := api.NewContainerAPI(containerService)
hostRepo := repository2.NewHostRepo(db)
hostService := service2.NewHostService(hostRepo)
hostAPI := api2.NewHostAPI(hostService)
authRepo := repository3.NewAuthRepo(db)
authService := service3.NewAuthService(auther, authRepo)
authAPI := api3.NewLoginAPI(authService)
auditRepo := repository4.NewAuditRepo(db)
auditService := service4.NewAuditService(auditRepo)
auditAPI := api4.NewAuditAPI(auditService)
loggerHandler := NewLoggerHandler()
router := &Router{
config: config,
auth: auther,
containerAPI: containerAPI,
hostAPI: hostAPI,
authAPI: authAPI,
auditAPI: auditAPI,
loggerHandler: loggerHandler,
}
app := NewFiberApp(config, router)
prepare := &Prepare{
db: db,
}
timedTask := NewTimedTask(config, db)
logger := NewLogger(config)
injector, err := NewInjector(app, router, prepare, config, timedTask, logger)
if err != nil {
cleanup2()
cleanup()
return nil, nil, err
}
return injector, func() {
cleanup2()
cleanup()
}, nil
}