28 lines
465 B
Go
28 lines
465 B
Go
package contracts
|
|
|
|
import (
|
|
"git.fsdpf.net/go/req"
|
|
"github.com/samber/do/v2"
|
|
)
|
|
|
|
type Executor interface {
|
|
Controller
|
|
Res() req.Resource
|
|
}
|
|
|
|
type BaseExecutor struct {
|
|
Controller
|
|
res string
|
|
}
|
|
|
|
func (be BaseExecutor) Res() req.Resource {
|
|
return do.MustInvoke[MustResource](be.Container())(be.res)
|
|
}
|
|
|
|
func NewBaseExecutor(container do.Injector, res string) *BaseExecutor {
|
|
return &BaseExecutor{
|
|
Controller: &BaseController{container},
|
|
res: res,
|
|
}
|
|
}
|