Matcher returns true if the expr matches the predicate.
type Matcher func(exp *expr.Expr) bool
func MatchAny(e **expr.Expr) Matcher
MatchAny matches any expr.Expr. The expr is populated in argument e.
func MatchAnyFloat(value *float64) Matcher
MatchAnyFloat matches an expr.Constant_DoubleValue with any value. The value of the expr is populated in argument value.
func MatchAnyFunction(name *string, args ...Matcher) Matcher
MatchAnyFunction matches an expr.Expr_Call where the provided args matches the function arguments. The name of the function is populated in argument name.
func MatchAnyInt(value *int64) Matcher
MatchAnyInt matches an expr.Constant_Int64Value with any value. The value of the expr is populated in argument value.
func MatchAnyMember(operand Matcher, field *string) Matcher
MatchAnyMember matches an expr.Expr_Select where the operand matches the argument operand. The field of the expr is populated in argument field.
func MatchAnyString(value *string) Matcher
MatchAnyString matches an expr.Constant_StringValue with any value. The value of the expr is populated in argument value.
func MatchAnyText(text *string) Matcher
MatchAnyText matches an expr.Expr_Ident with any name. The name of the expr is populated in argument text.
func MatchFloat(value float64) Matcher
MatchFloat matches an expr.Constant_DoubleValue with an exact value.
func MatchFunction(name string, args ...Matcher) Matcher
MatchFunction matches an expr.Expr_Call where the name of the expr matches argument name, and arguments of the function matches the provided args (length must match).
▹ Example (ValidateResourceNames)
func MatchInt(value int64) Matcher
MatchInt matches an expr.Constant_Int64Value with an exact value.
func MatchMember(operand Matcher, field string) Matcher
MatchMember matches an expr.Expr_Select where the operand matches the argument operand, and the field matches argument field.
func MatchString(s string) Matcher
MatchString matches an expr.Constant_StringValue with an exact value.
func MatchText(text string) Matcher
MatchText matches an expr.Expr_Ident where the name of the ident matches an exact value.