// NewDFReader creates a new DFReader applying the options and returning an
// error if any of the option functions fails
NewDFReader creates a new DFReader applying the options and returning an
error if any of the option functions fails
// NewDFReader creates a new DFReader applying the options and returning an // error if any of the option functions fails
func NewDFReader(opts ...DFReaderOpt) (*DFReader, error) {
	dfr := &DFReader{
		initialLines: 10,
		splitRegex:   regexp.MustCompile(defaultSplitPattern),
		skipCols:     make(map[int]bool),
		maxCols:      -1,
	}
	for _, o := range opts {
		err := o(dfr)
		if err != nil {
			return nil, err
		}
	}
	if dfr.initialLines == 0 && len(dfr.colTypes) == 0 {
		return nil, ErrNoTypeInfo
	}
	if dfr.hasHeader {
		dfr.initialLines++
	}
	if len(dfr.colTypes) != 0 {
		dfr.initialLines = 0
	}
	return dfr, nil
}
func NewDFReader ( opts ... DFReaderOpt ) ( * DFReader , error ) { dfr := & DFReader { initialLines : 10 , splitRegex : regexp . MustCompile ( defaultSplitPattern ) , skipCols : make ( map [ int ] bool ) , maxCols : - 1 , } for _ , o := range opts { err := o ( dfr ) if err != nil { return nil , err } } if dfr . initialLines == 0 && len ( dfr . colTypes ) == 0 { return nil , ErrNoTypeInfo } if dfr . hasHeader { dfr . initialLines ++ } if len ( dfr . colTypes ) != 0 { dfr . initialLines = 0 } return dfr , nil }
NewDFReader creates a new DFReader applying the options and returning an
error if any of the option functions fails
NewDFReader creates a new DFReader applying the options and returning an error if any of the option functions fails