Versions in this module Expand all Collapse all v0 v0.1.0 Apr 15, 2024 Changes in this version + var ErrChannelIsClosed = errors.New("channel is closed") + var ErrDoubleHeaderNames = errors.New("double header names") + var ErrEmptyCSVFile = errors.New("empty csv file given") + var ErrNoStructTags = errors.New("no csv struct tags found") + var ErrUnmatchedStructTags = errors.New("unmatched struct tags") + var FailIfDoubleHeaderNames = false + var FailIfUnmatchedStructTags = false + var FieldsCombiner = "." + var ShouldAlignDuplicateHeadersWithStructFieldOrder = false + var TagName = "csv" + var TagSeparator = "," + func CSVToChanMaps(reader io.Reader, c chan<- map[string]string) error + func CSVToMap(in io.Reader) (map[string]string, error) + func CSVToMaps(reader io.Reader) ([]map[string]string, error) + func Marshal(in interface{}, out io.Writer) (err error) + func MarshalBytes(in interface{}) (out []byte, err error) + func MarshalCSV(in interface{}, out CSVWriter) (err error) + func MarshalCSVWithoutHeaders(in interface{}, out CSVWriter) (err error) + func MarshalChan(c <-chan interface{}, out CSVWriter) error + func MarshalChanWithoutHeaders(c <-chan interface{}, out CSVWriter) error + func MarshalFile(in interface{}, file *os.File) (err error) + func MarshalString(in interface{}) (out string, err error) + func MarshalStringWithoutHeaders(in interface{}) (out string, err error) + func MarshalWithoutHeaders(in interface{}, out io.Writer) (err error) + func SetCSVReader(csvReader func(io.Reader) CSVReader) + func SetCSVWriter(csvWriter func(io.Writer) *SafeCSVWriter) + func SetHeaderNormalizer(f Normalizer) + func Unmarshal(in io.Reader, out interface{}) error + func UnmarshalBytes(in []byte, out interface{}) error + func UnmarshalBytesToCallback(ctx context.Context, in []byte, f interface{}) error + func UnmarshalBytesToCallbackWithError(ctx context.Context, in []byte, f interface{}) error + func UnmarshalBytesToChan(ctx context.Context, in []byte, c interface{}) error + func UnmarshalCSV(in CSVReader, out interface{}) error + func UnmarshalCSVToMap(in CSVReader, out interface{}) error + func UnmarshalCSVWithoutHeaders(in CSVReader, out interface{}) error + func UnmarshalDecoder(in Decoder, out interface{}) error + func UnmarshalDecoderToCallback(ctx context.Context, in SimpleDecoder, f interface{}) error + func UnmarshalDecoderToChan(ctx context.Context, in SimpleDecoder, c interface{}) error + func UnmarshalFile(in *os.File, out interface{}) error + func UnmarshalFileWithErrorHandler(in *os.File, errHandler ErrorHandler, out interface{}) error + func UnmarshalMultipartFile(in *multipart.File, out interface{}) error + func UnmarshalString(in string, out interface{}) error + func UnmarshalStringToCallback(ctx context.Context, in string, c interface{}) (err error) + func UnmarshalStringToCallbackWithError(ctx context.Context, in string, c interface{}) (err error) + func UnmarshalStringToChan(ctx context.Context, in string, c interface{}) error + func UnmarshalToCallback(ctx context.Context, in io.Reader, f interface{}) error + func UnmarshalToCallbackWithError(ctx context.Context, in io.Reader, f interface{}) error + func UnmarshalToChan(ctx context.Context, in io.Reader, c interface{}) error + func UnmarshalToChanWithErrorHandler(ctx context.Context, in io.Reader, errorHandler ErrorHandler, c interface{}) error + func UnmarshalToChanWithoutHeaders(in io.Reader, c interface{}) error + func UnmarshalWithErrorHandler(in io.Reader, errHandle ErrorHandler, out interface{}) error + func UnmarshalWithoutHeaders(in io.Reader, out interface{}) error + type CSVReader interface + Read func() ([]string, error) + ReadAll func() ([][]string, error) + func DefaultCSVReader(in io.Reader) CSVReader + func LazyCSVReader(in io.Reader) CSVReader + type CSVWriter interface + Error func() error + Flush func() + Write func(row []string) error + type Decoder interface + GetCSVRows func() ([][]string, error) + type ErrorHandler func(*csv.ParseError) bool + type NoMarshalFuncError struct + func (e NoMarshalFuncError) Error() string + type NoUnmarshalFuncError struct + func (e NoUnmarshalFuncError) Error() string + type Normalizer func(string) string + func DefaultNameNormalizer() Normalizer + type SafeCSVWriter struct + func DefaultCSVWriter(out io.Writer) *SafeCSVWriter + func NewSafeCSVWriter(original *csv.Writer) *SafeCSVWriter + func (w *SafeCSVWriter) Flush() + func (w *SafeCSVWriter) Write(row []string) error + type SimpleDecoder interface + GetCSVRow func() ([]string, error) + GetCSVRows func() ([][]string, error) + func NewSimpleDecoderFromCSVReader(r CSVReader) SimpleDecoder + type TypeMarshaller interface + MarshalCSV func() (string, error) + type TypeUnmarshalCSVWithFields interface + UnmarshalCSVWithFields func(key, value string) error + type TypeUnmarshaller interface + UnmarshalCSV func(string) error + type Unmarshaller struct + Headers []string + MismatchedHeaders []string + MismatchedStructFields []string + func NewUnmarshaller(reader *csv.Reader, out interface{}) (*Unmarshaller, error) + func (um *Unmarshaller) Read() (interface{}, error) + func (um *Unmarshaller) ReadUnmatched() (interface{}, map[string]string, error) + func (um *Unmarshaller) RenormalizeHeaders(headerNormalizer func([]string) []string) error