Files
apinto/checker/checker-all.go
黄孟柱 7dfd612e3d router
2021-11-12 15:22:04 +08:00

34 lines
798 B
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package checker
var globalCheckerAll = &checkerAll{}
//checkerAll 实现了Checker接口能进行任意匹配
type checkerAll struct {
}
//Key 返回路由指标检查器带有完整规则符号的检测值
func (t *checkerAll) Key() string {
return "*"
}
//Value 返回路由指标检查器的检测值
func (t *checkerAll) Value() string {
return "*"
}
//Check 判断待检测的路由指标值是否满足检查器的匹配规则
func (t *checkerAll) Check(v string, has bool) bool {
//任意匹配能通过任何类型的路由指标值
return true
}
//CheckType 返回检查器的类型值
func (t *checkerAll) CheckType() CheckType {
return CheckTypeAll
}
//newCheckerAll 创建一个任意匹配类型的检查器
func newCheckerAll() *checkerAll {
return globalCheckerAll
}