-
Notifications
You must be signed in to change notification settings - Fork 0
/
wire_gen.go
45 lines (37 loc) · 1.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
// Code generated by Wire. DO NOT EDIT.
//go:generate wire
//+build !wireinject
package main
import (
"github.com/dimuska139/golang-api-skeleton/api"
"github.com/dimuska139/golang-api-skeleton/config"
"github.com/dimuska139/golang-api-skeleton/database"
"github.com/dimuska139/golang-api-skeleton/services"
"github.com/jmoiron/sqlx"
)
// Injectors from wire.go:
func InitializeConfig(configPath string) (*config.Config, error) {
configConfig, err := config.NewConfig(configPath)
if err != nil {
return nil, err
}
return configConfig, nil
}
func InitializeDatabase(cfg *config.Config) (*sqlx.DB, error) {
db, err := database.NewDatabase(cfg)
if err != nil {
return nil, err
}
return db, nil
}
func InitializeUsersAPI(db *sqlx.DB) (*api.UsersAPI, error) {
usersService := services.NewUsersService(db)
usersAPI := api.NewUsersAPI(usersService)
return usersAPI, nil
}
func InitializeAuthAPI(cfg *config.Config, db *sqlx.DB) (*api.AuthAPI, error) {
usersService := services.NewUsersService(db)
authService := services.NewAuthService(db, cfg, usersService)
authAPI := api.NewAuthAPI(usersService, authService)
return authAPI, nil
}