Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( MapTypeError = errors.New("Expected Type to be a Map.") ArrayTypeError = errors.New("Expected Type to be an Array.") SyntaxError = errors.New("Bad Syntax.") NotSupportedError = errors.New("Not Supported") NotFound = errors.New("Not Found") IndexOutOfBounds = errors.New("Out of Bounds") )
Functions ¶
This section is empty.
Types ¶
type Applicator ¶
type Applicator interface {
Apply(v interface{}) (interface{}, error)
}
func Parse ¶
func Parse(s string) (Applicator, error)
Parse parses the JSONPath and returns a object that can be applied to a structure to filter it down.
type ArraySelection ¶
ArrySelection is a the basic filter for a Array type key. It is like MapSelection but for Arrays.
func (*ArraySelection) Apply ¶
func (a *ArraySelection) Apply(v interface{}) (interface{}, error)
type DescentSelection ¶
type DescentSelection struct {
RootNode
}
DescentSelection is a filter that recursively descends applying it's NextNode and corrlating the results.
func (*DescentSelection) Apply ¶
func (d *DescentSelection) Apply(v interface{}) (interface{}, error)
type MapSelection ¶
MapSelection is a the basic filter for a Map type key. It will look at the in coming v and try to turn it into a map[string]interface{} value. If it successeeds it will then apply the NextNode to that interface value, or it will return the value if it has no NextNode.
func (*MapSelection) Apply ¶
func (m *MapSelection) Apply(v interface{}) (interface{}, error)
type RootNode ¶
type RootNode struct {
// The next Node in the sequence.
NextNode node
}
RootNode is always the top node. It does not really do anything other then delegate to the next node, and acts as a starting point. Every other node type embeds this node To get the NextNode functions.
type WildCardFilterSelection ¶
func (*WildCardFilterSelection) Apply ¶
func (w *WildCardFilterSelection) Apply(v interface{}) (interface{}, error)
func (*WildCardFilterSelection) GetConditionsFromKey ¶
func (w *WildCardFilterSelection) GetConditionsFromKey() ([]string, error)
type WildCardKeySelection ¶
type WildCardKeySelection struct {
RootNode
}
func (*WildCardKeySelection) Apply ¶
func (w *WildCardKeySelection) Apply(v interface{}) (interface{}, error)
type WildCardSelection ¶
type WildCardSelection struct {
RootNode
}
WildCardSelection is a filter that grabs all the values and returns an Array of them It applies it's NextNode on each value.
func (*WildCardSelection) Apply ¶
func (w *WildCardSelection) Apply(v interface{}) (interface{}, error)