jszwec / csvutil

csvutil provides fast and idiomatic mapping between CSV and Go (golang) values.
MIT License
944 stars 62 forks source link

feat: add FailSlow flag to Decoder #68

Closed korrawit closed 10 months ago

korrawit commented 10 months ago

Description

Added a new flag call FailSlow to decoder

// FailSlow, if true, allows the Decoder to continue decoding
// records even if errors are encountered. This provides a
// more lenient decoding approach, attempting to recover
// as much valid data as possible. If false, the Decoder
// stops on the first encountered error.
//
// Default: false
FailSlow bool

Usage

dec, _ := csvutil.NewDecoder(csvReader)
dec.FailSlow = true

Checklist

jszwec commented 10 months ago

I am sorry but this does not make sense to me. If you need to handle conversions like that then you probably don't want to use csvutil. You will be better of with csv.Reader's raw string data.

Besides, there are other ways to solve this problem. For example Register your own handler that will ignore parsing errors.

korrawit commented 10 months ago

Thank you for your feedback. I appreciate your perspective on the use of csvutil and handling conversions.

I understand your point about using csv.Reader for raw string data. However, I believed that leveraging csvutil could provide a more concise and readable solution for handling conversions in this particular case.

Regarding the suggestion to register a custom handler to ignore parsing errors, I will reconsider this approach and explore if it aligns better with the project's requirements. Your input is valuable, and I'll work on addressing these concerns in an alternative way.

If you have any specific recommendations or further details on the preferred approach, I'd be grateful for your guidance. I'm open to making the necessary adjustments to ensure the code aligns with the project's standards.

Thank you again for your time and consideration.