{"modulePath":"github.com/Coding/drone","version":"v0.4.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package parse\n\n## Constants\n\n```go\nconst (\n\tNodeList     = \"list\"\n\tNodeDefer    = \"defer\"\n\tNodeError    = \"error\"\n\tNodeRecover  = \"recover\"\n\tNodeParallel = \"parallel\"\n\tNodeRun      = \"run\"\n)\n```\n\n## Types\n\n```go\ntype DeferNode struct {\n\tNodeType `json:\"type\"`\n\n\tBody  Node `json:\"body\"`  // evaluate node\n\tDefer Node `json:\"defer\"` // defer evaluation of node.\n}\n```\nDeferNode executes the child node, and then executes the deffered node. The deffered node is guaranteed to execute, even when the child node fails.\n\n```go\nfunc NewDeferNode() *DeferNode\n```\nNewDeferNode returns a new DeferNode.\n\n```go\nfunc (n *DeferNode) SetBody(node Node) *DeferNode\n```\n\n```go\nfunc (n *DeferNode) SetDefer(node Node) *DeferNode\n```\n\n```go\nfunc (n *DeferNode) Validate() error\n```\n\n```go\ntype ErrorNode struct {\n\tNodeType `json:\"type\"`\n\n\tBody  Node `json:\"body\"`  // evaluate node\n\tDefer Node `json:\"defer\"` // defer evaluation of node on error.\n}\n```\nErrorNode 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.\n\n```go\nfunc NewErrorNode() *ErrorNode\n```\nNewErrorNode returns a new ErrorNode.\n\n```go\nfunc (n *ErrorNode) SetBody(node Node) *ErrorNode\n```\n\n```go\nfunc (n *ErrorNode) SetDefer(node Node) *ErrorNode\n```\n\n```go\nfunc (n *ErrorNode) Validate() error\n```\n\n```go\ntype ListNode struct {\n\tNodeType `json:\"type\"`\n\n\t// Body is the list of child nodes\n\tBody []Node `json:\"body\"`\n}\n```\nListNode serially executes a list of child nodes.\n\n```go\nfunc NewListNode() *ListNode\n```\nNewListNode returns a new ListNode.\n\n```go\nfunc (n *ListNode) Append(node Node) *ListNode\n```\nAppend appens a child node to the list.\n\n```go\nfunc (n *ListNode) Validate() error\n```\n\n```go\ntype Node interface {\n\tType() NodeType\n\tValidate() error\n}\n```\nA Node is an element in the parse tree.\n\n```go\ntype NodeType string\n```\nNodeType identifies the type of a parse tree node.\n\n```go\nfunc (t NodeType) String() string\n```\nString returns the string value of the Node type.\n\n```go\nfunc (t NodeType) Type() NodeType\n```\nType returns itself and provides an easy default implementation for embedding in a Node. Embedded in all non-trivial Nodes.\n\n```go\ntype ParallelNode struct {\n\tNodeType `json:\"type\"`\n\n\tBody  []Node `json:\"body\"`  // nodes for parallel evaluation.\n\tLimit int    `json:\"limit\"` // limit for parallel evaluation.\n}\n```\nParallelNode executes a list of child nodes in parallel.\n\n```go\nfunc NewParallelNode() *ParallelNode\n```\n\n```go\nfunc (n *ParallelNode) Append(node Node) *ParallelNode\n```\n\n```go\nfunc (n *ParallelNode) SetLimit(limit int) *ParallelNode\n```\n\n```go\nfunc (n *ParallelNode) Validate() error\n```\n\n```go\ntype RecoverNode struct {\n\tNodeType `json:\"type\"`\n\n\tBody Node `json:\"body\"` // evaluate node and catch all errors.\n}\n```\n\n```go\nfunc NewRecoverNode() *RecoverNode\n```\n\n```go\nfunc (n *RecoverNode) SetBody(node Node) *RecoverNode\n```\n\n```go\nfunc (n *RecoverNode) Validate() error\n```\n\n```go\ntype RunNode struct {\n\tNodeType `json:\"type\"`\n\n\tName   string `json:\"name\"`\n\tDetach bool   `json:\"detach,omitempty\"`\n\tSilent bool   `json:\"silent,omitempty\"`\n}\n```\n\n```go\nfunc NewRunNode() *RunNode\n```\n\n```go\nfunc (n *RunNode) SetDetach(detach bool) *RunNode\n```\n\n```go\nfunc (n *RunNode) SetName(name string) *RunNode\n```\n\n```go\nfunc (n *RunNode) SetSilent(silent bool) *RunNode\n```\n\n```go\nfunc (n *RunNode) Validate() error\n```\n\n```go\ntype Tree struct {\n\t*ListNode // top-level Tree node\n}\n```\nTree is the intermediate representation of a pipeline.\n\n```go\nfunc NewTree() *Tree\n```\nNew allocates a new Tree.\n\n```go\nfunc Parse(data []byte) (*Tree, error)\n```\nParse parses a JSON encoded Tree.\n\n```go\nfunc (t *Tree) MarshalJSON() ([]byte, error)\n```\nMarshalJSON implements the Marshaler interface and returns a JSON encoded representation of the Tree.\n\n```go\nfunc (t *Tree) UnmarshalJSON(data []byte) error\n```\nUnmarshalJSON implements the Unmarshaler interface and returns a Tree from a JSON representation.\n\n","path":"github.com/Coding/drone/engine/runner/parse","name":"parse","synopsis":"","isRedistributable":true}
