### PathValue Implementation Example Source: https://pkg.go.dev/github.com/theory/jsonpath/spec This example demonstrates how to print the FuncType for each implementation of the PathValue interface. ```text Output: Implementation FuncType ----------------- -------- *spec.ValueType Value spec.NodesType Nodes spec.LogicalType Logical ``` -------------------------------- ### Construct Path Queries Example Source: https://pkg.go.dev/github.com/theory/jsonpath/spec This example demonstrates constructing different PathQuery instances. It shows how to specify a root query and nested selections, including wildcard and multi-key selections. ```text $["store"]["book"][*]["author"] $["profile"]..["email","phone"] ``` -------------------------------- ### SliceSelector Start Method Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Retrieves the start position defined in the SliceSelector. ```go func (s SliceSelector) Start() int ``` -------------------------------- ### SliceSelector.Start Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Start returns the start position of the slice selector. ```APIDOC ## SliceSelector.Start ### Description Start returns the start position. ### Signature ```go func (s SliceSelector) Start() int ``` ``` -------------------------------- ### Example LogicalOr Expression Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Shows how to assemble a LogicalOr expression from multiple LogicalAnd expressions. ```go @["answer"] || 42 ``` -------------------------------- ### Example Slice Selector Formats Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Demonstrates various formats for creating SliceSelectors. ```jsonpath : 1:4 :8 4:-1:3 5:1:-2 ``` -------------------------------- ### Example LogicalAnd Expression Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Shows how to assemble a LogicalAnd expression consisting of multiple basic expressions. ```go 42 && @["answer"] ``` -------------------------------- ### Example ValueType Creation Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Demonstrates creating ValueType instances for different JSON-compatible Go types. ```jsonpath hello 42 98.6 1024 true map[x:true] [1 2 false] ``` -------------------------------- ### Example of creating a NodesType Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Demonstrates creating a NodesType, which represents a list of nodes or a JSON array. ```go [hi 42 true] ``` -------------------------------- ### Example of creating Name selectors Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Illustrates the creation of various Name selectors, including those with special characters and Unicode. ```go "hello" "Charlie \"Bird\" Parker" "އައްސަލާމް ޢަލައިކުމް" " 📡🪛🪤" ``` -------------------------------- ### Example of LogicalType conversions Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Demonstrates conversions of PathValue implementations to LogicalType. Note that ValueType panics on conversion. ```go logical: true logical: false logical: false ``` -------------------------------- ### Segment Child Example Source: https://pkg.go.dev/github.com/theory/jsonpath/spec This example shows how to create a child segment that selects the name 'hi', index 2, or a slice from index 1 to 3. ```text Output: ["hi",2,1:3] ``` -------------------------------- ### Example Singular Query Path Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Illustrates a typical output path for a singular query expression. ```jsonpath $["profile"]["contacts"][0]["email"] ``` -------------------------------- ### Parenthesized Expression Example Source: https://pkg.go.dev/github.com/theory/jsonpath/spec This example shows how to group a LogicalOr expression using ParenExpr. Parentheses are used to control the order of operations. ```text (@["answer"] || @["question"]) ``` -------------------------------- ### Example LogicalType Values Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Shows the literal representation of true and false values for LogicalType. ```go true false ``` -------------------------------- ### Example of NodesType conversions Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Shows conversions to NodesType, highlighting that only NodesType and nil can be converted without panic. ```go nodes: [1 2 3] nodes: [] ``` -------------------------------- ### Segment Descendant Example Source: https://pkg.go.dev/github.com/theory/jsonpath/spec This example demonstrates creating a descendant segment that selects the 'email' name or array index 0 from any node or its descendants. ```text Output: ..["email",0] ``` -------------------------------- ### Example Usage of LiteralArg Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Demonstrates passing a LiteralArg to a function, such as 'length'. ```go length("some string") ``` -------------------------------- ### LocatedNodeList.Clone Example Source: https://pkg.go.dev/github.com/theory/jsonpath Demonstrates the functionality of the Clone method for LocatedNodeList. It returns a shallow copy, useful for preserving the original list while performing operations on a copy. ```go func (list LocatedNodeList) Clone() LocatedNodeList { return list } ``` -------------------------------- ### Negated Function Expression Example Source: https://pkg.go.dev/github.com/theory/jsonpath/spec This example shows a negated function expression using the standard count() function. The '!' negates the result of the underlying function. ```text !length(@[0]) ``` -------------------------------- ### Example Index Selectors Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Illustrates the creation of different index selectors for array access in JSONPath queries. These can be positive, negative, or zero-based. ```go 0 3 -1 ``` -------------------------------- ### Example of a nonexistence expression Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Illustrates creating a nonexistence expression, which is used as a filter expression in JSONPath. ```go ?!@["x"] ``` -------------------------------- ### Example LocatedNode Output Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Illustrates the structure of LocatedNode output, showing selected nodes and their corresponding paths within a JSON document. ```json [ { "node": "Nigel Rees", "path": "$\"'store\"['book'][0]['author']" }, { "node": "Evelyn Waugh", "path": "$\"'store\"['book'][1]['author']" }, { "node": "Herman Melville", "path": "$\"'store\"['book'][2]['author']" }, { "node": "J. R. R. Tolkien", "path": "$\"'store\"['book'][3]['author']" } ] ``` -------------------------------- ### LocatedNodeList Example Source: https://pkg.go.dev/github.com/theory/jsonpath Illustrates the output of Path.SelectLocated, showing both the selected nodes and their corresponding paths within the input data. This is useful for understanding the precise location of selected elements. ```go type LocatedNodeList []*spec.LocatedNode // Example usage: // list := LocatedNodeList{...} // fmt.Printf("Nodes:\n%v\n\nPaths:\n%v\n", list.Nodes(), list.Paths()) ``` -------------------------------- ### Example Usage of match() Function Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Demonstrates how to use the standard match() function within a function expression to query JSON data. This is useful for pattern matching string values. ```go match(@["rating"], "good$") ``` -------------------------------- ### Get FuncExtension Name Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns the name of the FuncExtension, which is used in JSONPath queries. ```go func (f *FuncExtension) Name() string ``` -------------------------------- ### Negated Parenthesized Expression Example Source: https://pkg.go.dev/github.com/theory/jsonpath/spec This example demonstrates negating a LogicalOr expression using NotParenExpr. The '!' operator negates the entire grouped expression. ```text !(@["answer"] || @["question"]) ``` -------------------------------- ### Get FuncExtension Return Type Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns the data type that the FuncExtension is expected to return. ```go func (f *FuncExtension) ReturnType() FuncType ``` -------------------------------- ### Get Path's Root Query Source: https://pkg.go.dev/github.com/theory/jsonpath Returns the root spec.PathQuery of a Path object. ```go func (p *Path) Query() *spec.PathQuery ``` -------------------------------- ### Create a PathQuery Source: https://pkg.go.dev/github.com/theory/jsonpath/spec The Query function creates and returns a new PathQuery. The 'root' parameter indicates if the query starts from the root of the JSON document. Segments define the path components. ```go func Query(root bool, segments ...*Segment) *PathQuery ``` -------------------------------- ### Slice Function Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Creates a new SliceSelector with specified start, end, and step arguments. Accepts integers or nils. ```go func Slice(args ...any) SliceSelector ``` -------------------------------- ### Get String Representation of ValueType Source: https://pkg.go.dev/github.com/theory/jsonpath/spec String returns the string representation of a ValueType. Added in v0.9.0. ```go func (vt *ValueType) String() string ``` -------------------------------- ### Slice Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Slice creates a new SliceSelector. Pass up to three integers or nils for the start, end, and step arguments. Subsequent arguments are ignored. ```APIDOC ## Slice ### Description Creates a new SliceSelector. Pass up to three integers or nils for the start, end, and step arguments. Subsequent arguments are ignored. ### Signature ```go func Slice(args ...any) SliceSelector ``` ``` -------------------------------- ### Get string representation of Name Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns the quoted string representation of a Name selector. Defined by the fmt.Stringer interface. ```go func (n Name) String() string ``` -------------------------------- ### Get String Representation of NormalizedPath Source: https://pkg.go.dev/github.com/theory/jsonpath/spec The String method returns the string representation of a NormalizedPath. This provides a human-readable format for the path. ```go func (np NormalizedPath) String() string ``` -------------------------------- ### Create New Parser Source: https://pkg.go.dev/github.com/theory/jsonpath Creates a new Parser instance, configured by the provided Option functions. ```go func NewParser(opt ...Option) *Parser ``` -------------------------------- ### Get FuncType for NodesType Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns FuncNodes for NodesType. Defined by the PathValue interface. ```go func (NodesType) FuncType() FuncType ``` -------------------------------- ### Parser Creation and Usage Source: https://pkg.go.dev/github.com/theory/jsonpath Demonstrates how to create a new JSONPath parser, optionally with custom configurations like a registry, and use it to parse JSONPath queries. ```APIDOC ## NewParser ### Description Creates a new Parser configured by opt. ### Signature ```go func NewParser(opt ...Option) *Parser ``` ## WithRegistry ### Description Configures a Parser with a registry.Registry, which may contain function extensions. ### Signature ```go func WithRegistry(reg *registry.Registry) Option ``` ### Example Use WithRegistry to create a Parser that uses a registry.Registry containing function extensions, as defined by the standard. This example creates a function named "first" that returns the first item in a list of nodes. ### Output ``` [[6 7 8 9]] ``` ## Parser.Parse ### Description Parses path, a JSONPath query string, into a Path. Returns an ErrPathParse on parse failure. ### Signature ```go func (c *Parser) Parse(path string) (*Path, error) ``` ## Parser.MustParse ### Description Parses path, a JSONPath query string, into a Path. Panics with an ErrPathParse on parse failure. ### Signature ```go func (c *Parser) MustParse(path string) *Path ``` ``` -------------------------------- ### Get FuncType for LogicalType Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns FuncLogical for LogicalType. Defined by the PathValue interface. ```go func (LogicalType) FuncType() FuncType ``` -------------------------------- ### Creating a New Registry Source: https://pkg.go.dev/github.com/theory/jsonpath/registry Initializes and returns a new Registry instance. The new registry is pre-loaded with the standard RFC 9535 mandated function extensions: length, count, value, match, and search. ```go func New() *Registry ``` -------------------------------- ### Get LiteralArg Value Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns the underlying value stored within the LiteralArg. ```go func (la *LiteralArg) Value() any ``` -------------------------------- ### Configure Parser with Registry Source: https://pkg.go.dev/github.com/theory/jsonpath Creates a Parser Option that configures the Parser with a registry.Registry, allowing for function extensions. ```go func WithRegistry(reg *registry.Registry) Option ``` -------------------------------- ### Path Creation and Usage Source: https://pkg.go.dev/github.com/theory/jsonpath Details on creating Path objects directly or from existing queries, and selecting data from JSON input using a Path. ```APIDOC ## MustParse (global) ### Description MustParse parses path into a Path. Panics with an ErrPathParse on parse failure. ### Signature ```go func MustParse(path string) *Path ``` ## New ### Description Creates and returns a new Path consisting of q. ### Signature ```go func New(q *spec.PathQuery) *Path ``` ## Parse (global) ### Description Parse parses path, a JSONPath query string, into a Path. Returns an ErrPathParse on parse failure. ### Signature ```go func Parse(path string) (*Path, error) ``` ## Path.Select ### Description Select returns the nodes that JSONPath query p selects from input. ### Signature ```go func (p *Path) Select(input any) NodeList ``` ### Example ``` Output: 19.99 5.99 ``` ``` -------------------------------- ### Get Underlying Value of ValueType Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Value returns the underlying value stored within a ValueType. ```go func (vt *ValueType) Value() any ``` -------------------------------- ### Compare Normalized JSONPath and JSON Pointer Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Demonstrates the string representation of a normalized JSONPath and its equivalent JSON Pointer format. This is useful for understanding the relationship between the two. ```text $['x'][1]['y'] /x/1/y ``` -------------------------------- ### Create LogicalAnd Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Creates a LogicalAnd expression from a variable number of BasicExpr arguments. ```go func And(expr ...BasicExpr) LogicalAnd ``` -------------------------------- ### Create New Path Source: https://pkg.go.dev/github.com/theory/jsonpath Creates and returns a new Path object from a spec.PathQuery. ```go func New(q *spec.PathQuery) *Path ``` -------------------------------- ### Get ValueType Function Type Source: https://pkg.go.dev/github.com/theory/jsonpath/spec FuncType returns the FuncValue for a ValueType. This is defined by the PathValue interface. ```go func (*ValueType) FuncType() FuncType ``` -------------------------------- ### Get string representation of NodesType Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns the string representation of a NodesType. Defined by the fmt.Stringer interface. ```go func (nt NodesType) String() string ``` -------------------------------- ### PathQuery String Method Source: https://pkg.go.dev/github.com/theory/jsonpath/spec String returns a string representation of the PathQuery. ```go func (q *PathQuery) String() string ``` -------------------------------- ### Get boolean value from LogicalType Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns the boolean equivalent of a LogicalType. Defined by the PathValue interface. ```go func (lt LogicalType) Bool() bool ``` -------------------------------- ### Path.String Source: https://pkg.go.dev/github.com/theory/jsonpath String returns a string representation of p. ```APIDOC ## func (*Path) String ¶ ```go func (p *Path) String() string ``` ### Description String returns a string representation of p. ``` -------------------------------- ### WithRegistry Source: https://pkg.go.dev/github.com/theory/jsonpath Option to configure the parser with a custom function registry. ```APIDOC ## WithRegistry ### Description Option to configure the parser with a custom function registry. ### Method func WithRegistry(reg *registry.Registry) Option ### Parameters #### Path Parameters - **reg** (*registry.Registry) - Required - The custom function registry. ``` -------------------------------- ### Create a FuncExpr Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Function to create a new FuncExpr, which represents a function call with specified arguments. Use this to build complex query logic programmatically. ```go func Function(fn *FuncExtension, args ...FuncExprArg) *FuncExpr ``` -------------------------------- ### Get LiteralArg Result Type Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns the result type of the LiteralArg, which is FuncValue. Defined by the FuncExprArg interface. ```go func (la *LiteralArg) ResultType() FuncType ``` -------------------------------- ### Select Nodes from Input using Path Source: https://pkg.go.dev/github.com/theory/jsonpath Selects nodes from a JSON input using the Path query. Returns a NodeList. ```go func (p *Path) Select(input any) NodeList ``` -------------------------------- ### Evaluate a FuncExtension Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Executes the FuncExtension against provided arguments. The result type is determined by the extension's configuration. ```go func (f *FuncExtension) Evaluate(args []PathValue) PathValue ``` -------------------------------- ### SingularQueryExpr String Method Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Provides the string representation of a SingularQueryExpr. ```go func (sq *SingularQueryExpr) String() string ``` -------------------------------- ### Get LogicalOr Result Type Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns the result type of a LogicalOr expression, which is FuncLogical. Defined by the FuncExprArg interface. ```go func (lo LogicalOr) ResultType() FuncType ``` -------------------------------- ### Marshal Text for Path Source: https://pkg.go.dev/github.com/theory/jsonpath Encodes a Path into UTF-8-encoded text. Implements encoding.TextMarshaler. ```go func (p *Path) MarshalText() ([]byte, error) ``` -------------------------------- ### Marshal Binary for Path Source: https://pkg.go.dev/github.com/theory/jsonpath Encodes a Path into UTF-8-encoded bytes. Implements encoding.BinaryMarshaler. ```go func (p *Path) MarshalBinary() ([]byte, error) ``` -------------------------------- ### Iterate Over All Nodes in NodeList Source: https://pkg.go.dev/github.com/theory/jsonpath Returns an iterator over all nodes in a NodeList. Allows ranging over the list to get indexes and values. ```go func (list NodeList) All() iter.Seq[any] ``` -------------------------------- ### Get String Representation of WildcardSelector Source: https://pkg.go.dev/github.com/theory/jsonpath/spec String returns the string representation of a WildcardSelector, which is '*'. Defined by the fmt.Stringer interface. Added in v0.2.0. ```go func (WildcardSelector) String() string ``` -------------------------------- ### NewParser Source: https://pkg.go.dev/github.com/theory/jsonpath Creates a new JSONPath parser with optional configurations. ```APIDOC ## NewParser ### Description Creates a new JSONPath parser with optional configurations. ### Method func NewParser(opt ...Option) *Parser ### Parameters #### Path Parameters - **opt** (...Option) - Optional - Options to configure the parser, such as WithRegistry. ``` -------------------------------- ### And Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Creates a LogicalAnd expression from a variadic list of BasicExpr. ```APIDOC ## func And ### Description And creates a LogicalAnd of all expr. ### Signature ```go func And(expr ...BasicExpr) LogicalAnd ``` ``` -------------------------------- ### SingularQueryExpr.String Source: https://pkg.go.dev/github.com/theory/jsonpath/spec String returns the string representation of the SingularQueryExpr. ```APIDOC ## SingularQueryExpr.String ### Description String returns the string representation of sq. ### Signature ```go func (sq *SingularQueryExpr) String() string ``` ``` -------------------------------- ### New Registry Source: https://pkg.go.dev/github.com/theory/jsonpath/registry Creates and returns a new Registry instance. This new registry is pre-populated with the standard RFC 9535-mandated function extensions. ```APIDOC ## func New ### Description New returns a new Registry loaded with the RFC 9535-mandated function extensions: length, count, value, match, search. ### Signature ```go func New() *Registry ``` ``` -------------------------------- ### Get FuncExpr Result Type Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Retrieves the result type of a FuncExpr. This is defined by the FuncExprArg interface and indicates the data type the function will return. ```go func (fe *FuncExpr) ResultType() FuncType ``` -------------------------------- ### Create WildcardSelector Singleton Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Wildcard returns a singleton instance of WildcardSelector. Added in v0.2.0. ```go func Wildcard() WildcardSelector ``` -------------------------------- ### Path.String Source: https://pkg.go.dev/github.com/theory/jsonpath Returns the string representation of the Path. ```APIDOC ## Path.String ### Description Returns the string representation of the Path. ### Method func (p *Path) String() string ### Response #### Success Response (string) - **string** - The string representation of the Path. ``` -------------------------------- ### Get Function Extension Source: https://pkg.go.dev/github.com/theory/jsonpath/registry Retrieves a registered function extension by its name. If no function with the specified name exists, it returns nil. This is used by the parser to find function implementations. ```APIDOC ## func (*Registry) Get ### Description Get returns a reference to the registered function extension named name. Returns nil if no function with that name has been registered. Used by the parser to match a function name to its implementation. ### Signature ```go func (r *Registry) Get(name string) *spec.FuncExtension ``` ### Parameters #### Path Parameters - **name** (string) - The name of the function extension to retrieve. ``` -------------------------------- ### String Representation of LogicalAnd Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns the string representation of a LogicalAnd expression. ```go func (la LogicalAnd) String() string ``` -------------------------------- ### Retrieving a Registered Function Extension Source: https://pkg.go.dev/github.com/theory/jsonpath/registry Gets a reference to a registered function extension by its name. Returns nil if no function with the specified name is found. This is used by the JSONPath parser to link function names to their implementations. ```go func (r *Registry) Get(name string) *spec.FuncExtension ``` -------------------------------- ### Function Creation Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Creates a new FuncExpr that will execute a given function against the return values of provided arguments. ```APIDOC ## func Function ### Description Function creates and returns a new FuncExpr that will execute fn against the return values of args. ### Signature ```go func Function(fn *FuncExtension, args ...FuncExprArg) *FuncExpr ``` ### Parameters - **fn** (*FuncExtension) - The function extension to execute. - **args** (...FuncExprArg) - A variadic list of function arguments. ``` -------------------------------- ### PathQuery Singular Method Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Singular returns the SingularQueryExpr variant of the PathQuery if it is a singular query; otherwise, it returns nil. ```go func (q *PathQuery) Singular() *SingularQueryExpr ``` -------------------------------- ### Go Path String Function Source: https://pkg.go.dev/github.com/theory/jsonpath String returns a string representation of the Path object. ```go func (p *Path) String() string ``` -------------------------------- ### PathQuery Select Method Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Select retrieves values from the current or root context based on the PathQuery's segments. If no segments exist, it returns the current value. ```go func (q *PathQuery) Select(current, root any) []any ``` -------------------------------- ### Name Type and Methods Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Documentation for the Name type, used for key name selectors in JSONPath, and its associated methods. ```APIDOC ## type Name ### Description Name is a key name selector, e.g., .name or ["name"], as defined by RFC 9535 Section 2.3.1. Interfaces implemented: * Selector * fmt.Stringer * NormalSelector ### Example Create a few name selectors. ``` "hello" "Charlie \"Bird\" Parker" "އައްސަލާމް ޢަލައިކުމް" " 📡🪛🪤" ``` ``` ```APIDOC ## func (Name) Select ### Description Select selects n from input and returns it as a single value in a slice. Returns an empty slice if input is not a string-keyed map or if it does not contain n. Defined by the Selector interface. ### Signature ```go func (n Name) Select(input, _ any) []any ``` ``` ```APIDOC ## func (Name) SelectLocated ### Description SelectLocated selects n from input and returns it with its normalized path as a single LocatedNode in a slice. Returns an empty slice if input is not a string-keyed map or if it does not contain n. Defined by the Selector interface. ### Signature ```go func (n Name) SelectLocated(input, _ any, parent NormalizedPath) []*LocatedNode ``` ``` ```APIDOC ## func (Name) String ### Description String returns the quoted string representation of n. ### Signature ```go func (n Name) String() string ``` ``` -------------------------------- ### LogicalAnd.String Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns the string representation of the LogicalAnd expression. ```APIDOC ## func (LogicalAnd) String ### Description String returns the string representation of la. ### Signature ```go func (la LogicalAnd) String() string ``` ``` -------------------------------- ### String Representation of FuncExpr Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns a string representation of a FuncExpr. This is helpful for debugging and logging query expressions. ```go func (fe *FuncExpr) String() string ``` -------------------------------- ### Registering a Custom JSONPath Function Extension Source: https://pkg.go.dev/github.com/theory/jsonpath/registry Demonstrates how to register a new function extension with the Registry. This involves providing the function's name, return type, a validator, and the evaluator implementation. Returns ErrRegister if the validator or evaluator is nil, or if the name is already registered. ```go func (r *Registry) Register( name string, resultType spec.FuncType, validator spec.Validator, evaluator spec.Evaluator, ) error ``` -------------------------------- ### Compare two NormalizedPaths Source: https://pkg.go.dev/github.com/theory/jsonpath/spec The Compare method compares two NormalizedPath instances. It returns -1 if the first path is less than the second, 1 if it's greater, and 0 if they are equal. Indexes are considered less than names. ```go func (np NormalizedPath) Compare(np2 NormalizedPath) int ``` -------------------------------- ### Define Name type for key selectors Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Name represents a key name selector, e.g., .name or ["name"]. Implements Selector, fmt.Stringer, and NormalSelector. ```go type Name string ``` -------------------------------- ### Path Serialization Source: https://pkg.go.dev/github.com/theory/jsonpath Provides details on how to serialize a Path object into binary or text formats. ```APIDOC ## Path.MarshalBinary ### Description MarshalBinary encodes p into UTF-8-encoded bytes and returns the result. Implements encoding.BinaryMarshaler. ### Signature ```go func (p *Path) MarshalBinary() ([]byte, error) ``` ## Path.MarshalText ### Description MarshalText encodes p into UTF-8-encoded text and returns the result. Implements encoding.TextMarshaler. ### Signature ```go func (p *Path) MarshalText() ([]byte, error) ``` ``` -------------------------------- ### Or Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Creates a LogicalOr expression from a variadic list of LogicalAnd. ```APIDOC ## func Or ### Description Or returns a LogicalOr of all expr. ### Signature ```go func Or(expr ...LogicalAnd) LogicalOr ``` ``` -------------------------------- ### Create LogicalOr Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Creates a LogicalOr expression from a variable number of LogicalAnd arguments. ```go func Or(expr ...LogicalAnd) LogicalOr ``` -------------------------------- ### Path.Query Source: https://pkg.go.dev/github.com/theory/jsonpath Returns the underlying PathQuery object. ```APIDOC ## Path.Query ### Description Returns the underlying PathQuery object. ### Method func (p *Path) Query() *spec.PathQuery ### Response #### Success Response (*spec.PathQuery) - **spec.PathQuery** - The PathQuery object. ``` -------------------------------- ### String Representation of Index Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns a string representation of the Index. ```go func (i Index) String() string ``` -------------------------------- ### FuncExtension Methods Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Methods for interacting with a FuncExtension, including evaluating the function, retrieving its name and return type, and validating its arguments. ```APIDOC ## func (*FuncExtension) Evaluate ### Description Evaluate executes the FuncExtension against args and returns a result of type [ResultType]. ### Signature ```go func (f *FuncExtension) Evaluate(args []PathValue) PathValue ``` ## func (*FuncExtension) Name ### Description Name returns the name of the FuncExtension. ### Signature ```go func (f *FuncExtension) Name() string ``` ## func (*FuncExtension) ReturnType ### Description ReturnType returns the data type of the FuncExtension return value. ### Signature ```go func (f *FuncExtension) ReturnType() FuncType ``` ## func (*FuncExtension) Validate ### Description Validate executes at parse time to validate that all the args to the are compatible with the FuncExtension. ### Signature ```go func (f *FuncExtension) Validate(args []FuncExprArg) error ``` ``` -------------------------------- ### Index.String Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns a string representation of the Index. ```APIDOC ## func (Index) String ### Description String returns a string representation of i. ### Signature ```go func (i Index) String() string ``` ``` -------------------------------- ### Create a NormalizedPath Source: https://pkg.go.dev/github.com/theory/jsonpath/spec The Normalized function creates and returns a NormalizedPath containing the provided NormalSelector arguments. Use this to construct normalized paths programmatically. ```go func Normalized(sel ...NormalSelector) NormalizedPath ``` -------------------------------- ### SingularQuery Function Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Creates a SingularQueryExpr for selecting a single value at a specified path. ```go func SingularQuery(root bool, selectors ...Selector) *SingularQueryExpr ``` -------------------------------- ### Path.MarshalBinary Source: https://pkg.go.dev/github.com/theory/jsonpath Marshals the Path object into binary format. ```APIDOC ## Path.MarshalBinary ### Description Marshals the Path object into binary format. ### Method func (p *Path) MarshalBinary() ([]byte, error) ### Response #### Success Response ([]byte, error) - **[]byte** - The binary representation of the Path. - **error** - An error if marshaling fails. ``` -------------------------------- ### Create Comparison Expression Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Use Comparison to create a CompExpr that compares a literal value to a path expression. This is useful for building filter conditions. ```go type BasicExpr interface { // contains filtered or unexported methods } BasicExpr defines the basic interface for filter expressions. Implementations: * CompExpr * ExistExpr * FuncExpr * LogicalAnd * LogicalOr * NonExistExpr * NotFuncExpr * NotParenExpr * ParenExpr * ValueType ``` ```go type CompExpr struct { // contains filtered or unexported fields } CompExpr is a filter expression that compares two values, which themselves may themselves be the output of expressions. Interfaces implemented: * BasicExpr * fmt.Stringer Example : Create a comparison expression that compares a literal value to a path expression. Output: 42 == @["age"] ``` ```go func Comparison(left CompVal, op CompOp, right CompVal) *CompExpr ``` ```go func (ce *CompExpr) String() string ``` -------------------------------- ### MustParse JSONPath String (Package Function) Source: https://pkg.go.dev/github.com/theory/jsonpath Parses a JSONPath query string into a Path. Panics with an ErrPathParse on failure. ```go func MustParse(path string) *Path ``` -------------------------------- ### PathQuery Expression Method Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Expression returns a SingularQueryExpr variant if the PathQuery is singular, otherwise it returns the PathQuery itself. ```go func (q *PathQuery) Expression() FuncExprArg ``` -------------------------------- ### Wildcard Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Wildcard returns a singleton instance of WildcardSelector. ```APIDOC ## func Wildcard ### Description Wildcard returns a WildcardSelector singleton. ### Example ``` Output: * ``` ``` -------------------------------- ### LogicalOr.String Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns the string representation of the LogicalOr expression. ```APIDOC ## func (LogicalOr) String ### Description String returns the string representation of lo. ### Signature ```go func (lo LogicalOr) String() string ``` ``` -------------------------------- ### SliceSelector Bounds Method Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Calculates the lower and upper bounds for slice selection based on the input slice length. ```go func (s SliceSelector) Bounds(length int) (int, int) ``` -------------------------------- ### Path Struct Definition Source: https://pkg.go.dev/github.com/theory/jsonpath Represents a RFC 9535 JSONPath query. ```go type Path struct { // contains filtered or unexported fields } ``` -------------------------------- ### FuncExtension Creation Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Creates a new JSONPath function extension with a specified name, return type, validator, and evaluator. ```APIDOC ## func Extension ### Description Extension creates a new JSONPath function extension. Created by github.com/theory/jsonpath/registry.Registry.Register. ### Signature ```go func Extension(name string, returnType FuncType, validator Validator, evaluator Evaluator) *FuncExtension ``` ### Parameters - **name** (string) - The name of the function extension as used in JSONPath queries. - **returnType** (FuncType) - The data type of the function return value. - **validator** (Validator) - A validation function that will be called at parse time to validate that all the function args are compatible with the function. - **evaluator** (Evaluator) - The implementation of the function itself that executes against args and returns the result of the type defined by resultType. ``` -------------------------------- ### Select Element by Index Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Selects an element from a slice using an Index. Returns an empty slice if the input is not a slice or the index is out of bounds. ```go func (i Index) Select(input, _ any) []any ``` -------------------------------- ### LocatedNodeList.Clone Source: https://pkg.go.dev/github.com/theory/jsonpath Returns a shallow copy of the LocatedNodeList. ```APIDOC ## LocatedNodeList.Clone ### Description Returns a shallow copy of the LocatedNodeList. ### Method func (list LocatedNodeList) Clone() LocatedNodeList ### Response #### Success Response (LocatedNodeList) - **LocatedNodeList** - A shallow copy of the original LocatedNodeList. ``` -------------------------------- ### ValueType.String Source: https://pkg.go.dev/github.com/theory/jsonpath/spec String returns the string representation of the ValueType. ```APIDOC ## func (*ValueType) String ### Description String returns the string representation of vt. ``` -------------------------------- ### Parse and Select JSONPath Source: https://pkg.go.dev/github.com/theory/jsonpath Demonstrates selecting all authors from a bookstore object using a JSONPath expression. This is useful for extracting specific data from nested JSON structures. ```go package main import ( "fmt" "github.com/theory/jsonpath" ) func main() { var data = map[string]any{ "store": map[string]any{ "book": []map[string]any{ { "category": "reference", "author": "Nigel Rees", "title": "Sayings of the Century", "price": 8.95 }, { "category": "fiction", "author": "Evelyn Waugh", "title": "Sword of Honour", "price": 12.99 }, { "category": "fiction", "author": "Herman Melville", "title": "Moby Dick", "isbn": "0-553-21311-3", "price": 8.99 }, { "category": "fiction", "author": "J. R. R. Tolkien", "title": "The Lord of the Rings", "isbn": "0-395-19395-8", "price": 22.99 } }, "bicycle": map[string]any{ "color": "red", "price": 19.95 } } } path := jsonpath.MustParse("$") authors := path.Select(data) fmt.Println(authors) } ``` -------------------------------- ### Create a JSONPath Function Extension Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Creates a new JSONPath function extension. This function is used with the registry to define custom functions for JSONPath queries. ```go func Extension(name string, returnType FuncType, validator Validator, evaluator Evaluator) *FuncExtension ``` -------------------------------- ### Select a name with its path Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Selects a name from a string-keyed map input and returns it with its normalized path. Returns an empty slice if the input is not a map or does not contain the name. Defined by the Selector interface. ```go func (n Name) SelectLocated(input, _ any, parent NormalizedPath) []*LocatedNode ``` -------------------------------- ### FuncType String Method Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Provides a string representation for a FuncType value. ```APIDOC ## func (FuncType) String ### Description String returns a string representation of the FuncType. ### Signature ```go func (i FuncType) String() string ``` ``` -------------------------------- ### Segment Select Method Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Select retrieves values from the current or root context for each of the segment's selectors. This method is part of the Selector interface. ```go func (s *Segment) Select(current, root any) []any ``` -------------------------------- ### String Representation of FuncType Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns a string representation of a FuncType. Useful for debugging and understanding the type of function arguments or results. ```go func (i FuncType) String() string ``` -------------------------------- ### Parse JSONPath String (Package Function) Source: https://pkg.go.dev/github.com/theory/jsonpath Parses a JSONPath query string into a Path. Returns an ErrPathParse on failure. ```go func Parse(path string) (*Path, error) ``` -------------------------------- ### Path.Select Source: https://pkg.go.dev/github.com/theory/jsonpath Selects nodes from the input data using the JSONPath expression. Returns a NodeList of matching values. ```APIDOC ## Path.Select ### Description Selects nodes from the input data using the JSONPath expression. Returns a NodeList of matching values. ### Method func (p *Path) Select(input any) NodeList ### Parameters #### Path Parameters - **input** (any) - Required - The data to query (e.g., a map or slice). ### Response #### Success Response (NodeList) - **NodeList** - A list of values matching the JSONPath query. ``` -------------------------------- ### LogicalAnd Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Represents a logical AND operation between multiple expressions. ```APIDOC ## type LogicalAnd ### Description LogicalAnd represents a list of one or more expressions ANDed together by the && operator. Evaluates to true if all of its expressions evaluate to true. Short-circuits and returns false for the first expression that returns false. ### Interfaces * BasicExpr * fmt.Stringer ### Example Assemble a LogicalAnd consisting of multiple expressions. ``` 42 && @["answer"] ``` ``` -------------------------------- ### SliceSelector Step Method Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Retrieves the step value defined in the SliceSelector. ```go func (s SliceSelector) Step() int ``` -------------------------------- ### Marshal NormalizedPath to Text Source: https://pkg.go.dev/github.com/theory/jsonpath/spec The MarshalText method marshals a NormalizedPath into its text representation, implementing the encoding.TextMarshaler interface. This is useful for serialization. ```go func (np NormalizedPath) MarshalText() ([]byte, error) ``` -------------------------------- ### FuncExtension Struct Definition Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Represents a custom JSONPath function extension as defined in RFC 9535. Use the registry to register new extensions. ```go type FuncExtension struct { // contains filtered or unexported fields } ``` -------------------------------- ### Index Select Method Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Selects an element from a slice using the index. Returns an empty slice if the input is not a slice or the index is out of bounds. ```APIDOC ## func (Index) Select ### Description Select selects i from input and returns it as a single value in a slice. Returns an empty slice if input is not a slice or if i it outside the bounds of input. Defined by the Selector interface. ### Signature ```go func (i Index) Select(input, _ any) []any ``` ``` -------------------------------- ### Select a name from input Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Selects a name from a string-keyed map input. Returns an empty slice if the input is not a map or does not contain the name. Defined by the Selector interface. ```go func (n Name) Select(input, _ any) []any ``` -------------------------------- ### String Representation of LogicalOr Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns the string representation of a LogicalOr expression. ```go func (lo LogicalOr) String() string ``` -------------------------------- ### FuncExpr Methods Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Methods available on the FuncExpr type for checking type conversions and retrieving the result type and string representation. ```APIDOC ## func (*FuncExpr) ConvertsTo ### Description ConvertsTo returns true if fe's result can be converted to ft. ### Signature ```go func (fe *FuncExpr) ConvertsTo(ft FuncType) bool ``` ## func (*FuncExpr) ResultType ### Description ResultType returns the result type of fe's FuncExtension. Defined by the FuncExprArg interface. ### Signature ```go func (fe *FuncExpr) ResultType() FuncType ``` ## func (*FuncExpr) String ### Description String returns a string representation of fe. ### Signature ```go func (fe *FuncExpr) String() string ``` ``` -------------------------------- ### Convert PathValue to ValueType Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Use ValueFrom to convert a PathValue to a ValueType. It panics if conversion is not possible. It's recommended to use the accompanying Validator function to check convertibility first. ```go func ValueFrom(value PathValue) *ValueType ``` -------------------------------- ### Sort LocatedNodeList by Path Source: https://pkg.go.dev/github.com/theory/jsonpath Sorts a LocatedNodeList in place based on the spec.NormalizedPath of each node. ```go func (list LocatedNodeList) Sort() ``` -------------------------------- ### Check PathQuery Conversion Capability Source: https://pkg.go.dev/github.com/theory/jsonpath/spec The ConvertsTo method returns true if a PathQuery's result can be converted to the specified FuncType. Singular queries can convert to FuncValue or FuncNodes, while others only to FuncNodes. ```go func (q *PathQuery) ConvertsTo(ft FuncType) bool ``` -------------------------------- ### SelectLocated Method for Index Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Selects an element from a slice by index and returns it with its normalized path. Returns an empty slice if the input is not a slice or the index is out of bounds. ```go func (i Index) SelectLocated(input, _ any, parent NormalizedPath) []*LocatedNode ``` -------------------------------- ### Segment String Method Source: https://pkg.go.dev/github.com/theory/jsonpath/spec String returns a string representation of the Segment. Child segments format as '[]' and Descendant segments format as '..[]'. ```go func (s *Segment) String() string ``` -------------------------------- ### Iterate Over Nodes in LocatedNodeList Source: https://pkg.go.dev/github.com/theory/jsonpath Returns an iterator over all nodes in a LocatedNodeList. This provides the same data as Path.Select. ```go func (list LocatedNodeList) Nodes() iter.Seq[any] ``` -------------------------------- ### MustParse JSONPath String (Parser Method) Source: https://pkg.go.dev/github.com/theory/jsonpath Parses a JSONPath query string into a Path. Panics with an ErrPathParse on failure. ```go func (c *Parser) MustParse(path string) *Path ``` -------------------------------- ### Convert value to LogicalType Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Converts a value to LogicalType, panicking if conversion fails. Intended for use in custom registry evaluators. Use accompanying Validator functions to prevent panics. ```go func LogicalFrom(value any) LogicalType ``` -------------------------------- ### Validate FuncExtension Arguments Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Validates that the arguments provided to a FuncExtension are compatible at parse time. This ensures correct function usage. ```go func (f *FuncExtension) Validate(args []FuncExprArg) error ``` -------------------------------- ### LocatedNode Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Pairs a selected JSON node with its normalized path. ```APIDOC ## type LocatedNode ### Description LocatedNode pairs a value with the NormalizedPath for its location within the JSON query argument from which it was selected. Returned by implementations of Selector's SelectLocated method. ### Fields * **Node** (any): The value selected from a JSON query argument. * **Path** (NormalizedPath): The normalized path that uniquely identifies the location of Node in a JSON query argument. ### Example ```json [ { "node": "Nigel Rees", "path": "$['store']['book'][0]['author']" }, { "node": "Evelyn Waugh", "path": "$['store']['book'][1]['author']" }, { "node": "Herman Melville", "path": "$['store']['book'][2]['author']" }, { "node": "J. R. R. Tolkien", "path": "$['store']['book'][3]['author']" } ] ``` ``` -------------------------------- ### SliceSelector.Select Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Select selects and returns the values from input for the indexes specified by the SliceSelector. Returns an empty slice if input is not a slice. Indexes outside the bounds of input will not be included in the return value. ```APIDOC ## SliceSelector.Select ### Description Selects and returns the values from input for the indexes specified by s. Returns an empty slice if input is not a slice. Indexes outside the bounds of input will not be included in the return value. Defined by the Selector interface. ### Signature ```go func (s SliceSelector) Select(input, _ any) []any ``` ``` -------------------------------- ### Create NonExistExpr from PathQuery Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Creates a new NonExistExpr for a given PathQuery. This expression is used to check for the non-existence of a path. ```go func Nonexistence(q *PathQuery) *NonExistExpr ``` -------------------------------- ### Create NodesType from values Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Creates a NodesType containing the provided values. Values should be Go equivalents of JSON data types. ```go func Nodes(val ...any) NodesType ``` -------------------------------- ### Selector Interface Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Represents a single Selector in an RFC 9535 JSONPath query, defining how to select values. ```APIDOC ## type Selector ### Description Selector represents a single Selector in an RFC 9535 JSONPath query. ### Interface Methods - **Select(current, root any) []any**: Selects values from current and/or root and returns them. - **SelectLocated(current, root any, parent NormalizedPath) []*LocatedNode**: Selects values from current and/or root and returns them in [LocatedNode] values with their located normalized paths. ``` -------------------------------- ### Create a Negated Function Expression Source: https://pkg.go.dev/github.com/theory/jsonpath/spec The NotFunction creates and returns a new NotFuncExpr. This expression will execute the provided function expression and return the inverse of its result. ```go func NotFunction(fn *FuncExpr) NotFuncExpr ``` -------------------------------- ### LiteralArg.String Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns the JSON string representation of the LiteralArg. ```APIDOC ## func (*LiteralArg) String ### Description String returns the JSON string representation of la. ### Signature ```go func (la *LiteralArg) String() string ``` ``` -------------------------------- ### SliceSelector String Method Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Returns a quoted string representation of the SliceSelector. ```go func (s SliceSelector) String() string ``` -------------------------------- ### NodeList.All Source: https://pkg.go.dev/github.com/theory/jsonpath Returns an iterator over all the values in the NodeList. ```APIDOC ## NodeList.All ### Description Returns an iterator over all the values in the NodeList. ### Method func (list NodeList) All() iter.Seq[any] ### Response #### Success Response (iter.Seq[any]) - **iter.Seq[any]** - An iterator over the node values. ``` -------------------------------- ### Create LiteralArg Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Creates a new LiteralArg from a given literal value. The value must be a string, integer, float, json.Number, nil, true, or false. ```go func Literal(lit any) *LiteralArg ``` -------------------------------- ### Path.UnmarshalBinary Source: https://pkg.go.dev/github.com/theory/jsonpath Unmarshals binary data into a Path object. ```APIDOC ## Path.UnmarshalBinary ### Description Unmarshals binary data into a Path object. ### Method func (p *Path) UnmarshalBinary(data []byte) error ### Parameters #### Path Parameters - **data** ([]byte) - Required - The binary data to unmarshal. ### Response #### Success Response (error) - **error** - An error if unmarshaling fails. ``` -------------------------------- ### LogicalType Constants Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Defines constants for representing false and true logical types. ```go const ( // LogicalFalse represents a true [LogicalType]. LogicalFalse LogicalType = iota // false // LogicalTrue represents a true [LogicalType]. LogicalTrue // true ) ``` -------------------------------- ### Path.MarshalText Source: https://pkg.go.dev/github.com/theory/jsonpath Marshals the Path object into text format. ```APIDOC ## Path.MarshalText ### Description Marshals the Path object into text format. ### Method func (p *Path) MarshalText() ([]byte, error) ### Response #### Success Response ([]byte, error) - **[]byte** - The text representation of the Path. - **error** - An error if marshaling fails. ``` -------------------------------- ### Convert NormalizedPath to JSON Pointer Source: https://pkg.go.dev/github.com/theory/jsonpath/spec The Pointer method returns an RFC 6901 JSON Pointer string representation of the NormalizedPath. Use this for interoperability with systems expecting JSON Pointers. ```go func (np NormalizedPath) Pointer() string ``` -------------------------------- ### WildcardSelector.String Source: https://pkg.go.dev/github.com/theory/jsonpath/spec String returns the string representation of the WildcardSelector, which is '*'. ```APIDOC ## func (WildcardSelector) String ### Description String returns "*". ``` -------------------------------- ### LogicalType Methods Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Methods available on the LogicalType, providing boolean and function type information. ```APIDOC ## func (LogicalType) Bool ### Description Bool returns the boolean equivalent to lt. ### Signature ```go func (lt LogicalType) Bool() bool ``` ``` ```APIDOC ## func (LogicalType) FuncType ### Description FuncType returns FuncLogical. Defined by the PathValue interface. ### Signature ```go func (LogicalType) FuncType() FuncType ``` ``` -------------------------------- ### LogicalOr.ConvertsTo Source: https://pkg.go.dev/github.com/theory/jsonpath/spec Checks if the LogicalOr can be converted to a specific FuncType. ```APIDOC ## func (LogicalOr) ConvertsTo ### Description ConvertsTo returns true if the result of the LogicalOr can be converted to ft. ### Signature ```go func (LogicalOr) ConvertsTo(ft FuncType) bool ``` ```