I have a struct which I want to convert into a CSV string. I don't have to write the CSV file. I just need to create the CSV string.
The Go CSV package (https://golang.org/pkg/encoding/csv/) only provides the writing facility.
Here's the struct:
type myData struct {
A string `json:"a"`
B string `json:"b"`
C string `json:"c"`
}
CSV:
1,2,3
4, ,6
I wanted a CSV string so that I can directly upload the string as a file in cloud storage via a serverless environment. So, I want to avoid creating a file in serverless environment.
Is there any package that can help in doing this?