sort

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 8 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

type SortNode struct {
	*nodebase.BaseNode
	// contains filtered or unexported fields
}

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

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.

func (*SortNode) Validate

func (n *SortNode) Validate() error

Validate rejects unsupported target/order combinations

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL