csv

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Upload

func Upload(
	ctx context.Context, storage storage.Storage, key string,
	data CSVMarshaler, opts ...Option,
) (string, error)

func Write

func Write(out io.Writer, data CSVMarshaler, opts ...Option) (err error)

Write writes a single CSVMarshaler object to the provided io.Writer. It supports multiple rows and optional header from the object.

Types

type CSVMarshaler

type CSVMarshaler interface {
	// MarshalCSV returns header (optional) and multiple rows.
	// If headers is nil, library will not auto-generate header.
	MarshalCSV() (headers []string, rows [][]string, err error)
}

type Config

type Config struct {
	Delimiter rune // field delimiter, default ','
	UseBOM    bool // write UTF-8 BOM at start
	UseCRLF   bool // use CRLF line endings
}

Options configures the Writer behavior.

type Option

type Option func(*Config)

func WithBom

func WithBom(enable bool) Option

func WithCRLF

func WithCRLF(enable bool) Option

func WithDelimiter

func WithDelimiter(delimiter rune) Option

type Writer

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

Writer is the main CSV generator.

Jump to

Keyboard shortcuts

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