-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwire_gen.go
59 lines (51 loc) · 2.18 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
// 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/gin-gonic/gin"
"github.com/google/wire"
"webook/internal/repository"
"webook/internal/repository/cache"
"webook/internal/repository/dao"
"webook/internal/service"
"webook/internal/web"
"webook/internal/web/jwt"
"webook/ioc"
)
import (
_ "github.com/spf13/viper/remote"
)
// Injectors from wire.go:
func InitWebServer() *gin.Engine {
cmdable := ioc.InitRedis()
handler := jwt.NewRedisJWTHandler(cmdable)
logger := ioc.InitLogger()
v := ioc.InitGinMiddleware(handler, logger)
db := ioc.InitDB(logger)
userDAO := dao.NewGormUserDAO(db)
userCache := cache.NewRedisUserCache(cmdable)
userRepository := repository.NewCacheUserRepository(userDAO, userCache)
userService := service.NewUserService(userRepository)
codeCache := cache.NewRedisCodeCache(cmdable)
codeRepository := repository.NewCodeRepository(codeCache)
localsmsService := ioc.InitSMSService()
codeService := service.NewCodeService(codeRepository, localsmsService)
userHandler := web.NewUserHandler(userService, codeService, handler)
wechatService := ioc.InitWechatService(logger)
oAuth2WechatHandler := web.NewOAuth2WechatHandler(wechatService, userService, handler)
articleDAO := dao.NewGormArticleDAO(db)
articleCache := cache.NewArticleRedisCache(cmdable)
articleRepository := repository.NewCachedArticleRepository(articleDAO, articleCache)
articleService := service.NewArticleService(articleRepository, logger)
interactiveDAO := dao.NewGormInteractiveDAO(db)
interactiveCache := cache.NewInteractiveCache(cmdable)
interactiveRepository := repository.NewCachedInteractiveRepository(interactiveDAO, interactiveCache)
interactiveService := service.NewInteractiveService(interactiveRepository)
articleHandler := web.NewArticleHandler(articleService, logger, interactiveService)
engine := ioc.InitWebService(v, userHandler, oAuth2WechatHandler, articleHandler)
return engine
}
// wire.go:
var interactiveSvcSet = wire.NewSet(dao.NewGormInteractiveDAO, cache.NewInteractiveCache, repository.NewCachedInteractiveRepository, service.NewInteractiveService)