csv

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2026 License: MPL-2.0 Imports: 5 Imported by: 0 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 provides a builder for csv data

Index

Constants

View Source
const (
	DefaultFieldSeparator  = ","
	DefaultRecordSeparator = "\n"
	FieldSeparatorFlag     = "field-separator"
	RecordSeparatorFlag    = "record-separator"
)

Variables

This section is empty.

Functions

func Marshal

func Marshal(input interface{}, fieldSeparator, recordSeparator string) ([]byte, error)

Marshal marshals the object into JSON then converts JSON to CSV then returns the CSV.

Types

type Node

type Node struct {
	// contains filtered or unexported fields
}

func NewCSVNode

func NewCSVNode(
	root *Node,
	parent *Node,
	headLocal string,
	headFull string,
	tail interface{},
) Node

NewCSVNode returns instance of preconfigured CSV Node. It contains the information needed to generate a header for data in corresponding CSV field.

func NewCSVRoot

func NewCSVRoot(
	tail interface{},
) Node

NewCSVRoot returns instance of preconfigured CSV Node. The returned node is a root of the graph.

func (*Node) ExpandTail

func (node *Node) ExpandTail() error

ExpandTail retrieves the values of all tails in the graph and creates the whole graph structure.

func (*Node) GetHeaders

func (node *Node) GetHeaders() ([]string, error)

GetHeaders returns an array of headers of all child nodes.

func (*Node) GetLeaves

func (node *Node) GetLeaves() []*Node

GetLeaves returns all leaves from the sub-tree starting from the specific node.

Jump to

Keyboard shortcuts

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