1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-09 13:05:56 +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{}) {

View File

@@ -27,6 +27,10 @@ type Party interface {
//
// It returns the same `APIBuilder` featured with Dependency Injection.
ConfigureContainer(builder ...func(*APIContainer)) *APIContainer
// 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`.
EnsureStaticBindings() Party
// RegisterDependency calls the `ConfigureContainer.RegisterDependency` method
// with the provided value(s). See `HandleFunc` and `PartyConfigure` methods too.
RegisterDependency(dependencies ...interface{})