-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwire_gen.go
76 lines (71 loc) · 3.29 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
// 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 (
"webookpro/interactive/events"
repository2 "webookpro/interactive/repository"
cache2 "webookpro/interactive/repository/cache"
dao2 "webookpro/interactive/repository/dao"
service2 "webookpro/interactive/service"
article3 "webookpro/internal/events/article"
"webookpro/internal/ioc"
"webookpro/internal/repository"
article2 "webookpro/internal/repository/article"
"webookpro/internal/repository/cache"
"webookpro/internal/repository/dao"
"webookpro/internal/repository/dao/article"
"webookpro/internal/service"
"webookpro/internal/web"
"webookpro/internal/web/jwt"
)
// Injectors from wire.go:
func InitWebServer() *App {
cmdable := ioc.InitRDB()
limiter := ioc.InitLimiter(cmdable)
jwtHandler := jwt.NewRedisJWTHandler(cmdable)
logger := ioc.InitLogger()
v := ioc.InitMiddlewares(limiter, jwtHandler, logger)
db := ioc.InitDB(logger)
userDAO := dao.NewGormUserDAO(db)
userCache := cache.NewRedisUserCache(cmdable)
userRepository := repository.NewCachedUserRepository(userDAO, userCache)
userService := service.NewUserService(userRepository, logger)
codeCache := cache.NewRedisCodeCache(cmdable)
codeRepository := repository.NewCachedCodeRepository(codeCache)
smsService := ioc.InitSMSService()
codeService := service.NewSMSCodeService(codeRepository, smsService)
userHandler := web.NewUserHandler(userService, codeService, jwtHandler)
oauth2Service := ioc.InitWechatService()
oAuth2WechatHandler := web.NewOAuth2WechatHandler(oauth2Service, userService, jwtHandler)
articleDAO := article.NewGORMArticleDAO(db)
articleCache := cache.NewRedisArticleCache(cmdable)
articleRepository := article2.NewCachedArticleRepository(articleDAO, articleCache, userRepository, logger)
client := ioc.InitKafka()
syncProducer := ioc.NewSyncProducer(client)
producer := article3.NewKafkaProducer(syncProducer)
articleService := service.NewArticleService(articleRepository, producer, logger)
interactiveDAO := dao2.NewGORMInteractiveDAO(db)
interactiveCache := cache2.NewRedisInteractiveCache(cmdable)
interactiveRepository := repository2.NewCachedIntrRepository(interactiveDAO, interactiveCache, logger)
interactiveService := service2.NewInteractiveService(interactiveRepository, logger)
interactiveServiceClient := ioc.InitIntrGRPCClient(interactiveService)
articleHandler := web.NewArticleHandler(articleService, interactiveServiceClient, logger)
engine := ioc.InitWebServer(v, userHandler, oAuth2WechatHandler, articleHandler)
interactiveReadEventBatchConsumer := events.NewInteractiveReadEventBatchConsumer(client, interactiveRepository, logger)
v2 := ioc.NewConsumers(interactiveReadEventBatchConsumer)
rankingRedisCache := cache.NewRedisRankingCache(cmdable)
rankingLocalCache := cache.NewRankingLocalCache()
rankingRepository := repository.NewCachedRankingRepository(rankingRedisCache, rankingLocalCache)
rankingService := service.NewBatchRankingService(articleService, interactiveServiceClient, rankingRepository)
rlockClient := ioc.InitRLockClient(cmdable)
rankingJob := ioc.InitRankingJob(rankingService, rlockClient, logger)
cron := ioc.InitJobs(logger, rankingJob)
app := &App{
web: engine,
consumers: v2,
cron: cron,
}
return app
}