mirror of
https://github.com/kataras/iris.git
synced 2025-03-13 21:36:28 +01:00
minor improvement of the previous commit
This commit is contained in:
parent
cbf70a7bcf
commit
f34703e3cf
|
@ -28,7 +28,7 @@ The codebase for Dependency Injection, Internationalization and localization and
|
|||
|
||||
## Fixes and Improvements
|
||||
|
||||
- New `PartyConfigure(relativePath string, partyReg PartyConfigurator) Party` helper, registers a children Party like `Party` and `PartyFunc` but instead it accepts a structure value (useful when the api's dependencies amount are too much to pass on a function).
|
||||
- New `PartyConfigure(relativePath string, partyReg ...PartyConfigurator) Party` helper, registers a children Party like `Party` and `PartyFunc` but instead it accepts a structure value (useful when the api's dependencies amount are too much to pass on a function).
|
||||
|
||||
- **New feature:** add the ability to set custom error handlers on path type parameters errors (existing or custom ones). Example Code:
|
||||
|
||||
|
|
|
@ -870,8 +870,14 @@ type PartyConfigurator interface {
|
|||
// router.Get("/{id:uuid}", api.getUser)
|
||||
// [...]
|
||||
// }
|
||||
func (api *APIBuilder) PartyConfigure(relativePath string, partyReg PartyConfigurator) Party {
|
||||
return api.PartyFunc(relativePath, partyReg.Configure)
|
||||
func (api *APIBuilder) PartyConfigure(relativePath string, partyReg ...PartyConfigurator) Party {
|
||||
child := api.Party(relativePath)
|
||||
for _, p := range partyReg {
|
||||
if p != nil {
|
||||
p.Configure(child)
|
||||
}
|
||||
}
|
||||
return child
|
||||
}
|
||||
|
||||
// Subdomain returns a new party which is responsible to register routes to
|
||||
|
|
|
@ -99,7 +99,7 @@ type Party interface {
|
|||
// router.Get("/{id:uuid}", api.getUser)
|
||||
// [...]
|
||||
// }
|
||||
PartyConfigure(relativePath string, partyReg PartyConfigurator) Party
|
||||
PartyConfigure(relativePath string, partyReg ...PartyConfigurator) Party
|
||||
// Subdomain returns a new party which is responsible to register routes to
|
||||
// this specific "subdomain".
|
||||
//
|
||||
|
|
Loading…
Reference in New Issue
Block a user