mirror of
https://github.com/kataras/iris.git
synced 2025-03-15 05:26:26 +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
|
## 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:
|
- **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)
|
// router.Get("/{id:uuid}", api.getUser)
|
||||||
// [...]
|
// [...]
|
||||||
// }
|
// }
|
||||||
func (api *APIBuilder) PartyConfigure(relativePath string, partyReg PartyConfigurator) Party {
|
func (api *APIBuilder) PartyConfigure(relativePath string, partyReg ...PartyConfigurator) Party {
|
||||||
return api.PartyFunc(relativePath, partyReg.Configure)
|
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
|
// 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)
|
// 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
|
// Subdomain returns a new party which is responsible to register routes to
|
||||||
// this specific "subdomain".
|
// this specific "subdomain".
|
||||||
//
|
//
|
||||||
|
|
Loading…
Reference in New Issue
Block a user