csv: github.com/zbindenren/csv Index | Files | Directories

package csv

import "github.com/zbindenren/csv"


Package Files



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")

type Marshaler Uses

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 Uses

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

NewMarshaler returns a new Marshaler

func (*Marshaler) Unmarshal Uses

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

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

type ParseErrors Uses

type ParseErrors []csv.ParseError

ParseErrors is a slice of csv.ParseError

func (ParseErrors) Error Uses

func (errs ParseErrors) Error() string

Error returns te ParseErrors as string



Package csv imports 8 packages (graph) and is imported by 1 packages. Updated 2016-07-22. Refresh now. Tools for package owners.