Documentation
¶
Overview ¶
Package functions provides the RFC 9535 §2.4 built-in function implementations for JSONPath filter expressions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CountFunc ¶
type CountFunc struct{}
CountFunc implements the RFC 9535 §2.4.6 count() function. It returns the number of nodes in a node list argument.
func (CountFunc) Call ¶
func (CountFunc) Call(args []ast.FunctionValue) ast.FunctionValue
Call returns the number of nodes in the node list argument.
func (CountFunc) ParameterCount ¶ added in v0.1.17
ParameterCount returns the fixed arity.
func (CountFunc) ParameterType ¶ added in v0.1.17
ParameterType returns the parameter type.
func (CountFunc) ResultType ¶
ResultType returns the function result type.
type LengthFunc ¶
type LengthFunc struct{}
LengthFunc implements the RFC 9535 §2.4.4 length() function. It returns the number of Unicode scalar values in a string, array elements, or object members, and nil for other inputs.
func (LengthFunc) Call ¶
func (LengthFunc) Call(args []ast.FunctionValue) ast.FunctionValue
Call returns the length of the argument:
- string: number of Unicode scalar values
- []any: number of elements
- map[string]any: number of members
- nil or other: nil
func (LengthFunc) ParameterCount ¶ added in v0.1.17
func (LengthFunc) ParameterCount() int
ParameterCount returns the fixed arity.
func (LengthFunc) ParameterType ¶ added in v0.1.17
func (LengthFunc) ParameterType(int) ast.FuncType
ParameterType returns the parameter type.
func (LengthFunc) ResultType ¶
func (LengthFunc) ResultType() ast.FuncType
ResultType returns the function result type.
type MatchFunc ¶
type MatchFunc struct{}
MatchFunc implements the RFC 9535 §2.4.7 match() function. It reports whether the string argument fully matches the regex pattern.
func (MatchFunc) Call ¶
func (MatchFunc) Call(args []ast.FunctionValue) ast.FunctionValue
Call returns true if the string argument fully matches the regex pattern. Returns false if either argument is not a string or the regex is invalid.
func (MatchFunc) ParameterCount ¶ added in v0.1.17
ParameterCount returns the fixed arity.
func (MatchFunc) ParameterType ¶ added in v0.1.17
ParameterType returns the parameter type.
func (MatchFunc) ResultType ¶
ResultType returns the function result type.
type SearchFunc ¶
type SearchFunc struct{}
SearchFunc implements the RFC 9535 §2.4.7 search() function. It reports whether the string argument contains a substring matching the regex pattern.
func (SearchFunc) Call ¶
func (SearchFunc) Call(args []ast.FunctionValue) ast.FunctionValue
Call returns true if the string argument contains a match for the regex pattern. Returns false if either argument is not a string or the regex is invalid.
func (SearchFunc) ParameterCount ¶ added in v0.1.17
func (SearchFunc) ParameterCount() int
ParameterCount returns the fixed arity.
func (SearchFunc) ParameterType ¶ added in v0.1.17
func (SearchFunc) ParameterType(int) ast.FuncType
ParameterType returns the parameter type.
func (SearchFunc) ResultType ¶
func (SearchFunc) ResultType() ast.FuncType
ResultType returns the function result type.
type ValueFunc ¶
type ValueFunc struct{}
ValueFunc implements the RFC 9535 §2.4.8 value() function. It returns the value of a single-node list and nil for empty or multi-node lists.
func (ValueFunc) Call ¶
func (ValueFunc) Call(args []ast.FunctionValue) ast.FunctionValue
Call returns the value of the single node in the node list, or nil if the list is empty or contains more than one node.
func (ValueFunc) ParameterCount ¶ added in v0.1.17
ParameterCount returns the fixed arity.
func (ValueFunc) ParameterType ¶ added in v0.1.17
ParameterType returns the parameter type.
func (ValueFunc) ResultType ¶
ResultType returns the function result type.