rawfmt

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: 8 Imported by: 0

Documentation

Overview

Package rawfmt defines encoding and decoding of the raw format.

Raw is similar to CSV, but uses \t for the default delimiter and offers no means of quoting values that contain the delimiter.

Unlike CSV, it defaults to not having a header.

It is primarily useful as it is the default format for many command line utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Decoder

type Decoder struct {
	Tab     rune
	UseCRLF bool //True to use \r\n as the line terminator, otherwise \n.
	Null    null.Encoding

	Strict   bool //When true reports an error if there are more or less fields than required
	NoHeader bool //True if there is no header in the input
	// contains filtered or unexported fields
}

Decoder decodes the raw format

func (*Decoder) Close

func (d *Decoder) Close() error

Close the decoder

func (*Decoder) Init

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

func (*Decoder) Name

func (*Decoder) Name() string

func (*Decoder) ReadHeader

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

ReadHeader decodes the header

func (*Decoder) ReadRow

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

ReadRow reads an individual row

func (*Decoder) Reset

func (d *Decoder) Reset() error

Reset the decoder for reuse

func (*Decoder) Skip

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

Skip rows.

type Encoder

type Encoder struct {
	Tab     rune //If undefined, defaults to \t
	UseCRLF bool //True to use \r\n as the line terminator, otherwise \n.
	Null    null.Encoding

	NoHeader bool //If true, do not write header to output
	// contains filtered or unexported fields
}

Encoder encodes the raw format

func (*Encoder) Close

func (e *Encoder) Close() error

Close the encoder.

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 the encoder for reuse.

func (*Encoder) WriteHeader

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

WriteHeader encodes the header.

func (*Encoder) WriteRow

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

WriteRow encodes a row

Jump to

Keyboard shortcuts

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