ctxhandler

package
Version: v0.0.1-lastknown Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 31, 2020 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package ctxhandler implements context handler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ContextAdapter

type ContextAdapter struct {
	Logger  *zap.Logger
	Ctx     context.Context
	Handler ContextHandler
}

ContextAdapter wraps context handler.

func (*ContextAdapter) ServeHTTP

func (ca *ContextAdapter) ServeHTTP(w http.ResponseWriter, req *http.Request)

type ContextHandler

type ContextHandler interface {
	ServeHTTPContext(context.Context, http.ResponseWriter, *http.Request) error
}

ContextHandler handles ServeHTTP with context.

type ContextHandlerFunc

type ContextHandlerFunc func(context.Context, http.ResponseWriter, *http.Request) error

ContextHandlerFunc defines HandlerFunc function signature to wrap context.

func (ContextHandlerFunc) ServeHTTPContext

func (f ContextHandlerFunc) ServeHTTPContext(ctx context.Context, w http.ResponseWriter, req *http.Request) error

ServeHTTPContext serve HTTP requests with context.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL