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

Add mvc.Application.EnableStructDependents() and app.ConfigureContainer().EnableStructDependents()

relative to: #2158
This commit is contained in:
Gerasimos (Makis) Maropoulos
2023-07-17 18:30:45 +03:00
parent 6add1ba49b
commit d254d48f34
11 changed files with 85 additions and 34 deletions

View File

@@ -142,6 +142,14 @@ func (app *Application) SetControllersNoLog(disable bool) *Application {
return app
}
// EnableStructDependents will try to resolve
// the fields of a struct value, if any, when it's a dependent struct value
// based on the previous registered dependencies.
func (app *Application) EnableStructDependents() *Application {
app.container.EnableStructDependents = true
return app
}
// Register appends one or more values as dependencies.
// The value can be a single struct value-instance or a function
// which has one input and one output, the input should be