match

package
v2.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasMultipleMatchers

func HasMultipleMatchers(matcher string) bool

HasMultipleMatchers returns true if the matcher contains multiple definitions

func HasWildCards

func HasWildCards(matcher string) bool

HasWildCards returns true if the passed matcher string contains a wildcard, false otherwise.

Types

type Result

type Result struct {
	Matched         bool
	MatchingPattern string
}

type StringMatcher

type StringMatcher interface {
	fmt.Stringer

	// Matches returns true if the provided value is matched by the matcher
	Matches(value string) Result
	// WasMatched returns nil if the matcher had a match, otherwise returning a diagnostic error
	WasMatched() error
	// IsRestrictive returns true if the matcher is populated and will restrict matches
	IsRestrictive() bool
}

StringMatcher is an interface implemented by predicates used to test string values

func NewStringMatcher

func NewStringMatcher(matcher string) StringMatcher

NewStringMatcher returns a matcher for the specified string Different strings may return different implementations: o If the string contains ';', a multi-matcher of sub-matches, one for each item in the string separated by ';' o If the string contains '*' or '?' a globbing wildcard matcher o Otherwise a case-insensitive literal string matcher

Jump to

Keyboard shortcuts

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