router

package
v0.0.0-...-f984256 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ParamsContextKey = "params.context.key"

ParamsContextKey is used to retrieve a path's params map from a request's context.

Variables

This section is empty.

Functions

This section is empty.

Types

type Constructor

type Constructor func(http.Handler) http.Handler

type HttpTreeMuxRouter

type HttpTreeMuxRouter struct {
	// contains filtered or unexported fields
}

func NewHttpTreeMuxRouter

func NewHttpTreeMuxRouter() *HttpTreeMuxRouter

func (*HttpTreeMuxRouter) Any

func (r *HttpTreeMuxRouter) Any(path string, handler http.HandlerFunc, handlers ...Constructor)

func (*HttpTreeMuxRouter) DELETE

func (r *HttpTreeMuxRouter) DELETE(path string, handler http.HandlerFunc, handlers ...Constructor)

func (*HttpTreeMuxRouter) GET

func (r *HttpTreeMuxRouter) GET(path string, handler http.HandlerFunc, handlers ...Constructor)

func (*HttpTreeMuxRouter) Group

func (r *HttpTreeMuxRouter) Group(path string) Router

func (*HttpTreeMuxRouter) HEAD

func (r *HttpTreeMuxRouter) HEAD(path string, handler http.HandlerFunc, middleware ...Constructor)

func (*HttpTreeMuxRouter) Handle

func (r *HttpTreeMuxRouter) Handle(method string, path string, handler http.HandlerFunc, handlers ...Constructor)

func (*HttpTreeMuxRouter) OPTIONS

func (r *HttpTreeMuxRouter) OPTIONS(path string, handler http.HandlerFunc, middleware ...Constructor)

func (*HttpTreeMuxRouter) PATCH

func (r *HttpTreeMuxRouter) PATCH(path string, handler http.HandlerFunc, handlers ...Constructor)

func (*HttpTreeMuxRouter) POST

func (r *HttpTreeMuxRouter) POST(path string, handler http.HandlerFunc, handlers ...Constructor)

func (*HttpTreeMuxRouter) PUT

func (r *HttpTreeMuxRouter) PUT(path string, handler http.HandlerFunc, handlers ...Constructor)

func (*HttpTreeMuxRouter) ServeHTTP

func (r *HttpTreeMuxRouter) ServeHTTP(w http.ResponseWriter, req *http.Request)

func (*HttpTreeMuxRouter) Use

func (r *HttpTreeMuxRouter) Use(handlers ...Constructor) Router

type ListenPathMatcher

type ListenPathMatcher struct {
	// contains filtered or unexported fields
}

func NewListenPathMatcher

func NewListenPathMatcher() *ListenPathMatcher

func (*ListenPathMatcher) Extract

func (l *ListenPathMatcher) Extract(listenPath string) string

func (*ListenPathMatcher) Match

func (l *ListenPathMatcher) Match(listenPath string) bool

type Params

type Params struct {
	// contains filtered or unexported fields
}

func FromContext

func FromContext(ctx context.Context) *Params

FromContext returns the params map associated with the given context if one exists. Otherwise, an empty map is returned.

func (*Params) ByName

func (p *Params) ByName(name string) string

type Router

type Router interface {
	Handle(method string, path string, handler http.HandlerFunc, handlers ...Constructor)
	Any(path string, handler http.HandlerFunc, handlers ...Constructor)
	GET(path string, handler http.HandlerFunc, handlers ...Constructor)
	POST(path string, handler http.HandlerFunc, handlers ...Constructor)
	PUT(path string, handler http.HandlerFunc, handlers ...Constructor)
	DELETE(path string, handler http.HandlerFunc, handlers ...Constructor)
	PATCH(path string, handler http.HandlerFunc, handlers ...Constructor)
	HEAD(path string, handler http.HandlerFunc, handlers ...Constructor)
	OPTIONS(path string, handler http.HandlerFunc, handlers ...Constructor)
	Group(path string) Router
	Use(handlers ...Constructor) Router
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL