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

Method HandlerReturnDuration

context_wrapper.go:176–187  ·  view source on GitHub ↗

HandlerReturnDuration same as `Handler` but it converts a handler which returns a time.Duration.

(handler func(T) time.Duration)

Source from the content-addressed store, hash-verified

174
175// HandlerReturnDuration same as `Handler` but it converts a handler which returns a time.Duration.
176func (w *ContextWrapper[T]) HandlerReturnDuration(handler func(T) time.Duration) func(Context) time.Duration {
177 if handler == nil {
178 return nil
179 }
180
181 return func(ctx Context) time.Duration {
182 newT := w.pool.Acquire(ctx)
183 duration := handler(newT)
184 w.pool.Release(newT)
185 return duration
186 }
187}
188
189// Filter same as `Handler` but it converts a handler to Filter.
190func (w *ContextWrapper[T]) Filter(handler func(T) bool) Filter {

Callers

nothing calls this directly

Calls 3

AcquireMethod · 0.65
ReleaseMethod · 0.65
handlerFunction · 0.50

Tested by

no test coverage detected