csvmap

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2018 License: GPL-3.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Reader

type Reader struct {
	Reader  *csv.Reader
	Columns []string
}

A Reader reads records from a CSV-encoded file.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader returns a new Reader that reads from r.

func (*Reader) Read

func (r *Reader) Read() (record map[string]string, err error)

Read wraps csv.Reader.Read, creating a map of column name to field value. If the line has fewer columns than Reader.Columns, the map will not contain keys for these columns; thus we can distinguish between missing columns and columns with empty values. If the line has more columns than Reader.Columns, Reader.Read() ignores them.

func (*Reader) ReadAll

func (r *Reader) ReadAll() (records []map[string]string, err error)

ReadAll reads all the remaining records from r. Each record is a map of column name to field value.

func (*Reader) ReadHeader

func (r *Reader) ReadHeader() (columns []string, err error)

ReadHeader simply wraps csv.Reader.Read().

Jump to

Keyboard shortcuts

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