csv

package module
v0.0.0-...-b0d1d9b Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2015 License: MIT Imports: 8 Imported by: 0

README

csv GoDoc

Installation

go get github.ch/zbindenren.csv

Usage

See example.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoStruct           = errors.New("interface is not a struct")
	ErrNoValidRecords     = errors.New("no valid records found")
	ErrHeaderNotComplete  = errors.New("header not complete")
	ErrUnsupportedCSVType = errors.New("unsupported csv type")
)

Functions

This section is empty.

Types

type Marshaler

type Marshaler struct {
	Reader *csv.Reader
	Lazy   bool // if true, marshaler does not exit on first cvs.ParseError but continues and append all errors
	// contains filtered or unexported fields
}

Marshaler reads a csv file and unmarshalls it to an endpoint struct.

func NewMarshaler

func NewMarshaler(endPointStruct interface{}, r io.Reader) (*Marshaler, error)

NewMarshaler returns a new Marshaler

func (*Marshaler) Unmarshal

func (m *Marshaler) Unmarshal() ([]interface{}, error)

Unmarshal parses a csv file and stores its value to a list of entpoint structs

type ParseErrors

type ParseErrors []csv.ParseError

ParseErrors is a slice of csv.ParseError

func (ParseErrors) Error

func (errs ParseErrors) Error() string

Error returns te ParseErrors as string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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