Files
quyun-v2/backend/app/http/v1/provider.gen.go

97 lines
1.8 KiB
Go
Executable File

package v1
import (
"quyun/v2/app/middlewares"
"quyun/v2/providers/storage"
"go.ipao.vip/atom"
"go.ipao.vip/atom/container"
"go.ipao.vip/atom/contracts"
"go.ipao.vip/atom/opt"
)
func Provide(opts ...opt.Option) error {
if err := container.Container.Provide(func() (*Common, error) {
obj := &Common{}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func() (*Content, error) {
obj := &Content{}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func() (*Creator, error) {
obj := &Creator{}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func(
common *Common,
content *Content,
creator *Creator,
middlewares *middlewares.Middlewares,
storage *Storage,
tenant *Tenant,
transaction *Transaction,
user *User,
) (contracts.HttpRoute, error) {
obj := &Routes{
common: common,
content: content,
creator: creator,
middlewares: middlewares,
storage: storage,
tenant: tenant,
transaction: transaction,
user: user,
}
if err := obj.Prepare(); err != nil {
return nil, err
}
return obj, nil
}, atom.GroupRoutes); err != nil {
return err
}
if err := container.Container.Provide(func(
storage *storage.Storage,
) (*Storage, error) {
obj := &Storage{
storage: storage,
}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func() (*Tenant, error) {
obj := &Tenant{}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func() (*Transaction, error) {
obj := &Transaction{}
return obj, nil
}); err != nil {
return err
}
if err := container.Container.Provide(func() (*User, error) {
obj := &User{}
return obj, nil
}); err != nil {
return err
}
return nil
}