route

package
v1.0.18 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const MaxParams = 30

Variables

This section is empty.

Functions

func GetTrimmedParam

func GetTrimmedParam(param string) string

GetTrimmedParam trims the ':' & '?' from a string

func Params

func Params(params []string, values [MaxParams]string, key string, defaultValue ...string) string

Types

type RouteParser

type RouteParser struct {
	Segs          []*routeSegment // the parsed segments of the route
	Params        []string        // that parameter names the parsed route
	WildCardCount int             // number of wildcard parameters, used internally to give the wildcard parameter its number
	PlusCount     int             // number of plus parameters, used internally to give the plus parameter its number
}

routeParser holds the path segments and param names

func ParseRoute

func ParseRoute(pattern string) RouteParser

parseRoute analyzes the route and divides it into segments for constant areas and parameters, this information is needed later when assigning the requests to the declared routes

func (*RouteParser) GetMatch

func (routeParser *RouteParser) GetMatch(s, original string, params *[MaxParams]string, partialCheck bool) bool

getMatch parses the passed url and tries to match it against the route segments and determine the parameter positions

Jump to

Keyboard shortcuts

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