csv

package
v1.0.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package csv parses CSV files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CSV

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

CSV is the CSV file.

func New

func New(ctx context.Context, raw []byte, config Config) (*CSV, error)

New parses the byte slice and creates a new CSV object.

func (*CSV) MarshalJSON

func (csv *CSV) MarshalJSON() ([]byte, error)

MarshalJSON marshals the read CSV values into JSON.

func (*CSV) MarshalYAML

func (csv *CSV) MarshalYAML() ([]byte, error)

MarshalYAML marshals the read CSV values into YAML.

func (*CSV) Values

func (csv *CSV) Values() [](map[string]string)

Values returns the map of key:value pairs from the parsed CSV.

type Config

type Config struct {
	AllowMalformed bool   `name:"allow-malformed" description:"allow parsing malformed CSV"`
	FillEmptyWith  string `name:"fill-empty-with" description:"value to fill empty cells with. --allow-malformed must be set for this to be effective"`
	ReplaceWith    string `name:"replace-with" description:"simple text find and replace. Usage --replace-with <search>,<replacement>"`
}

Config are the configuration options for the CSV decoder.

Jump to

Keyboard shortcuts

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