Documentation ¶
Index ¶
- func MatchPathPattern(pattern, path string) (bool, error)
- func MatchPrefix(prefix, value string, caseInsensitive bool) (bool, error)
- func MatchRegex(regex, value string) (bool, error)
- func MatchRegexPattern(regex *regexp.Regexp, value string) (bool, error)
- func MatchString(expected, actual string, caseInsensitive bool) bool
- func MatchSubString(substr, actual string, caseInsensitive bool) bool
- func MatchSuffix(suffix, value string, caseInsensitive bool) (bool, error)
- type AndMatcher
- func (m AndMatcher) And(matchers ...Matcher) ChainableMatcher
- func (m AndMatcher) Matches(i interface{}) (ret bool, err error)
- func (m AndMatcher) MatchesWithContext(c context.Context, i interface{}) (ret bool, err error)
- func (m AndMatcher) Or(matchers ...Matcher) ChainableMatcher
- func (m AndMatcher) String() string
- type ChainableMatcher
- type GenericMatcher
- func (m *GenericMatcher) And(matchers ...Matcher) ChainableMatcher
- func (m *GenericMatcher) Matches(i interface{}) (bool, error)
- func (m *GenericMatcher) MatchesWithContext(c context.Context, i interface{}) (ret bool, err error)
- func (m *GenericMatcher) Or(matchers ...Matcher) ChainableMatcher
- func (m *GenericMatcher) String() string
- type Matcher
- type NegateMatcher
- func (m *NegateMatcher) And(matchers ...Matcher) ChainableMatcher
- func (m *NegateMatcher) Matches(i interface{}) (ret bool, err error)
- func (m NegateMatcher) MatchesWithContext(c context.Context, i interface{}) (ret bool, err error)
- func (m *NegateMatcher) Or(matchers ...Matcher) ChainableMatcher
- func (m NegateMatcher) String() string
- type NoopMatcher
- func (m NoopMatcher) And(matchers ...Matcher) ChainableMatcher
- func (m NoopMatcher) Matches(_ interface{}) (bool, error)
- func (m NoopMatcher) MatchesWithContext(context.Context, interface{}) (bool, error)
- func (m NoopMatcher) Or(matchers ...Matcher) ChainableMatcher
- func (m NoopMatcher) String() string
- type OrMatcher
- func (m OrMatcher) And(matchers ...Matcher) ChainableMatcher
- func (m OrMatcher) Matches(i interface{}) (ret bool, err error)
- func (m OrMatcher) MatchesWithContext(c context.Context, i interface{}) (ret bool, err error)
- func (m OrMatcher) Or(matchers ...Matcher) ChainableMatcher
- func (m OrMatcher) String() string
- type StringMatcher
- func AnyNonEmptyString() StringMatcher
- func WithPathPattern(pattern string) StringMatcher
- func WithPrefix(prefix string, caseInsensitive bool) StringMatcher
- func WithRegex(regex string) StringMatcher
- func WithRegexPattern(regex *regexp.Regexp) StringMatcher
- func WithString(expected string, caseInsensitive bool) StringMatcher
- func WithSubString(substr string, caseInsensitive bool) StringMatcher
- func WithSuffix(suffix string, caseInsensitive bool) StringMatcher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MatchPathPattern ¶
MatchPathPattern given string with path pattern The prefix syntax is:
prefix: { term } term: '*' matches any sequence of non-path-separators '**' matches any sequence of characters, including path separators. '?' matches any single non-path-separator character '[' [ '^' ] { character-range } ']' character class (must be non-empty) '{' { term } [ ',' { term } ... ] '}' c matches character c (c != '*', '?', '\\', '[') '\\' c matches character c character-range: c matches character c (c != '\\', '-', ']') '\\' c matches character c lo '-' hi matches character c for lo <= c <= hi
func MatchRegex ¶
func MatchString ¶
func MatchSubString ¶
Types ¶
type AndMatcher ¶
type AndMatcher []Matcher
AndMatcher chain a list of matchers with AND operator
func (AndMatcher) And ¶
func (m AndMatcher) And(matchers ...Matcher) ChainableMatcher
func (AndMatcher) Matches ¶
func (m AndMatcher) Matches(i interface{}) (ret bool, err error)
func (AndMatcher) MatchesWithContext ¶
func (m AndMatcher) MatchesWithContext(c context.Context, i interface{}) (ret bool, err error)
func (AndMatcher) Or ¶
func (m AndMatcher) Or(matchers ...Matcher) ChainableMatcher
func (AndMatcher) String ¶
func (m AndMatcher) String() string
type ChainableMatcher ¶
type ChainableMatcher interface { Matcher // Or concat given matchers with OR operator Or(matcher ...Matcher) ChainableMatcher // And concat given matchers with AND operator And(matcher ...Matcher) ChainableMatcher }
func And ¶
func And(left Matcher, right ...Matcher) ChainableMatcher
And concat given matchers with AND operator
func Or ¶
func Or(left Matcher, right ...Matcher) ChainableMatcher
Or concat given matchers with OR operator
type GenericMatcher ¶
type GenericMatcher struct {
// contains filtered or unexported fields
}
GenericMatcher implements ChainableMatcher TODO review use cases to determine if this class is necessary
func (*GenericMatcher) And ¶
func (m *GenericMatcher) And(matchers ...Matcher) ChainableMatcher
func (*GenericMatcher) Matches ¶
func (m *GenericMatcher) Matches(i interface{}) (bool, error)
func (*GenericMatcher) MatchesWithContext ¶
func (m *GenericMatcher) MatchesWithContext(c context.Context, i interface{}) (ret bool, err error)
func (*GenericMatcher) Or ¶
func (m *GenericMatcher) Or(matchers ...Matcher) ChainableMatcher
func (*GenericMatcher) String ¶
func (m *GenericMatcher) String() string
type NegateMatcher ¶
type NegateMatcher struct {
Matcher
}
NegateMatcher apply ! operator to embedded Matcher
func (*NegateMatcher) And ¶
func (m *NegateMatcher) And(matchers ...Matcher) ChainableMatcher
func (*NegateMatcher) Matches ¶
func (m *NegateMatcher) Matches(i interface{}) (ret bool, err error)
func (NegateMatcher) MatchesWithContext ¶
func (m NegateMatcher) MatchesWithContext(c context.Context, i interface{}) (ret bool, err error)
func (*NegateMatcher) Or ¶
func (m *NegateMatcher) Or(matchers ...Matcher) ChainableMatcher
func (NegateMatcher) String ¶
func (m NegateMatcher) String() string
type NoopMatcher ¶
type NoopMatcher bool
NoopMatcher matches stuff literally
func (NoopMatcher) And ¶
func (m NoopMatcher) And(matchers ...Matcher) ChainableMatcher
func (NoopMatcher) Matches ¶
func (m NoopMatcher) Matches(_ interface{}) (bool, error)
func (NoopMatcher) MatchesWithContext ¶
func (m NoopMatcher) MatchesWithContext(context.Context, interface{}) (bool, error)
func (NoopMatcher) Or ¶
func (m NoopMatcher) Or(matchers ...Matcher) ChainableMatcher
func (NoopMatcher) String ¶
func (m NoopMatcher) String() string
type OrMatcher ¶
type OrMatcher []Matcher
OrMatcher chain a list of matchers with OR operator
func (OrMatcher) And ¶
func (m OrMatcher) And(matchers ...Matcher) ChainableMatcher
func (OrMatcher) MatchesWithContext ¶
func (OrMatcher) Or ¶
func (m OrMatcher) Or(matchers ...Matcher) ChainableMatcher
type StringMatcher ¶
type StringMatcher interface { ChainableMatcher }
StringMatcher is a typed ChainableMatcher that accept String
func AnyNonEmptyString ¶
func AnyNonEmptyString() StringMatcher
func WithPathPattern ¶
func WithPathPattern(pattern string) StringMatcher
func WithPrefix ¶
func WithPrefix(prefix string, caseInsensitive bool) StringMatcher
func WithRegex ¶
func WithRegex(regex string) StringMatcher
func WithRegexPattern ¶
func WithRegexPattern(regex *regexp.Regexp) StringMatcher
func WithString ¶
func WithString(expected string, caseInsensitive bool) StringMatcher
func WithSubString ¶
func WithSubString(substr string, caseInsensitive bool) StringMatcher
func WithSuffix ¶
func WithSuffix(suffix string, caseInsensitive bool) StringMatcher
Click to show internal directories.
Click to hide internal directories.