Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrMissingPreviousNode = errors.New("missing previous node")
ErrMissingPreviousNode is returned when findValue doesn't have access to the previous node.
Functions ¶
This section is empty.
Types ¶
type EqualCondition ¶
type EqualCondition struct {
// Key is the key of the value to check against.
Key string
// Value is the value we are looking for.
Value string
}
EqualCondition lets you check for an exact match.
func (EqualCondition) Check ¶
func (c EqualCondition) Check(other interface{}) (bool, error)
Check checks to see if other contains the required key value pair.
type InvalidIndexErr ¶
type InvalidIndexErr struct {
Index string
}
InvalidIndexErr is returned when a selector targets an index that does not exist.
func (InvalidIndexErr) Error ¶
func (e InvalidIndexErr) Error() string
Error returns the error message.
type Node ¶
type Node struct {
// Previous is the previous node in the chain.
Previous *Node `json:"-"`
// Next is the next node in the chain.
Next *Node `json:"next,omitempty"`
// Value is the value of the current node.
Value interface{} `json:"value"`
// Selector is the selector for the current node.
Selector Selector `json:"selector"`
}
Node represents a single node in the chain of nodes for a selector.
func (*Node) Initialise ¶ added in v0.0.2
Initialise sets up the node to ensure it has a value.
func (*Node) Put ¶
Put finds the node using the given selector and updates it's value. It then attempts to propagate the value back up the chain to the root element.
type Selector ¶
type Selector struct {
// Raw is the full selector.
Raw string `json:"raw"`
// Current is the selector to be used with the current node.
Current string `json:"current"`
// Remaining is the remaining parts of the Raw selector.
Remaining string `json:"remaining"`
// Type is the type of the selector.
Type string `json:"type"`
// Property is the name of the property this selector targets, if applicable.
Property string `json:"property,omitempty"`
// Index is the index to use if applicable.
Index int64 `json:"index,omitempty"`
// Conditions contains a set of conditions to optionally match a target.
Conditions []Condition `json:"conditions,omitempty"`
}
Selector represents the selector for a node.
func ParseSelector ¶
ParseSelector parses the given selector string and returns a Selector.
type UnexpectedPreviousNilValue ¶
type UnexpectedPreviousNilValue struct {
Selector string
}
UnexpectedPreviousNilValue is returned when the previous node contains a nil value.
func (UnexpectedPreviousNilValue) Error ¶
func (e UnexpectedPreviousNilValue) Error() string
Error returns the error message.
type UnknownComparisonOperatorErr ¶
type UnknownComparisonOperatorErr struct {
Operator string
}
UnknownComparisonOperatorErr is returned when
func (UnknownComparisonOperatorErr) Error ¶
func (e UnknownComparisonOperatorErr) Error() string
Error returns the error message.
type UnsupportedSelector ¶
type UnsupportedSelector struct {
Selector string
}
UnsupportedSelector is returned when a specific selector type is used in the wrong context.
func (UnsupportedSelector) Error ¶
func (e UnsupportedSelector) Error() string
Error returns the error message.
type UnsupportedTypeForSelector ¶
type UnsupportedTypeForSelector struct {
Selector Selector
Value interface{}
}
UnsupportedTypeForSelector is returned when a selector attempts to handle a data type it can't handle.
func (UnsupportedTypeForSelector) Error ¶
func (e UnsupportedTypeForSelector) Error() string
Error returns the error message.
type ValueNotFound ¶
ValueNotFound is returned when a selector string cannot be fully resolved.