1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-21 20:07:04 +00:00

PartyConfigure: try to bind the struct's exported zero fields based on the registered dependencies (if any)

If the PartyConfigurator value accepts only static dependencies then we have zero performance penalty, exactly like a Controller (structure) works
This commit is contained in:
Gerasimos (Makis) Maropoulos
2021-02-21 22:24:01 +02:00
parent bfbed2f841
commit c1b31ab102
6 changed files with 131 additions and 21 deletions

View File

@@ -21,7 +21,7 @@ type (
// It's the exact type of return to bind, if declared to return <T>, otherwise nil.
DestType reflect.Type
Static bool
// If true then input and dependnecy DestType should be indedical,
// If true then input and dependency DestType should be indedical,
// not just assiginable to each other.
// Example of use case: depenendency like time.Time that we want to be bindable
// only to time.Time inputs and not to a service with a `String() string` method that time.Time struct implements too.
@@ -215,7 +215,7 @@ func fromDependentFunc(v reflect.Value, dest *Dependency, funcDependencies []*De
// d1 = Logger
// d2 = func(Logger) S1
// d2 should be static: it accepts dependencies that are static
// (note: we don't check the output argument(s) of this dependnecy).
// (note: we don't check the output argument(s) of this dependency).
if numIn == len(bindings) {
static := true
for _, b := range bindings {