context

package
v0.29.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2021 License: MIT Imports: 5 Imported by: 5

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RouteCtxKey is the context.Context key to store the request context.
	RouteCtxKey = context.NewContextKey("RouteContext")
)

Functions

func WithRouteContext

func WithRouteContext(ctx context.Context, rctx *Context) context.Context

WithRouteContext returns a new http.Request Context with a given mix routing Context object connected to it, so it can later be extracted using RouteContext()

Types

type Context

type Context struct {
	RoutePrefix  string
	RoutePath    string
	RoutePattern string
}

func NewRouteContext

func NewRouteContext(prefix, path string) *Context

NewRouteContext returns a new routing Context object.

func RouteContext

func RouteContext(ctx context.Context) *Context

RouteContext returns mix's routing Context object from a http.Request Context.

func (Context) Clone

func (rctx Context) Clone() *Context

Clone() creates a copy of a routing Context object

func (*Context) Init

func (rctx *Context) Init(prefix, path string)

func (*Context) Next

func (rctx *Context) Next() (*Context, string)

func (*Context) Path

func (rctx *Context) Path() string

func (*Context) Step

func (rctx *Context) Step(prefix string) *Context

Jump to

Keyboard shortcuts

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