route

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: May 26, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Route

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

Route represents a route settings that can be used to match requested URLs.

func NewRoute

func NewRoute(rcfg config.Route) (*Route, error)

NewRoute creates a new Route by the provided rcfg.

func (*Route) Match

func (r *Route) Match(method, path []byte) bool

Match matches the provided method and path.

type Routes

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

Routes represents a list of routes that can be used to match requested URLs.

func NewRoutes

func NewRoutes(cfg config.Config) (*Routes, error)

NewRoutes creates a new Routes the provided cfg.Routes.

func (Routes) CachedRoute

func (rs Routes) CachedRoute(method, path []byte) *RoutesResult

CachedRoute provides Read-Through caching for rs.Route if the cache is enabled.

func (Routes) CachedRouteCtx

func (rs Routes) CachedRouteCtx(ctx *fasthttp.RequestCtx) *RoutesResult

CachedRouteCtx provides Read-Through caching for rs.Route if the cache is enabled.

func (Routes) Route

func (rs Routes) Route(method, path []byte) *RoutesResult

Route find routes by the provided method and path and returns a new RoutesResult.

type RoutesResult

type RoutesResult struct {
	StatusCode        int
	StatusMessage     []byte
	RewriteURI        []byte
	RedirectURI       []byte
	AppendQueryString bool
	Handler           string
	Filters           []string
}

RouteResult represents a result of routing.

func (RoutesResult) RedirectURIWithQueryString

func (r RoutesResult) RedirectURIWithQueryString(ctx *fasthttp.RequestCtx) []byte

func (RoutesResult) RewriteURIWithQueryString

func (r RoutesResult) RewriteURIWithQueryString(ctx *fasthttp.RequestCtx) []byte

Jump to

Keyboard shortcuts

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