encoding/csv: add column level introspection capabilities #22590
Labels
Milestone
Comments
I think there is very little appetite for adding any new API to encoding/csv. |
The problem seems to be differentiating between a NULL value vs. an empty string for string database types. RFC4180 doesn't seem to have any rules regarding this. How about this proposal instead:
And vice versa for csv.Writer. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
As briefly mentioned inside certain csv.Writer comments, there are frequent use cases, particularly with Postgres bulk copy to / from, where it is useful to differentiate between unquoted and quoted empty strings.
In particular, for csv.Reader, by the time Read() returns a slice of strings, it is too late to know whether a certain empty string is a quoted empty string or an unquoted one.
My particular use case deals with determining the nullability of an empty unquoted string, but - more generally - I just wanted to see if there is any appetite towards adding such column level introspection capabilities to the standard library csv.Reader and csv.Writer, without breaking compatibility.
For Reader, this would expose an additional surface perhaps similar to:
Regards,
silviu
The text was updated successfully, but these errors were encountered: