1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-21 11:57:02 +00:00

next version preparation: hero: add a Container.Inject method to inject values outside of HTTP lifecycle, e.g. a database may be used by other services outside of Iris, the hero container (and API's Builder.GetContainer()) should provide it.

Former-commit-id: 89863055a3a3ab108a3f4b753072a35321a3a193
This commit is contained in:
Gerasimos (Makis) Maropoulos
2020-03-05 19:49:45 +02:00
parent 5ee06f9a92
commit b6445c7238
4 changed files with 133 additions and 14 deletions

View File

@@ -125,13 +125,15 @@ func getBindingsFor(inputs []reflect.Type, deps []*Dependency, paramsCount int)
// Therefore, count the inputs that can be path parameters first.
shouldBindParams := make(map[int]struct{})
totalParamsExpected := 0
for i, in := range inputs {
if _, canBePathParameter := context.ParamResolvers[in]; !canBePathParameter {
continue
}
shouldBindParams[i] = struct{}{}
if paramsCount != -1 {
for i, in := range inputs {
if _, canBePathParameter := context.ParamResolvers[in]; !canBePathParameter {
continue
}
shouldBindParams[i] = struct{}{}
totalParamsExpected++
totalParamsExpected++
}
}
startParamIndex := paramsCount - totalParamsExpected