gocarina / gocsv

The GoCSV package aims to provide easy CSV serialization and deserialization to the golang programming language
MIT License
1.99k stars 245 forks source link

Export decoder and simpleDecoder interface methods #205

Closed tuananhlai closed 2 years ago

tuananhlai commented 2 years ago

Description

Export Decoder and SimpleDecoder interface methods.

Why?

Current implementation is leaving getCSVRow and getCSVRows as private methods. Therefore, we have no way to implement a custom SimpleDecoder from outside of this package.

# go.myapi.com/example/golang/testpkg
golang/testpkg/csv_reader_adapter.go:31:9: cannot use &CSVDecoderAdapter{...} (type *CSVDecoderAdapter) as type gocsv.SimpleDecoder in return argument:
        *CSVDecoderAdapter does not implement gocsv.SimpleDecoder (missing gocsv.getCSVRow method)
                have getCSVRow() ([]string, error)
                want gocsv.getCSVRow() ([]string, error)

References: https://groups.google.com/g/golang-nuts/c/6hpUErAfMHI

pikanezi commented 2 years ago

thanks