gocarina / gocsv

The GoCSV package aims to provide easy CSV serialization and deserialization to the golang programming language
MIT License
1.99k stars 245 forks source link

Custom Parent.Child Combine String #240

Closed c3llus closed 1 year ago

c3llus commented 1 year ago

Hi, I recently ran into this problem where I wanna show my non-dev user the fields (with custom naming, non-dev friendly). But it seems that when I have a child struct, the way we append is by using the full stop (.), which might hinder this.

I work around this by creating a new struct without child struct, specifically for this purpose. But I just thought it would be nice to add an option for the way we combine parent key and child key name. We can make something like this?

for _, ckey := range currFieldInfo.keys {
    keys = append(keys, normalizeName(fmt.Sprintf("%s%s%s", pkey, COMBINER, ckey)))
}

p.s. I never did open source nor contribute publicly, and would very much love to contribute on this matter if possible? PR: #241

Thanks in advance! :)