context

package
v0.31.0 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2021 License: MIT Imports: 6 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 *RoutingContext) 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 = context.Context

type RoutingContext added in v0.33.0

type RoutingContext struct {
	RoutePrefix  string
	RoutePath    string
	RoutePattern string
}

func NewRouteContext

func NewRouteContext(prefix, path string) *RoutingContext

NewRouteContext returns a new RoutingContext object.

func RouteContext

func RouteContext(ctx context.Context) *RoutingContext

RouteContext returns a RoutingContext object from a http.Request Context.

func (RoutingContext) Clone added in v0.33.0

func (rctx RoutingContext) Clone() *RoutingContext

Clone() creates a copy of a RoutingContext object

func (*RoutingContext) Init added in v0.33.0

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

func (*RoutingContext) Next added in v0.33.0

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

func (*RoutingContext) Path added in v0.33.0

func (rctx *RoutingContext) Path() string

func (*RoutingContext) Step added in v0.33.0

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

Jump to

Keyboard shortcuts

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