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

Any way to dynamically set headers? #128

Open
oshalygin opened this issue Aug 13, 2019 · 1 comment
Open

Any way to dynamically set headers? #128

oshalygin opened this issue Aug 13, 2019 · 1 comment

Comments

@oshalygin
Copy link

First of all, amazing work guys. This library is very straightforward to use and a lot more user friendly than encoding/csv.

I'm trying to dynamically set the headers based on my actual data. Odd request I know, but I couldn't find an API within the library that allowed me to do this.

The only thing I can think of is blowing away the first row of headers that I do know, and then just prepending to the string aka csv.

Is there a way I can intercept the MarshalBytes or MarshalX function with what the headers should display as?

Obvs I can't dynamically set struct tags but wondering if there's something within the API surface that I am missing.

Also willing to contribute if others are looking for this and it doesn't exist!

@shigetaichi
Copy link

@oshalygin
I’ve created a new package that can dynamically change headers, and I have used gocsv as a reference for most of the csv generation process. (Thanks to all gocsv contributors.) I hope the ideas are helpful to you.
https://github.com/shigetaichi/xsv

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

No branches or pull requests

2 participants