feat: 升级 samber/do v1 → v2
This commit is contained in:
+27
@@ -0,0 +1,27 @@
|
||||
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,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user