csv

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2026 License: MIT Imports: 11 Imported by: ? modules, 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 csv contains the csv node implementation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSVConfig

type CSVConfig struct {
	// Property is the message field to convert; "payload" (default)
	// targets msg.Payload, otherwise a dotted path inside the data map
	Property string `json:"property"`
	// Headers treats the first row as a header line: parsed rows become
	// objects keyed by the header names; serializing objects writes a
	// header row derived from the first object's keys
	Headers bool `json:"headers"`
	// HdrIn is Node-RED's header flag (serialized "hdrin"); same effect
	// as Headers
	HdrIn bool `json:"hdrin"`
	// HdrOut controls header emission when serializing (serialized
	// "hdrout"): "none" (default) never emits a header row, "all" emits
	// one on every output, "once" emits one until a message carrying a
	// reset property arrives
	HdrOut string `json:"hdrout"`
	// Temp is the column-name template (serialized "temp"): a
	// separator-delimited list of column names used to key parsed rows
	// and to select/order columns when serializing objects
	Temp string `json:"temp"`
	// Multi is Node-RED's output mode (serialized "multi"): "one"
	// emits one message per row as a parts sequence; "mult" produces a
	// single message whose payload is the whole parsed table. Unset
	// keeps the nodebase expansion behavior (one message per row).
	Multi string `json:"multi"`
	// Sep is the column separator (serialized "sep"); default ","
	Sep string `json:"sep"`
	// Ret is the row terminator hint (serialized "ret", e.g. "\n");
	// informational only — the parser accepts both endings
	Ret string `json:"ret"`
	// Skip skips this many leading lines before parsing (serialized "skip")
	Skip int `json:"skip"`
	// Strings is Node-RED's "strings" flag: true (and unset) coerces
	// numeric-looking cells to numbers via parseFloat
	Strings *bool `json:"strings"`
}

CSVConfig holds configuration for the csv node — a simplified Node-RED CSV parser equivalent.

type CSVNode

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

CSVNode converts between a CSV string and row data. A string input is parsed and expanded into one message per row (parts metadata, like the split node); an array input is serialized into a CSV string.

func NewCSVNode

func NewCSVNode(node nodestore.NodeInterface, config *CSVConfig, host nodebase.NodeHost) *CSVNode

NewCSVNode creates a new csv node

func (*CSVNode) Execute

Execute converts the configured property. Strings are parsed and the rows stashed for Expand; slices are serialized to a CSV string and written back to the property.

func (*CSVNode) Expand

Expand emits one message per parsed row. Each row is an object keyed by the resolved column names — the header row, the configured template, message-provided columns, or generated col1..colN. Every message carries parts metadata (id, type "csv", index, count) so a downstream join node can reassemble the table.

Jump to

Keyboard shortcuts

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