Documentation
¶
Overview ¶
Package assert parses and evaluates `# @assert` expressions of the form `<selector> <op> <value>` or `<selector> exists` / `<selector> not exists`.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Operators = []string{"==", "!=", "<=", ">=", "<", ">", "contains", "matches", "startsWith", "endsWith", "exists", "not exists"}
Operators lists the supported comparison operators.
Functions ¶
func ParseNumber ¶
ParseNumber reads a decimal number exactly, so large integers such as 9007199254740993 keep their value instead of rounding through float64, and values beyond float64's range (1e1000) still compare as numbers. Words, Inf, NaN, fractions like 1/2 and numbers with more than 4096 digits or an exponent beyond ±4096 are not numbers here and compare as text.
Types ¶
type Expr ¶
type Expr struct {
Selector string
Op string
Value string // raw right-hand side; may contain {{placeholders}}
}
Expr is a parsed assertion.