1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-17 18:07:01 +00:00

dependency injection: func (...<T>) iris.Handler can be generated to a simple iris handler if <T> are static dependencies

This commit is contained in:
Gerasimos (Makis) Maropoulos
2021-06-10 21:16:00 +03:00
parent 8f9140b705
commit 96c2dec47f
6 changed files with 58 additions and 7 deletions

View File

@@ -347,6 +347,17 @@ func getBindingsForStruct(v reflect.Value, dependencies []*Dependency, markExpor
return
}
func getStaticInputs(bindings []*binding, numIn int) []reflect.Value {
inputs := make([]reflect.Value, numIn)
for _, b := range bindings {
if d := b.Dependency; d != nil && d.Static {
inputs[b.Input.Index], _ = d.Handle(nil, nil)
}
}
return inputs
}
/*
Builtin dynamic bindings.
*/