checker

package
v0.12.10 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckType

type CheckType int

CheckType Checker类型

const (
	//CheckTypeEqual 全等匹配Checker类型
	CheckTypeEqual CheckType = iota
	//CheckTypePrefix 前缀匹配Checker类型
	CheckTypePrefix
	//CheckTypeSuffix 后缀匹配Checker类型
	CheckTypeSuffix
	//CheckTypeSub 子串匹配Checker类型
	CheckTypeSub
	//CheckTypeNotEqual 非等匹配Checker类型
	CheckTypeNotEqual
	//CheckTypeNone 空值匹配Checker类型
	CheckTypeNone
	//CheckTypeExist 存在匹配Checker类型
	CheckTypeExist
	//CheckTypeNotExist 不存在匹配Checker类型
	CheckTypeNotExist
	//CheckTypeRegular 区分大小写的正则匹配Checker类型
	CheckTypeRegular
	//CheckTypeRegularG 不区分大小写的正则匹配Checker类型
	CheckTypeRegularG
	//CheckTypeAll 任意匹配Checker类型
	CheckTypeAll
	// CheckMultiple 复合匹配
	CheckMultiple
)

type Checker

type Checker interface {
	Handler
	Key() string
	CheckType() CheckType
	Value() string
}

Checker 路由指标检查器接口

func Parse

func Parse(pattern string) (Checker, error)

Parse 可根据路由指标字符串生成相应的检查器

type Handler added in v0.8.0

type Handler interface {
	Check(v string, has bool) bool
}

func NewMultipleChecker added in v0.8.0

func NewMultipleChecker(checkers []Checker) Handler

type PrefixChecker

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

PrefixChecker 实现了Checker接口,能进行前缀匹配

func (*PrefixChecker) Check

func (p *PrefixChecker) Check(v string, has bool) bool

Check 判断待检测的路由指标值是否满足检查器的匹配规则

func (*PrefixChecker) CheckType

func (p *PrefixChecker) CheckType() CheckType

CheckType 返回检查器的类型值

func (*PrefixChecker) Key

func (p *PrefixChecker) Key() string

Key 返回路由指标检查器带有完整规则符号的检测值

func (*PrefixChecker) Value

func (p *PrefixChecker) Value() string

Value 返回路由指标检查器的检测值

type SubChecker

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

SubChecker 实现了Checker接口,能进行子串匹配

func (*SubChecker) Check

func (p *SubChecker) Check(v string, has bool) bool

Check 判断待检测的路由指标值是否满足检查器的匹配规则

func (*SubChecker) CheckType

func (p *SubChecker) CheckType() CheckType

CheckType 返回检查器的类型值

func (*SubChecker) Key

func (p *SubChecker) Key() string

Key 返回路由指标检查器带有完整规则符号的检测值

func (*SubChecker) Value

func (p *SubChecker) Value() string

Value 返回路由指标检查器的检测值

type SuffixChecker

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

SuffixChecker 实现了Checker接口,能进行后缀匹配

func (*SuffixChecker) Check

func (p *SuffixChecker) Check(v string, has bool) bool

Check 判断待检测的路由指标值是否满足检查器的匹配规则

func (*SuffixChecker) CheckType

func (p *SuffixChecker) CheckType() CheckType

CheckType 返回检查器的类型值

func (*SuffixChecker) Key

func (p *SuffixChecker) Key() string

Key 返回路由指标检查器带有完整规则符号的检测值

func (*SuffixChecker) Value

func (p *SuffixChecker) Value() string

Value 返回路由指标检查器的检测值

Jump to

Keyboard shortcuts

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