path

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxPathSegments               = 19
	MatchTypeUnknown              = MatchType(0)
	MatchTypeLiteral              = MatchType(1)
	MatchTypeConstraintCaptureVar = MatchType(2)
	MatchTypeCaptureVar           = MatchType(3)
	MatchTypeRegex                = MatchType(4)
	MatchTypeSingleSegment        = MatchType(5)
	MatchTypeMultipleSegments     = MatchType(6)
)

Variables

This section is empty.

Functions

func ParseURLPath

func ParseURLPath(requestUrl *url.URL, mc *MatchingContext)

Types

type CaptureVar

type CaptureVar struct {
	Name  string
	Value string
}

func (*CaptureVar) String

func (cv *CaptureVar) String() string

type MatchType

type MatchType uint8

type Matcher

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

func NewMatcher

func NewMatcher(caseInsensitive bool) *Matcher

func (*Matcher) AddPattern

func (m *Matcher) AddPattern(pattern *Pattern) error

func (*Matcher) Match

func (m *Matcher) Match(urlPath string, mc *MatchingContext) *Pattern

type MatchingContext

type MatchingContext struct {
	R *http.Request

	PathSegments []UrlSegment
	// contains filtered or unexported fields
}

func (*MatchingContext) Clone

func (mc *MatchingContext) Clone() MatchingContext

func (*MatchingContext) PathVar

func (mc *MatchingContext) PathVar(name string) string

type Pattern

type Pattern struct {
	RawValue   string
	Attachment any
	// contains filtered or unexported fields
}

func ParsePattern

func ParsePattern(pathPattern string, caseInsensitive bool) (*Pattern, error)

func (*Pattern) HighPriorityThan

func (p *Pattern) HighPriorityThan(other *Pattern) bool

func (*Pattern) String

func (p *Pattern) String() string

type UrlSegment

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

func (*UrlSegment) Reset

func (s *UrlSegment) Reset()

Jump to

Keyboard shortcuts

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