mirror of
https://github.com/kataras/iris.git
synced 2025-02-02 15:30:36 +01:00
5fc24812bc
total refactor of the hero and mvc packages, see README#Next (it's not completed yet) Former-commit-id: b85ae99cbfe5965ba919c1e15cf4989e787982c0
35 lines
657 B
Go
35 lines
657 B
Go
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
|
|
}
|