-
Notifications
You must be signed in to change notification settings - Fork 0
/
wire_gen.go
78 lines (70 loc) · 3.13 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
// 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 main
import (
"github.com/google/wire"
article3 "we_book/events/article"
"we_book/interactive/events"
repository2 "we_book/interactive/repository"
cache2 "we_book/interactive/repository/cache"
dao2 "we_book/interactive/repository/dao"
service2 "we_book/interactive/service"
"we_book/internal/repository"
article2 "we_book/internal/repository/article"
"we_book/internal/repository/cache"
"we_book/internal/repository/dao"
"we_book/internal/repository/dao/article"
"we_book/internal/service"
"we_book/internal/web"
"we_book/internal/web/jwt"
"we_book/ioc"
)
// Injectors from wire.go:
func InitWebServer() *App {
cmdable := ioc.InitRedis()
handler := jwt.NewRedisJWTHandler(cmdable)
v1 := ioc.InitLogger()
v := ioc.InitMiddlewares(cmdable, handler, v1)
db := ioc.InitDB()
userDAO := dao.NewUserDAO(db)
userCache := cache.NewUserCache(cmdable)
userRepository := repository.NewUserRepository(userDAO, userCache)
userService := service.NewUserService(userRepository)
codeCache := cache.NewRedisCodeCache(cmdable)
codeRepository := repository.NewCodeRepository(codeCache)
smsService := ioc.InitSMSService()
codeService := service.NewCodeService(codeRepository, smsService)
userHandler := web.NewUserHandler(userService, codeService, handler)
articleDAO := article.NewGORMArticleDAO(db)
articleRepository := article2.NewArticleRepository(articleDAO)
client := ioc.InitKafka()
syncProducer := ioc.NewSyncProducer(client)
producer := article3.NewKafkaProducer(syncProducer)
articleService := service.NewArticleService(articleRepository, v1, producer)
articleHandler := web.NewArticleHandler(articleService, v1)
wechatService := ioc.InitWechatService(v1)
wechatHandlerConfig := ioc.NewWechatHandlerConfig()
oAuth2WeChatHandler := web.NewOAuth2WeChatHandler(wechatService, userService, handler, wechatHandlerConfig)
engine := ioc.InitWebServer(v, userHandler, articleHandler, oAuth2WeChatHandler)
interactiveCache := cache2.NewRedisInteractiveCache(cmdable)
interactiveDAO := dao2.NewGORMInteractiveDAO(db)
interactiveRepository := repository2.NewCacheInteractiveRepository(interactiveCache, interactiveDAO, v1)
interactiveReadEventBatchConsumer := events.NewInteractiveReadEventBatchConsumer(client, interactiveRepository, v1)
v2 := ioc.NewConsumers(interactiveReadEventBatchConsumer)
interactiveService := service2.NewInteractiveService(interactiveRepository, v1)
rankingService := service.NewBatchRankingService(articleService, interactiveService)
rlockClient := ioc.InitRLockClient(cmdable)
rankingJob := ioc.InitRankingJob(rankingService, rlockClient, v1)
cron := ioc.InitJobs(v1, rankingJob)
app := &App{
web: engine,
consumer: v2,
corn: cron,
}
return app
}
// wire.go:
var interactiveSvcProvider = wire.NewSet(service2.NewInteractiveService, repository2.NewCacheInteractiveRepository, dao2.NewGORMInteractiveDAO, cache2.NewRedisInteractiveCache)
var rankingServerProvider = wire.NewSet(repository.NewRankingRepository, cache.NewRankingRedisCache, service.NewBatchRankingService)