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

add a new Party.EnsureStaticBindings method - read HISTORY.md

This commit is contained in:
Gerasimos (Makis) Maropoulos
2022-03-12 12:32:27 +02:00
parent 7ab0f6fff5
commit 9cf6f9fa5e
6 changed files with 26 additions and 0 deletions

View File

@@ -339,6 +339,15 @@ func (api *APIBuilder) ConfigureContainer(builder ...func(*APIContainer)) *APICo
return api.apiBuilderDI
}
// EnsureStaticBindings panics on struct handler (controller)
// if at least one input binding depends on the request and not in a static structure.
// Should be called before `RegisterDependency`.
func (api *APIBuilder) EnsureStaticBindings() Party {
diContainer := api.ConfigureContainer()
diContainer.Container.DisableStructDynamicBindings = true
return api
}
// RegisterDependency calls the `ConfigureContainer.RegisterDependency` method
// with the provided value(s). See `HandleFunc` and `PartyConfigure` methods too.
func (api *APIBuilder) RegisterDependency(dependencies ...interface{}) {