mirror of
https://github.com/kataras/iris.git
synced 2025-12-21 20:07:04 +00:00
☕ add a dependency-injection examples folder for the next release and some improvements
Former-commit-id: 040168afb7caf808618f7da5e68ae8eb01cb7170
This commit is contained in:
@@ -341,9 +341,10 @@ func (c *ControllerActivator) handlerOf(methodName string) context.Handler {
|
||||
return func(ctx context.Context) {
|
||||
ctrl, err := c.injector.Acquire(ctx)
|
||||
if err != nil {
|
||||
if err != hero.ErrStopExecution {
|
||||
c.injector.Container.GetErrorHandler(ctx).HandleError(ctx, err)
|
||||
}
|
||||
// if err != hero.ErrStopExecution {
|
||||
// c.injector.Container.GetErrorHandler(ctx).HandleError(ctx, err)
|
||||
// }
|
||||
c.injector.Container.GetErrorHandler(ctx).HandleError(ctx, err)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
34
mvc/param.go
34
mvc/param.go
@@ -1,34 +0,0 @@
|
||||
package mvc
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
|
||||
"github.com/kataras/iris/v12/context"
|
||||
"github.com/kataras/iris/v12/macro"
|
||||
)
|
||||
|
||||
func getPathParamsForInput(startParamIndex int, params []macro.TemplateParam, funcIn ...reflect.Type) (values []reflect.Value) {
|
||||
if len(funcIn) == 0 || len(params) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
consumed := make(map[int]struct{})
|
||||
for _, in := range funcIn {
|
||||
for j, param := range params {
|
||||
if _, ok := consumed[j]; ok {
|
||||
continue
|
||||
}
|
||||
|
||||
funcDep, ok := context.ParamResolverByTypeAndIndex(in, startParamIndex+param.Index)
|
||||
if !ok {
|
||||
continue
|
||||
}
|
||||
|
||||
values = append(values, funcDep)
|
||||
consumed[j] = struct{}{}
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
}
|
||||
Reference in New Issue
Block a user