-
Notifications
You must be signed in to change notification settings - Fork 7
/
wire.go
173 lines (142 loc) · 6.55 KB
/
wire.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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
//go:build wireinject
package concurrent
import (
"github.com/bradfitz/gomemcache/memcache"
"github.com/google/wire"
"github.com/redis/go-redis/v9"
"gorm.io/gorm"
"github.com/totegamma/concurrent/client"
"github.com/totegamma/concurrent/core"
"github.com/totegamma/concurrent/x/ack"
"github.com/totegamma/concurrent/x/association"
"github.com/totegamma/concurrent/x/auth"
"github.com/totegamma/concurrent/x/domain"
"github.com/totegamma/concurrent/x/entity"
"github.com/totegamma/concurrent/x/job"
"github.com/totegamma/concurrent/x/jwt"
"github.com/totegamma/concurrent/x/key"
"github.com/totegamma/concurrent/x/message"
"github.com/totegamma/concurrent/x/notification"
"github.com/totegamma/concurrent/x/policy"
"github.com/totegamma/concurrent/x/profile"
"github.com/totegamma/concurrent/x/schema"
"github.com/totegamma/concurrent/x/semanticid"
"github.com/totegamma/concurrent/x/store"
"github.com/totegamma/concurrent/x/subscription"
"github.com/totegamma/concurrent/x/timeline"
"github.com/totegamma/concurrent/x/userkv"
)
// Lv0
var jwtServiceProvider = wire.NewSet(jwt.NewService, jwt.NewRepository)
var schemaServiceProvider = wire.NewSet(schema.NewService, schema.NewRepository)
var domainServiceProvider = wire.NewSet(domain.NewService, domain.NewRepository)
var semanticidServiceProvider = wire.NewSet(semanticid.NewService, semanticid.NewRepository)
var userKvServiceProvider = wire.NewSet(userkv.NewService, userkv.NewRepository)
var policyServiceProvider = wire.NewSet(policy.NewService, policy.NewRepository)
var keyServiceProvider = wire.NewSet(key.NewService, key.NewRepository)
var jobServiceProvider = wire.NewSet(job.NewService, job.NewRepository)
// Lv1
var entityServiceProvider = wire.NewSet(entity.NewService, entity.NewRepository, SetupJwtService, SetupSchemaService, SetupKeyService)
// Lv2
var timelineServiceProvider = wire.NewSet(timeline.NewService, timeline.NewRepository, SetupEntityService, SetupDomainService, SetupSchemaService, SetupSemanticidService, SetupSubscriptionService)
var subscriptionServiceProvider = wire.NewSet(subscription.NewService, subscription.NewRepository, SetupSchemaService, SetupEntityService)
// Lv3
var profileServiceProvider = wire.NewSet(profile.NewService, profile.NewRepository, SetupEntityService, SetupKeyService, SetupSchemaService, SetupSemanticidService)
var authServiceProvider = wire.NewSet(auth.NewService, SetupEntityService, SetupDomainService, SetupKeyService)
var ackServiceProvider = wire.NewSet(ack.NewService, ack.NewRepository, SetupEntityService, SetupKeyService)
// Lv4
var messageServiceProvider = wire.NewSet(message.NewService, message.NewRepository, SetupEntityService, SetupDomainService, SetupTimelineService, SetupKeyService, SetupSchemaService)
// Lv5
var associationServiceProvider = wire.NewSet(association.NewService, association.NewRepository, SetupEntityService, SetupDomainService, SetupTimelineService, SetupMessageService, SetupKeyService, SetupSchemaService, SetupProfileService, SetupSubscriptionService)
// Lv6
var storeServiceProvider = wire.NewSet(
store.NewService,
store.NewRepository,
SetupKeyService,
SetupMessageService,
SetupAssociationService,
SetupProfileService,
SetupEntityService,
SetupTimelineService,
SetupAckService,
SetupSubscriptionService,
SetupSemanticidService,
)
// other
var notificationServiceProvider = wire.NewSet(
notification.NewService,
notification.NewRepository,
)
// -----------
func SetupPolicyService(rdb *redis.Client, globalPolicy core.Policy, config core.Config) core.PolicyService {
wire.Build(policyServiceProvider)
return nil
}
func SetupJwtService(rdb *redis.Client) jwt.Service {
wire.Build(jwtServiceProvider)
return nil
}
func SetupJobService(db *gorm.DB) core.JobService {
wire.Build(jobServiceProvider)
return nil
}
func SetupAckService(db *gorm.DB, rdb *redis.Client, mc *memcache.Client, client client.Client, policy core.PolicyService, config core.Config) core.AckService {
wire.Build(ackServiceProvider)
return nil
}
func SetupKeyService(db *gorm.DB, rdb *redis.Client, mc *memcache.Client, client client.Client, config core.Config) core.KeyService {
wire.Build(keyServiceProvider)
return nil
}
func SetupMessageService(db *gorm.DB, rdb *redis.Client, mc *memcache.Client, keeper timeline.Keeper, client client.Client, policy core.PolicyService, config core.Config) core.MessageService {
wire.Build(messageServiceProvider)
return nil
}
func SetupProfileService(db *gorm.DB, rdb *redis.Client, mc *memcache.Client, client client.Client, policy core.PolicyService, config core.Config) core.ProfileService {
wire.Build(profileServiceProvider)
return nil
}
func SetupAssociationService(db *gorm.DB, rdb *redis.Client, mc *memcache.Client, keeper timeline.Keeper, client client.Client, policy core.PolicyService, config core.Config) core.AssociationService {
wire.Build(associationServiceProvider)
return nil
}
func SetupTimelineService(db *gorm.DB, rdb *redis.Client, mc *memcache.Client, keeper timeline.Keeper, client client.Client, policy core.PolicyService, config core.Config) core.TimelineService {
wire.Build(timelineServiceProvider)
return nil
}
func SetupDomainService(db *gorm.DB, client client.Client, config core.Config) core.DomainService {
wire.Build(domainServiceProvider)
return nil
}
func SetupEntityService(db *gorm.DB, rdb *redis.Client, mc *memcache.Client, client client.Client, policy core.PolicyService, config core.Config) core.EntityService {
wire.Build(entityServiceProvider)
return nil
}
func SetupAuthService(db *gorm.DB, rdb *redis.Client, mc *memcache.Client, client client.Client, policy core.PolicyService, config core.Config) core.AuthService {
wire.Build(authServiceProvider)
return nil
}
func SetupUserkvService(db *gorm.DB) userkv.Service {
wire.Build(userKvServiceProvider)
return nil
}
func SetupSchemaService(db *gorm.DB) core.SchemaService {
wire.Build(schemaServiceProvider)
return nil
}
func SetupStoreService(db *gorm.DB, rdb *redis.Client, mc *memcache.Client, keeper timeline.Keeper, client client.Client, policy core.PolicyService, config core.Config, repositoryPath string) core.StoreService {
wire.Build(storeServiceProvider)
return nil
}
func SetupSubscriptionService(db *gorm.DB, rdb *redis.Client, mc *memcache.Client, client client.Client, policy core.PolicyService, config core.Config) core.SubscriptionService {
wire.Build(subscriptionServiceProvider)
return nil
}
func SetupSemanticidService(db *gorm.DB) core.SemanticIDService {
wire.Build(semanticidServiceProvider)
return nil
}
func SetupNotificationService(db *gorm.DB) core.NotificationService {
wire.Build(notificationServiceProvider)
return nil
}