csv

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package csv wraps encoding/csv as a codec.Codec implementation. The CSV format serialises a matrix of strings; the codec accepts [][]string for Marshal and writes into *[][]string on Unmarshal.

Index

Constants

This section is empty.

Variables

View Source
var (
	//: Codec is the CSV singleton, registered with core/data/codec at package
	//: load. Binding the registration result to a named var is more
	//: idiomatic than `var _ = codec.Register(...)` and keeps us clear of
	//: init(). The singleton has escapeFormulas=false for wire-format
	//: fidelity — consumers whose output is read by a spreadsheet
	//: application should use NewWithEscape(true) instead.
	Codec codec.Codec = codec.Register(&csvCodec{})
)

Package-level vars: the Marshal-buffer pool plus the singleton registered with core/data/codec at package load.

Functions

func New

func New() codec.Codec

New returns the CSV singleton with escapeFormulas disabled. This preserves the v1 API and keeps the wire-format lossless for pipe-to-pipe use.

func NewWithEscape

func NewWithEscape(escape bool) codec.Codec

NewWithEscape returns a fresh CSV codec with the formula-injection mitigation toggled on or off. Use this constructor when the encoded output will be opened in a spreadsheet app (Excel, LibreOffice, Google Sheets): without the mitigation an attacker-influenced cell starting with "=" evaluates as a formula at open time, which is OWASP CSV Injection (CWE-1236). The returned codec is not registered with the core/data/codec singleton registry.

Types

This section is empty.

Jump to

Keyboard shortcuts

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