csvnode

package
v0.0.0-...-0c19b3a Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package csvnode provides the CSV node implementation (Node-RED type ID "csv" - named csvnode here to avoid shadowing the imported encoding/csv package within this file).

CSV converts msg.payload bidirectionally based on its current type: a string is parsed into an array of rows, an array is serialized into a CSV string.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node struct {
	// HasHeaderRow, when parsing, treats the first row as field names and
	// produces an array of objects instead of an array of arrays; when
	// serializing, writes Columns (or an object's keys) as a header row.
	HasHeaderRow bool
	// Columns, if set, is used as parse headers (instead of the first row)
	// or as the explicit column order when serializing. If unset when
	// serializing objects, keys are taken from the first row and sorted for
	// determinism (map iteration order is not stable).
	Columns []string
	// Delimiter is a single character, default ",".
	Delimiter string
}

Node holds a CSV node's configuration.

func (*Node) Execute

func (n *Node) Execute(ctx interface{}, input map[string]interface{}) (map[string]interface{}, error)

Execute parses input["payload"] if it's a string, or serializes it to a CSV string if it's an array.

func (*Node) GetConfig

func (n *Node) GetConfig() map[string]interface{}

func (*Node) SetConfig

func (n *Node) SetConfig(config map[string]interface{}) error

func (*Node) Validate

func (n *Node) Validate() error

Jump to

Keyboard shortcuts

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