Documentation
¶
Overview ¶
Package sort contains the sort node implementation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SortConfig ¶
type SortConfig struct {
// Order is "asc" (default) or "desc"
Order string `json:"order"`
// AsNum coerces compared values to numbers first
AsNum bool `json:"asNum"`
// Target is "msg" (sort the payload array in place, default) or
// "seq" (sort a whole message sequence by SeqKey)
Target string `json:"target"`
// SeqKey is the dotted path into each message's Data used as the
// sequence sort key; "payload"/empty compares the Data itself
SeqKey string `json:"seqKey"`
}
SortConfig holds configuration for the sort node — the Node-RED sort equivalent.
type SortNode ¶
SortNode sorts either a payload array in place ("msg" target) or a buffered parts sequence re-emitted in order ("seq" target).
func NewSortNode ¶
func NewSortNode(node nodestore.NodeInterface, config *SortConfig, host nodebase.NodeHost) *SortNode
NewSortNode creates a new sort node
func (*SortNode) Execute ¶
func (n *SortNode) Execute(ctx context.Context, input nodestore.MessageInterface) (nodestore.MessageInterface, error)
Execute sorts a payload array in place (msg target) or buffers a parts sequence until complete (seq target), re-emitting the sorted messages asynchronously in order and dropping the current one.