-
Notifications
You must be signed in to change notification settings - Fork 45
/
wire_gen.go
88 lines (83 loc) · 2.58 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
77
78
79
80
81
82
83
84
85
86
87
88
// 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 (
"context"
"github.com/gin-gonic/gin"
"go-drive/common"
"go-drive/common/event"
"go-drive/common/i18n"
"go-drive/common/registry"
"go-drive/common/task"
"go-drive/common/utils"
"go-drive/drive"
"go-drive/server"
"go-drive/server/scheduled"
"go-drive/server/search"
"go-drive/server/thumbnail"
"go-drive/storage"
)
// Injectors from wire.go:
func Initialize(ctx context.Context, ch *registry.ComponentsHolder) (*gin.Engine, error) {
config, err := common.InitConfig(ch)
if err != nil {
return nil, err
}
bus := event.NewBus(ch)
db, err := storage.NewDB(config, ch)
if err != nil {
return nil, err
}
driveDAO := storage.NewDriveDAO(db, ch)
pathMountDAO := storage.NewPathMountDAO(db, ch)
driveDataDAO := storage.NewDriveDataDAO(db, ch)
driveCacheDAO := storage.NewDriveCacheDAO(db, ch)
rootDrive, err := drive.NewRootDrive(ctx, config, driveDAO, pathMountDAO, driveDataDAO, driveCacheDAO, ch)
if err != nil {
return nil, err
}
pathPermissionDAO := storage.NewPathPermissionDAO(db, ch)
optionsDAO := storage.NewOptionsDAO(db, ch)
pathMetaDAO := storage.NewPathMetaDAO(db, ch)
access, err := drive.NewAccess(ch, rootDrive, pathPermissionDAO, optionsDAO, pathMetaDAO, bus)
if err != nil {
return nil, err
}
tunnyRunner := task.NewTunnyRunner(config, ch)
service, err := search.NewService(ch, config, optionsDAO, rootDrive, tunnyRunner, bus)
if err != nil {
return nil, err
}
fileTokenStore, err := server.NewFileTokenStore(config, ch)
if err != nil {
return nil, err
}
maker, err := thumbnail.NewMaker(config, optionsDAO, ch)
if err != nil {
return nil, err
}
signer := utils.NewSigner()
chunkUploader, err := server.NewChunkUploader(config)
if err != nil {
return nil, err
}
userDAO := storage.NewUserDAO(db, ch)
groupDAO := storage.NewGroupDAO(db, ch)
scheduledDAO := storage.NewScheduledDAO(db, ch)
fileBucketDAO := storage.NewFileBucketDAO(db, ch)
jobExecutor, err := scheduled.NewJobExecutor(scheduledDAO, ch)
if err != nil {
return nil, err
}
fileMessageSource, err := i18n.NewFileMessageSource(config)
if err != nil {
return nil, err
}
engine, err := server.InitServer(config, ch, bus, rootDrive, access, service, fileTokenStore, maker, signer, chunkUploader, tunnyRunner, optionsDAO, userDAO, groupDAO, driveDAO, driveDataDAO, pathPermissionDAO, pathMountDAO, pathMetaDAO, scheduledDAO, fileBucketDAO, jobExecutor, fileMessageSource)
if err != nil {
return nil, err
}
return engine, nil
}