Documentation
¶
Overview ¶
Package yaml contains the yaml node implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type YAMLConfig ¶
type YAMLConfig struct {
// Action selects the conversion: "" (auto: stringify objects, parse
// strings) | "str" (always stringify) | "obj" (always parse)
Action string `json:"action"`
// Property is the message field to convert; "payload" (default)
// targets msg.Payload, otherwise a dotted path inside the data map
Property string `json:"property"`
// Outputs is the node port count; 2 adds a second port that receives
// messages whose YAML failed to parse (error info in Metadata.error)
Outputs int `json:"outputs"`
}
YAMLConfig holds configuration for the yaml node — same shape as the json node (yaml.v3 is already vendored).
type YAMLNode ¶
YAMLNode converts payload data between YAML string and object form.
func NewYAMLNode ¶
func NewYAMLNode(node nodestore.NodeInterface, config *YAMLConfig) *YAMLNode
NewYAMLNode creates a new yaml node
func (*YAMLNode) Execute ¶
func (n *YAMLNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute reads the configured property, converts it and writes the result back. A parse failure either routes to output_2 (when the node has two outputs) or aborts the branch with an error status.
func (*YAMLNode) SelectPorts ¶
func (n *YAMLNode) SelectPorts(input, output nodestore.MessageInterface) []string
SelectPorts routes the message to output_2 when the last Execute hit a parse error, otherwise to output_1.