feat: 升级 samber/do v1 → v2
This commit is contained in:
+32
@@ -0,0 +1,32 @@
|
||||
package contracts
|
||||
|
||||
import (
|
||||
"git.fsdpf.net/go/reflux"
|
||||
"git.fsdpf.net/go/req"
|
||||
"github.com/samber/do/v2"
|
||||
)
|
||||
|
||||
type CondflowService interface {
|
||||
Run(name string, input reflux.R, u req.User) error
|
||||
}
|
||||
|
||||
type FlowDecision interface {
|
||||
Controller
|
||||
Res() req.Resource
|
||||
}
|
||||
|
||||
type BaseFlowDecision struct {
|
||||
Controller
|
||||
res string
|
||||
}
|
||||
|
||||
func (be BaseFlowDecision) Res() req.Resource {
|
||||
return do.MustInvoke[MustResource](be.Container())(be.res)
|
||||
}
|
||||
|
||||
func NewBaseFlowDecision(container do.Injector, res string) *BaseFlowDecision {
|
||||
return &BaseFlowDecision{
|
||||
Controller: &BaseController{container},
|
||||
res: res,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user