mirror of
https://github.com/kataras/iris.git
synced 2025-12-17 09:57:01 +00:00
add a new Party.EnsureStaticBindings method - read HISTORY.md
This commit is contained in:
@@ -53,6 +53,10 @@ type Container struct {
|
||||
// set to true to disable that kind of behavior.
|
||||
DisablePayloadAutoBinding bool
|
||||
|
||||
// DisableStructDynamicBindings if true panics on struct handler (controller)
|
||||
// if at least one input binding depends on the request and not in a static structure.
|
||||
DisableStructDynamicBindings bool
|
||||
|
||||
// DependencyMatcher holds the function that compares equality between
|
||||
// a dependency with an input. Defaults to DefaultMatchDependencyFunc.
|
||||
DependencyMatcher DependencyMatcher
|
||||
@@ -249,6 +253,7 @@ func (c *Container) Clone() *Container {
|
||||
copy(clonedDeps, c.Dependencies)
|
||||
cloned.Dependencies = clonedDeps
|
||||
cloned.DisablePayloadAutoBinding = c.DisablePayloadAutoBinding
|
||||
cloned.DisableStructDynamicBindings = c.DisableStructDynamicBindings
|
||||
cloned.MarkExportedFieldsAsRequired = c.MarkExportedFieldsAsRequired
|
||||
cloned.resultHandlers = c.resultHandlers
|
||||
// Reports are not cloned.
|
||||
|
||||
@@ -71,6 +71,10 @@ func makeStruct(structPtr interface{}, c *Container, partyParamsCount int) *Stru
|
||||
|
||||
elem.FieldByIndex(b.Input.StructFieldIndex).Set(input)
|
||||
} else if !b.Dependency.Static {
|
||||
if c.DisableStructDynamicBindings {
|
||||
panic(fmt.Sprintf("binder: DisableStructDynamicBindings setting is set to true: dynamic binding found: %s", b.String()))
|
||||
}
|
||||
|
||||
singleton = false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user