Documentation
¶
Overview ¶
Package change contains the change node implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChangeConfig ¶
type ChangeConfig struct {
Rules []ChangeRule `json:"rules"`
}
ChangeConfig holds configuration for the change node
type ChangeNode ¶
ChangeNode mutates msg.Payload via an ordered list of rules, the equivalent of Node-RED's change node. A failing rule is skipped so one bad rule does not abort the flow.
func NewChangeNode ¶
func NewChangeNode(node nodestore.NodeInterface, config *ChangeConfig) *ChangeNode
NewChangeNode creates a new change node
func (*ChangeNode) Execute ¶
func (n *ChangeNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute applies each configured rule in order and returns the mutated payload
type ChangeRule ¶
type ChangeRule struct {
Op string `json:"op"` // set | delete | move
Field string `json:"field"`
Value string `json:"value"`
}
ChangeRule is a single ordered mutation applied to the message. Field is a dotted path; "payload" (or empty) targets msg.Payload, a "msg." prefix (e.g. "msg.statusCode") targets msg-level properties stored in Metadata — Node-RED's msg.statusCode/msg.headers equivalent — and anything else is a path inside msg.Payload.