-
Notifications
You must be signed in to change notification settings - Fork 0
/
wire_gen.go
47 lines (40 loc) · 1.22 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
// 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 (
"github.com/KAMIENDER/golang-scaffold/infra/auth"
"github.com/KAMIENDER/golang-scaffold/infra/config"
"github.com/KAMIENDER/golang-scaffold/infra/database/mysql"
"github.com/KAMIENDER/golang-scaffold/infra/database/nosql"
"github.com/KAMIENDER/golang-scaffold/server"
"github.com/gin-gonic/gin"
"github.com/google/wire"
)
// Injectors from wire.go:
func NewHandler() (*server.Handler, error) {
engine := gin.New()
configConfig, err := config.NewConfig()
if err != nil {
return nil, err
}
redis := nosql.NewRedis(configConfig)
db, err := mysql.NewDatabase(configConfig)
if err != nil {
return nil, err
}
authManager, err := auth.NewAuthManager(configConfig, db, redis)
if err != nil {
return nil, err
}
handler := &server.Handler{
Router: engine,
NoSQLClient: redis,
DB: db,
AuthManager: authManager,
}
return handler, nil
}
// wire.go:
var BardSet = wire.NewSet(config.NewConfig, nosql.NewRedis, mysql.NewDatabase, gin.New, wire.Struct(new(server.Handler), "*"), auth.NewAuthManager, wire.Bind(new(nosql.NoSQLDB), new(*nosql.Redis)))