Documentation ¶
Index ¶
- Constants
- Variables
- func IsConditional(meta *node.Node) bool
- func IsTrue(meta *node.Node) (bool, error)
- func PeerBranches(g *graph.Graph, meta *node.Node) (out []*node.Node)
- func PeerNodes(g *graph.Graph, meta *node.Node) (out []*node.Node)
- func RenderPredicate(meta *node.Node, renderFunc func(string, string) (string, error)) (string, error)
- func ShouldEvaluate(g *graph.Graph, meta *node.Node) (bool, error)
- type NodeCategory
Constants ¶
View Source
const ( // MetaSwitchName is the metadata key for accessing the name of the switch // that contains this branch. MetaSwitchName = "conditional-switch-name" // MetaBranchName defines the name for the branch MetaBranchName = "conditional-name" // MetaUnrenderedPredicate contains the predicate string before being rendered MetaUnrenderedPredicate = "conditional-predicate-raw" // MetaRenderedPredicate contains the predicate string after rendering MetaRenderedPredicate = "conditional-predicate-rendered" // MetaConditionalName contains the name of the branch containing the node MetaConditionalName = "conditional-name" // MetaPeers contains the the current branch and all it's peers in order MetaPeers = "conditional-peers" // MetaPredicate contains the cached result of rendered predicate evaluation MetaPredicate = "conditional-predicate-results" // MetaType contains the type of the underlying node MetaType = "conditional-resource-type" )
View Source
const ( // NodeCatResource represents a NodeCat that is a node inside of a branch NodeCatResource = "resource" // NodeCatBranch represents a NodeCat that is a branch (case statement) NodeCatBranch = "branch" // NodeCatSwitch represents a conditional container type (switch statement) NodeCatSwitch = "switch" )
Variables ¶
View Source
var ( // ErrUnrendered is returned when attempting to evaluate truthiness of an // unrendered predicate. ErrUnrendered = errors.New("cannot evaluate an unrendered predicate") )
Functions ¶
func IsConditional ¶
IsConditional returns true if the graph is conditional
func PeerBranches ¶
PeerBranches returns the branches nodes that are peers to the current node.
func PeerNodes ¶
PeerNodes returns a list of graph nodes that are part of the same switch statement and branch as the current node.
func RenderPredicate ¶
func RenderPredicate(meta *node.Node, renderFunc func(string, string) (string, error)) (string, error)
RenderPredicate will attempt to render the predicate if it's not rendered, and return it. It takes a renderFunc in order to prevent circular imports when being used by render.
Types ¶
Click to show internal directories.
Click to hide internal directories.