-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwire_gen.go
72 lines (64 loc) · 1.57 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
// Code generated by Wire. DO NOT EDIT.
//go:generate wire
//+build !wireinject
package main
import (
"github.com/Wuvist/decho/controller"
"github.com/Wuvist/decho/tpl"
"github.com/google/wire"
"github.com/labstack/echo/v4"
)
import (
_ "github.com/go-sql-driver/mysql"
)
// Injectors from wire.go:
func getWebApp() (*WebApp, error) {
echoEcho := echo.New()
config, err := loadTomlConf()
if err != nil {
return nil, err
}
bloggerQuery := getBloggerDB()
articlesQuery := getArticalDB()
commentQuery := getCommentDB()
userdefinecategoryQuery := getCategoryDB()
linkQuery := getLinkDB()
viewModel := &tpl.ViewModel{
Articles: articlesQuery,
Comments: commentQuery,
Cates: userdefinecategoryQuery,
Links: linkQuery,
}
blogController, err := controller.NewBlogController(echoEcho, bloggerQuery, articlesQuery, viewModel)
if err != nil {
return nil, err
}
cateController, err := controller.NewCateController(echoEcho, bloggerQuery, userdefinecategoryQuery, viewModel)
if err != nil {
return nil, err
}
homeController, err := controller.NewHomeController(echoEcho, bloggerQuery)
if err != nil {
return nil, err
}
staticController, err := controller.NewStaticController(echoEcho)
if err != nil {
return nil, err
}
webApp := &WebApp{
Echo: echoEcho,
config: config,
blog: blogController,
cate: cateController,
home: homeController,
static: staticController,
}
return webApp, nil
}
// wire.go:
var dbProviders = wire.NewSet(wire.Struct(new(tpl.ViewModel), "*"), getBloggerDB,
getArticalDB,
getCategoryDB,
getCommentDB,
getLinkDB,
)