matcher

package
v0.83.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2026 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureLeadingSlash

func EnsureLeadingSlash(pattern string) string

func EnsureTrailingSlash

func EnsureTrailingSlash(pattern string) string

func HasLeadingSlash

func HasLeadingSlash(pattern string) bool

func HasTrailingSlash

func HasTrailingSlash(pattern string) bool

func JoinPatterns

func JoinPatterns(rp *RegisteredPattern, pattern string) string

func ParseSegments

func ParseSegments(path string) []string

func StripLeadingSlash

func StripLeadingSlash(pattern string) string

func StripTrailingSlash

func StripTrailingSlash(pattern string) string

Types

type BestMatch

type BestMatch struct {
	*RegisteredPattern
	Params      Params
	SplatValues []string
	// contains filtered or unexported fields
}

type FindNestedMatchesResults

type FindNestedMatchesResults struct {
	Params      Params
	SplatValues []string
	Matches     []*Match
}

type Match

type Match struct {
	*RegisteredPattern
	// contains filtered or unexported fields
}

type Matcher

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

func New

func New(opts *Options) *Matcher

func (*Matcher) FindBestMatch

func (m *Matcher) FindBestMatch(realPath string) (*BestMatch, bool)

func (*Matcher) FindNestedMatches

func (m *Matcher) FindNestedMatches(realPath string) (*FindNestedMatchesResults, bool)

func (*Matcher) GetDynamicParamPrefixRune

func (m *Matcher) GetDynamicParamPrefixRune() rune

func (*Matcher) GetExplicitIndexSegment

func (m *Matcher) GetExplicitIndexSegment() string

func (*Matcher) GetSplatSegmentRune

func (m *Matcher) GetSplatSegmentRune() rune

func (*Matcher) NormalizePattern

func (m *Matcher) NormalizePattern(originalPattern string) *RegisteredPattern

func (*Matcher) RegisterPattern

func (m *Matcher) RegisterPattern(originalPattern string) *RegisteredPattern

type Options

type Options struct {
	DynamicParamPrefixRune rune // Optional. Defaults to ':'.
	SplatSegmentRune       rune // Optional. Defaults to '*'.

	// Optional. Defaults to empty string (effectively a trailing slash in the pattern).
	// Could also be something like "_index" if preferred by the user.
	ExplicitIndexSegment string

	Quiet bool // Optional. Defaults to false. Set to true if you want to quash warnings.
}

type Params

type Params = map[string]string

type RegisteredPattern

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

func (*RegisteredPattern) NormalizedPattern

func (rp *RegisteredPattern) NormalizedPattern() string

func (*RegisteredPattern) NormalizedSegments

func (rp *RegisteredPattern) NormalizedSegments() []*segment

func (*RegisteredPattern) OriginalPattern

func (rp *RegisteredPattern) OriginalPattern() string

Jump to

Keyboard shortcuts

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