MCPcopy Create free account
hub / github.com/kataras/iris / JoinHandlers

Function JoinHandlers

context/handler.go:351–369  ·  view source on GitHub ↗

JoinHandlers returns a copy of "h1" and "h2" Handlers slice joined as one slice of Handlers.

(h1 Handlers, h2 Handlers)

Source from the content-addressed store, hash-verified

349
350// JoinHandlers returns a copy of "h1" and "h2" Handlers slice joined as one slice of Handlers.
351func JoinHandlers(h1 Handlers, h2 Handlers) Handlers {
352 if len(h1) == 0 {
353 return h2
354 }
355
356 if len(h2) == 0 {
357 return h1
358 }
359
360 nowLen := len(h1)
361 totalLen := nowLen + len(h2)
362 // create a new slice of Handlers in order to merge the "h1" and "h2"
363 newHandlers := make(Handlers, totalLen)
364 // copy the already Handlers to the just created
365 copy(newHandlers, h1)
366 // start from there we finish, and store the new Handlers too
367 copy(newHandlers[nowLen:], h2)
368 return newHandlers
369}
370
371// UpsertHandlers like `JoinHandlers` but it does
372// NOT copies the handlers entries and it does remove duplicates.

Callers 4

handleManyMethod · 0.92
createRoutesMethod · 0.92
PartyMethod · 0.92
UseRouterMethod · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…