Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support TypeUnmarshalCSVWithFields in readEach #277

Merged
merged 2 commits into from
May 20, 2024

Conversation

mschmidt-onecause
Copy link
Contributor

  • Add support for calling TypeUnmarshalCSVWithFields interface in readEach function similar to readTo
  • Slight rearrangment of calling UnmarshalCSVWithFields for both readEach and readTo to place it above the fieldInfo check
    • A type should be able to completely handle unmarshalling by implementing this interface, it doesn't seem like it should depend on having csv tags matching the headers or not
    • This allows, for example, a csv record to be read into a struct with unknown headers; extra columns could be added to a map field in the struct, etc
  • Also add missing default value setting in readEach

- Slight rearrangment compared to readTo to place it above the fieldInfo check; if a type is going to completely handle unmarshalling by implementing this interface, we shouldn't care that it has matching csv tagged fields or not
- Also add missing default value setting in readEach
@pikanezi pikanezi merged commit 78e41c7 into gocarina:master May 20, 2024
1 check passed
@pikanezi
Copy link
Member

Thanks

@mschmidt-onecause mschmidt-onecause deleted the readeach-unmarshal branch May 21, 2024 12:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants