matchers

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: Apache-2.0 Imports: 11 Imported by: 5

Documentation

Index

Constants

View Source
const (
	IgnoreUnknown     = "ignoreUnknown"
	IgnoreOrder       = "ignoreOrder"
	IgnoreOccurrences = "ignoreOccurrences"
)

Variables

View Source
var Array = "array"
View Source
var Exact = "exact"
View Source
var Glob = "glob"
View Source
var JWT = "jwt"
View Source
var Json = "json"
View Source
var JsonPartial = "jsonpartial"
View Source
var JsonPath = "jsonpath"
View Source
var Matchers = map[string]MatcherDetails{

	"": {
		MatcherFunction:     ExactMatch,
		MatchValueGenerator: IdentityValueGenerator,
	},
	Exact: {
		MatcherFunction:     ExactMatch,
		MatchValueGenerator: IdentityValueGenerator,
	},
	Glob: {
		MatcherFunction:     GlobMatch,
		MatchValueGenerator: IdentityValueGenerator,
	},
	Json: {
		MatcherFunction:     JsonMatch,
		MatchValueGenerator: IdentityValueGenerator,
	},
	JsonPath: {
		MatcherFunction:     JsonPathMatch,
		MatchValueGenerator: JsonPathMatcherValueGenerator,
	},
	JsonPartial: {
		MatcherFunction:     JsonPartialMatch,
		MatchValueGenerator: IdentityValueGenerator,
	},
	Regex: {
		MatcherFunction:     RegexMatch,
		MatchValueGenerator: IdentityValueGenerator,
	},
	Xml: {
		MatcherFunction:     XmlMatch,
		MatchValueGenerator: IdentityValueGenerator,
	},
	Xpath: {
		MatcherFunction:     XpathMatch,
		MatchValueGenerator: XPathMatchValueGenerator,
	},
	XmlTemplated: {
		MatcherFunction:     XmlTemplatedMatch,
		MatchValueGenerator: IdentityValueGenerator,
	},
	Array: {
		MatcherFunction:     ArrayMatchWithoutConfig,
		MatchValueGenerator: IdentityValueGenerator,
	},
	JWT: {
		MatcherFunction:     JwtMatcher,
		MatchValueGenerator: JwtMatchValueGenerator,
	},
	Negation: {
		MatcherFunction:     NegationMatch,
		MatchValueGenerator: IdentityValueGenerator,
	},
}
View Source
var MatchersWithConfig = map[string]MatcherDetails{
	Array: {
		MatcherFunction:     ArrayMatch,
		MatchValueGenerator: IdentityValueGenerator,
	},
}
View Source
var Negation = "negate"
View Source
var Regex = "regex"
View Source
var Xml = "xml"
View Source
var XmlTemplated = "xmltemplated"
View Source
var Xpath = "xpath"

Functions

func ArrayMatch added in v1.5.0

func ArrayMatch(match interface{}, toMatch string, config map[string]interface{}) bool

func ArrayMatchWithoutConfig added in v1.5.0

func ArrayMatchWithoutConfig(match interface{}, toMatch string) bool

func ExactMatch

func ExactMatch(match interface{}, toMatch string) bool

func GetDecodedJsonData added in v1.5.0

func GetDecodedJsonData(str string) (interface{}, error)

func GlobMatch

func GlobMatch(match interface{}, toMatch string) bool

func IdentityValueGenerator added in v1.5.0

func IdentityValueGenerator(match interface{}, toMatch string) string

func JsonMatch

func JsonMatch(match interface{}, toMatch string) bool

func JsonPartialMatch added in v1.0.0

func JsonPartialMatch(match interface{}, toMatch string) bool

func JsonPathMatch

func JsonPathMatch(match interface{}, toMatch string) bool

func JsonPathMatcherValueGenerator added in v1.5.0

func JsonPathMatcherValueGenerator(match interface{}, toMatch string) string

func JwtMatchValueGenerator added in v1.5.0

func JwtMatchValueGenerator(match interface{}, toMatch string) string

func JwtMatcher added in v1.5.0

func JwtMatcher(data interface{}, toMatch string) bool

func NegationMatch added in v1.9.0

func NegationMatch(match interface{}, toMatch string) bool

func ParseJWT added in v1.5.0

func ParseJWT(str string) (string, error)

func RegexMatch

func RegexMatch(match interface{}, toMatch string) bool

func XPathMatchValueGenerator added in v1.5.0

func XPathMatchValueGenerator(match interface{}, toMatch string) string

func XmlMatch

func XmlMatch(match interface{}, toMatch string) bool

func XmlTemplatedMatch added in v1.2.0

func XmlTemplatedMatch(match interface{}, toMatch string) bool

func XpathMatch

func XpathMatch(match interface{}, toMatch string) bool

Types

type MatcherDetails added in v1.5.0

type MatcherDetails struct {
	MatcherFunction     interface{}
	MatchValueGenerator MatcherValueGenerator
}

type MatcherFunc

type MatcherFunc func(data interface{}, toMatch string) bool

type MatcherFuncWithConfig added in v1.5.0

type MatcherFuncWithConfig func(data interface{}, toMatch string, config map[string]interface{}) bool

type MatcherValueGenerator added in v1.5.0

type MatcherValueGenerator func(data interface{}, toMatch string) string
 this is called only if matcher returns true and there is chaining to feed value
	this is set as nil for matchers where we are doing complete details match and there is no need of chaining

Jump to

Keyboard shortcuts

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