iancoleman / strcase

A golang package for converting to snake_case or CamelCase
MIT License
1.01k stars 106 forks source link

Generate camelCase from snake-case XML tags #29

Open ranganath42 opened 3 years ago

ranganath42 commented 3 years ago

How about adding an option to generate camelCase Go structs from snake-case XML structs? For example, from

<Address>
    <zip-code/>
    <city/>
</Address>

To generate,

type Address struct {
        XMLName xml.Name `xml:"Address,omitempty" json:"Address,omitempty"`
        City *City `xml:"city,omitempty" json:"city,omitempty"`
        ZipCode *ZipCode `xml:"zip-code,omitempty" json:"zip-code,omitempty"`
}

type City struct {
        XMLName xml.Name `xml:"city,omitempty" json:"city,omitempty"`
}

type ZipCode struct {
        XMLName xml.Name `xml:"zip-code,omitempty" json:"zip-code,omitempty"`
}