feat: more capable csv consumer and producer #280
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR allows to use the CSV consumer and producer in a more versatile way. There is no breaking change to the interface.
fixes CSVProducer returns error 'data type must be byte array' #263 (types built with an io.Reader should be able to produce CSV)
csv/consumer can now consume CSV into *csv.Writer, io.Writer, io.ReaderFrom, encoding.BinaryUnmarshaler
also supports the new CSVWriter interface, i.e. anything that can Write([]string) error like *csv.Writer
also supports pointers with underlying type *[][]string, *[]byte and *string, not just *[]byte
csv/producer can now produce CSV from *csv.Reader, io.Reader, io.WriterTo, encoding.BinaryMarshaler
also supports the new CSVReader interface, i.e. anything that can Read() ([]string, error) like *csv.Reader
also supports underlying types [][]string, []byte and string, not just []byte
CSVConsumer and CSVProducer now stream CSV records whenever possible,
like ByteStreamConsumer and Producer, added the CSVCloseStream() option
added support to (optionally) configure the CSV format with CSVOpts, using the options made available by the standard library
doc: documented the above in the exported func signatures
test: added full unit test of the CSVConsumer and Producer