mirror of
https://github.com/kataras/iris.git
synced 2025-12-18 18:37:05 +00:00
make versioning.Group a Party compatible by using a type alias on its embedded field
was reported as missing of the a Party method, the type alias is a good hack to solve that
This commit is contained in:
@@ -67,6 +67,10 @@ func examplePerParty(app *iris.Application) {
|
||||
usersAPIV2.Post("/", func(ctx iris.Context) {
|
||||
ctx.Writef("v2 resource: /api/users post handler")
|
||||
})
|
||||
|
||||
// version 3, pass it as a common iris.Party.
|
||||
usersAPIV3 := versioning.NewGroup(usersAPI, ">= 3, < 4")
|
||||
registerAPIV3(usersAPIV3)
|
||||
}
|
||||
|
||||
func catsVersionExactly1Handler(ctx iris.Context) {
|
||||
@@ -76,3 +80,10 @@ func catsVersionExactly1Handler(ctx iris.Context) {
|
||||
func catsV2Handler(ctx iris.Context) {
|
||||
ctx.Writef("v2 resource: /api/cats handler")
|
||||
}
|
||||
|
||||
func registerAPIV3(p iris.Party) {
|
||||
p.Get("/", func(ctx iris.Context) {
|
||||
ctx.Writef("v3 resource: /api/users handler")
|
||||
})
|
||||
// [...]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user