1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- //go:build wireinject
- // +build wireinject
- package wire
- import (
- "github.com/go-nunu/nunu-layout-advanced/internal/repository"
- "github.com/go-nunu/nunu-layout-advanced/internal/server"
- "github.com/go-nunu/nunu-layout-advanced/internal/task"
- "github.com/go-nunu/nunu-layout-advanced/pkg/app"
- "github.com/go-nunu/nunu-layout-advanced/pkg/log"
- "github.com/go-nunu/nunu-layout-advanced/pkg/sid"
- "github.com/google/wire"
- "github.com/spf13/viper"
- )
- var repositorySet = wire.NewSet(
- repository.NewDB,
- //repository.NewRedis,
- repository.NewRepository,
- repository.NewTransaction,
- repository.NewUserRepository,
- repository.NewGameShieldRepository,
- )
- var taskSet = wire.NewSet(
- task.NewTask,
- task.NewUserTask,
- task.NewGameShieldTask,
- )
- var serverSet = wire.NewSet(
- server.NewTaskServer,
- )
- // build App
- func newApp(
- task *server.TaskServer,
- ) *app.App {
- return app.NewApp(
- app.WithServer(task),
- app.WithName("demo-task"),
- )
- }
- func NewWire(*viper.Viper, *log.Logger) (*app.App, func(), error) {
- panic(wire.Build(
- repositorySet,
- taskSet,
- serverSet,
- newApp,
- sid.NewSid,
- ))
- }
|