Documentation ¶
Index ¶
Constants ¶
const ( NodeList = "list" NodeDefer = "defer" NodeError = "error" NodeRecover = "recover" NodeParallel = "parallel" NodeRun = "run" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DeferNode ¶
type DeferNode struct { NodeType `json:"type"` Body Node `json:"body"` // evaluate node Defer Node `json:"defer"` // defer evaluation of node. }
DeferNode executes the child node, and then executes the deffered node. The deffered node is guaranteed to execute, even when the child node fails.
type ErrorNode ¶
type ErrorNode struct { NodeType `json:"type"` Body Node `json:"body"` // evaluate node Defer Node `json:"defer"` // defer evaluation of node on error. }
ErrorNode executes the body node, and then executes the error node if the body node errors. This is similar to defer but only executes on error.
type ListNode ¶
type ListNode struct { NodeType `json:"type"` // Body is the list of child nodes Body []Node `json:"body"` }
ListNode serially executes a list of child nodes.
type NodeType ¶
type NodeType string
NodeType identifies the type of a parse tree node.
type ParallelNode ¶
type ParallelNode struct { NodeType `json:"type"` Body []Node `json:"body"` // nodes for parallel evaluation. Limit int `json:"limit"` // limit for parallel evaluation. }
ParallelNode executes a list of child nodes in parallel.
func NewParallelNode ¶
func NewParallelNode() *ParallelNode
func (*ParallelNode) Append ¶
func (n *ParallelNode) Append(node Node) *ParallelNode
func (*ParallelNode) SetLimit ¶
func (n *ParallelNode) SetLimit(limit int) *ParallelNode
func (*ParallelNode) Validate ¶
func (n *ParallelNode) Validate() error
type RecoverNode ¶
type RecoverNode struct { NodeType `json:"type"` Body Node `json:"body"` // evaluate node and catch all errors. }
func NewRecoverNode ¶
func NewRecoverNode() *RecoverNode
func (*RecoverNode) SetBody ¶
func (n *RecoverNode) SetBody(node Node) *RecoverNode
func (*RecoverNode) Validate ¶
func (n *RecoverNode) Validate() error
type RunNode ¶
type RunNode struct { NodeType `json:"type"` Name string `json:"name"` Detach bool `json:"detach,omitempty"` Silent bool `json:"silent,omitempty"` }
func NewRunNode ¶
func NewRunNode() *RunNode
type Tree ¶
type Tree struct {
*ListNode // top-level Tree node
}
Tree is the intermediate representation of a pipeline.
func (*Tree) MarshalJSON ¶
MarshalJSON implements the Marshaler interface and returns a JSON encoded representation of the Tree.
func (*Tree) UnmarshalJSON ¶
UnmarshalJSON implements the Unmarshaler interface and returns a Tree from a JSON representation.