50 lines
1.4 KiB
Go
50 lines
1.4 KiB
Go
// Code generated by Wire. DO NOT EDIT.
|
|
|
|
//go:generate go run -mod=mod github.com/google/wire/cmd/wire
|
|
//go:build !wireinject
|
|
// +build !wireinject
|
|
|
|
package main
|
|
|
|
import (
|
|
"github.com/go-kratos/kratos/v2"
|
|
"github.com/go-kratos/kratos/v2/log"
|
|
"voucher/internal/biz"
|
|
"voucher/internal/conf"
|
|
"voucher/internal/data"
|
|
"voucher/internal/data/repositoryimpl"
|
|
"voucher/internal/data/thirdrepositoryimpl"
|
|
log2 "voucher/internal/pkg/log"
|
|
"voucher/internal/server"
|
|
"voucher/internal/service"
|
|
)
|
|
|
|
import (
|
|
_ "go.uber.org/automaxprocs"
|
|
)
|
|
|
|
// Injectors from wire.go:
|
|
|
|
// wireApp init kratos application.
|
|
func wireApp(bootstrap *conf.Bootstrap, logger log.Logger, accessLogger *log2.AccessLogger) (*kratos.App, func(), error) {
|
|
helper := log2.NewLogHelper(logger)
|
|
gormDb, cleanup := data.NewGormDb(bootstrap)
|
|
db := data.NewDb(gormDb)
|
|
orderRepo := repositoryimpl.NewOrderRepoImpl(db)
|
|
rocketMQ, cleanup2, err := data.NewRocketMQ(bootstrap)
|
|
if err != nil {
|
|
cleanup()
|
|
return nil, nil, err
|
|
}
|
|
thirdMQSend := thirdrepositoryimpl.NewMQSendImpl(rocketMQ)
|
|
voucherBiz := biz.NewVoucherBiz(orderRepo, thirdMQSend)
|
|
voucherService := service.NewVoucherService(voucherBiz)
|
|
httpServer := server.NewHTTPServer(bootstrap, helper, accessLogger, voucherService)
|
|
consumer := server.NewConsumer(helper, bootstrap, voucherService)
|
|
app := newApp(logger, httpServer, consumer)
|
|
return app, func() {
|
|
cleanup2()
|
|
cleanup()
|
|
}, nil
|
|
}
|