-
Notifications
You must be signed in to change notification settings - Fork 0
/
wire_gen.go
54 lines (49 loc) · 1.38 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
// Code generated by Wire. DO NOT EDIT.
//go:generate wire
//+build !wireinject
package di
import (
"github.com/JerryZhou343/leaf-go/api/rpc"
"github.com/JerryZhou343/leaf-go/app/executor/cmd"
"github.com/JerryZhou343/leaf-go/app/executor/query"
segment2 "github.com/JerryZhou343/leaf-go/domain/aggregate/segment"
"github.com/JerryZhou343/leaf-go/domain/aggregate/snowflake"
"github.com/JerryZhou343/leaf-go/infra/conf"
"github.com/JerryZhou343/leaf-go/infra/driver/mysql"
"github.com/JerryZhou343/leaf-go/infra/repo/segment"
"github.com/JerryZhou343/leaf-go/infra/server/grpc"
)
// Injectors from wire.go:
func InitApp() (*App, func(), error) {
config, err := conf.NewConf()
if err != nil {
return nil, nil, err
}
db, err := mysql.NewMySQL(config)
if err != nil {
return nil, nil, err
}
repo := segment.NewRepo(db)
segmentImpl := segment2.NewSegmentImpl(repo)
snowflakeSnowflake, err := snowflake.NewSnowflake(config)
if err != nil {
return nil, nil, err
}
appCmd, err := cmd.NewAppCmd(config, segmentImpl, snowflakeSnowflake)
if err != nil {
return nil, nil, err
}
appQuery := query.NewAppQuery(repo)
handler := rpc.NewHandler(appCmd, appQuery)
server, err := grpc.New(handler, config)
if err != nil {
return nil, nil, err
}
app, cleanup, err := NewApp(handler, server, config)
if err != nil {
return nil, nil, err
}
return app, func() {
cleanup()
}, nil
}