route

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 2, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Result added in v0.3.5

type Result struct {
	StatusCode        int
	StatusMessage     []byte
	RewriteURI        []byte
	RedirectURI       []byte
	AppendQueryString bool
	Handler           string
	Filters           util.StringSet
	RouteIndex        int
}

Result represents a result of routing.

func AcquireResult added in v0.3.5

func AcquireResult() *Result

AcquireResult returns an empty Result object from the pool.

The returned Result may be returned to the pool with Release when no longer needed. This allows reducing GC load.

func (*Result) CopyTo added in v0.3.5

func (r *Result) CopyTo(dst *Result) *Result

CopyTo copies all the result to dst.

func (*Result) Equal added in v0.3.5

func (a *Result) Equal(b *Result) bool

Equal reports whether a and b.

func (*Result) RedirectURIWithQueryString added in v0.3.5

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

RedirectURIWithQueryString returns r.RedirectURI with queryString.

func (*Result) Release added in v0.3.5

func (r *Result) Release()

Release returns the object acquired via AcquireResult to the pool.

Do not access the released Result object, otherwise data races may occur.

func (*Result) Reset added in v0.3.5

func (r *Result) Reset()

Reset clears result.

func (*Result) RewriteURIWithQueryString added in v0.3.5

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

RewriteURIWithQueryString returns r.RewriteURI with queryString.

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, off int) *Result

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

func (*Routes) CachedRouteCtx

func (rs *Routes) CachedRouteCtx(ctx *fasthttp.RequestCtx, off int) *Result

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

func (*Routes) IsNextIfNotFound added in v0.4.3

func (rs *Routes) IsNextIfNotFound(i int) bool

func (*Routes) Route

func (rs *Routes) Route(method, path []byte, off int) *Result

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

Jump to

Keyboard shortcuts

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