csvfmt

package
v0.0.0-...-d0f7b5f Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	Null             null.Encoding
	Comma, Comment   rune
	Quote            rune //unused
	TrimLeadingSpace bool //unused
	UseCRLF          bool //unused

	Strict   bool
	NoHeader bool
	// contains filtered or unexported fields
}

Decoder is a CSV decoder.

func (*Decoder) Close

func (d *Decoder) Close() error

Close is a no-op.

func (*Decoder) Init

func (d *Decoder) Init(in device.Reader) error

func (*Decoder) Name

func (*Decoder) Name() string

func (*Decoder) ReadHeader

func (d *Decoder) ReadHeader(_ string, possibleHeader []string) ([]string, error)

ReadHeader configures the decoder and returns the first row of the CSV.

func (*Decoder) ReadRow

func (d *Decoder) ReadRow() ([]*string, error)

ReadRow reads a row from the CSV and handles NULL decoding.

func (*Decoder) Reset

func (d *Decoder) Reset() error

Reset decouples the CSV reader and zeroes internal scratch space.

func (*Decoder) Skip

func (d *Decoder) Skip(rows int) error

Skip rows.

type Encoder

type Encoder struct {
	Null    null.Encoding
	Comma   rune
	Quote   rune //unused
	UseCRLF bool

	NoHeader bool
	// contains filtered or unexported fields
}

Encoder is a CSV encoder.

func (*Encoder) Close

func (e *Encoder) Close() error

Close is a no-op.

func (*Encoder) Init

func (e *Encoder) Init(w device.Writer) error

func (*Encoder) Name

func (*Encoder) Name() string

func (*Encoder) Reset

func (e *Encoder) Reset() error

Reset flushes and decouples the CSV writer.

func (*Encoder) WriteHeader

func (e *Encoder) WriteHeader(_ string, hdr []string) error

WriteHeader writes the header as the first row of the CSV.

func (*Encoder) WriteRow

func (e *Encoder) WriteRow(row []*string) error

WriteRow writes a row to the CSV, handling all NULL encodings.

Jump to

Keyboard shortcuts

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