Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetValuePatterns ¶
func GetValuePatterns() map[string]func() ValuePattern
GetValuePatterns gets all create valuePattern function
func SetValuePattern ¶
func SetValuePattern(name string, fun func() ValuePattern)
SetValuePattern sets create valuePattern function with @name
Types ¶
type ScopeValuePattern ¶
type ScopeValuePattern struct { }
ScopeValuePattern matches with patterns like 'key=1~100', 'key=~100' or 'key=1~'
func (*ScopeValuePattern) Match ¶
func (s *ScopeValuePattern) Match(pattern string, value string, url *common.URL, invocation protocol.Invocation, isWhenCondition bool) bool
func (*ScopeValuePattern) Priority ¶
func (s *ScopeValuePattern) Priority() int64
func (*ScopeValuePattern) ShouldMatch ¶
func (s *ScopeValuePattern) ShouldMatch(pattern string) bool
type ValuePattern ¶
type ValuePattern interface { // ShouldMatch indicates whether the input is a specific pattern, for example, range pattern '1~100', wildcard pattern 'hello*', etc. ShouldMatch(pattern string) bool // Match indicates whether a pattern is matched with the request context Match(pattern string, value string, url *common.URL, invocation protocol.Invocation, isWhenCondition bool) bool // Priority returns a priority for this valuePattern // 0 to ^int(0) is better, smaller value by better priority Priority() int64 }
func GetValuePattern ¶
func GetValuePattern(name string) ValuePattern
GetValuePattern gets create valuePattern function by name
func NewScopeValuePattern ¶
func NewScopeValuePattern() ValuePattern
func NewWildcardValuePattern ¶
func NewWildcardValuePattern() ValuePattern
type WildcardValuePattern ¶
type WildcardValuePattern struct { }
WildcardValuePattern evaluator must be the last one being executed. matches with patterns like 'key=hello', 'key=hello*', 'key=*hello', 'key=h*o' or 'key=*'
func (*WildcardValuePattern) Match ¶
func (w *WildcardValuePattern) Match(pattern string, value string, url *common.URL, invocation protocol.Invocation, isWhenCondition bool) bool
func (*WildcardValuePattern) Priority ¶
func (w *WildcardValuePattern) Priority() int64
func (*WildcardValuePattern) ShouldMatch ¶
func (w *WildcardValuePattern) ShouldMatch(pattern string) bool
Click to show internal directories.
Click to hide internal directories.