Skip to content

Commit

Permalink
增加注释
Browse files Browse the repository at this point in the history
  • Loading branch information
FuckAll committed Jun 9, 2020
1 parent 3907386 commit 1c87d84
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
35 changes: 30 additions & 5 deletions wire.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,37 @@ func InitAuthApi() *facade.AuthApi {

var _ leaveRepositoryFacade.ILeaveRepository = &leavePersistence.LeaveRepositoryImpl{}

var leaveAPISet = wire.NewSet(leaveDomainService.NewLeaveDomainService, personDomainService.NewPersonDomainService, ruleDomainService.NewApprovalRuleDomainService)
var leaveDomainServiceSet = wire.NewSet(event.NewEventPublisher, wire.Bind(new(leaveRepositoryFacade.ILeaveRepository), new(*leavePersistence.LeaveRepositoryImpl)), leavePersistence.NewLeaveRepositoryImpl, leaveDomainService.NewLeaveFactory)
var personDomainServiceSet = wire.NewSet(wire.Bind(new(personRepositoryFacade.PersonRepository), new(*personPersistence.PersonRepositoryImpl)), personPersistence.NewPersonRepositoryImpl, personDomainService.NewPersonFactory)
var approvalRuleDomainServiceSet = wire.NewSet(wire.Bind(new(ruleRepositoryFacade.ApprovalRuleRepository), new(*rulePersistence.ApprovalRuleRepositoryImpl)), rulePersistence.NewApprovalRuleRepositoryImpl)
// NewLeaveApplicationService 所需依赖
var leaveApplicationServiceSet = wire.NewSet(
leaveDomainService.NewLeaveDomainService,
personDomainService.NewPersonDomainService,
ruleDomainService.NewApprovalRuleDomainService)

// LeaveDomainService 所需依赖
var leaveDomainServiceSet = wire.NewSet(
event.NewEventPublisher,
wire.Bind(new(leaveRepositoryFacade.ILeaveRepository), new(*leavePersistence.LeaveRepositoryImpl)), // 注入interface方法要用Bind
leavePersistence.NewLeaveRepositoryImpl, // 需要注入interface的实现类
leaveDomainService.NewLeaveFactory)

// PersonDomainService 所需依赖
var personDomainServiceSet = wire.NewSet(
wire.Bind(new(personRepositoryFacade.PersonRepository), new(*personPersistence.PersonRepositoryImpl)),
personPersistence.NewPersonRepositoryImpl,
personDomainService.NewPersonFactory)

var approvalRuleDomainServiceSet = wire.NewSet(
wire.Bind(new(ruleRepositoryFacade.ApprovalRuleRepository), new(*rulePersistence.ApprovalRuleRepositoryImpl)),
rulePersistence.NewApprovalRuleRepositoryImpl)

func InitLeaveAPI() *facade.LeaveAPI {
wire.Build(facade.NewLeaveAPI, wire.Value(DefaultEngine), service.NewLeaveApplicationService, leaveAPISet, leaveDomainServiceSet, personDomainServiceSet, approvalRuleDomainServiceSet)
wire.Build(
facade.NewLeaveAPI,
wire.Value(DefaultEngine),
service.NewLeaveApplicationService,
leaveApplicationServiceSet,
leaveDomainServiceSet,
personDomainServiceSet,
approvalRuleDomainServiceSet)
return &facade.LeaveAPI{}
}
5 changes: 4 additions & 1 deletion wire_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1c87d84

Please sign in to comment.