Skip to content

Commit

Permalink
fix: Wrong conversion of filter name with underscore
Browse files Browse the repository at this point in the history
  • Loading branch information
smutel committed Jul 3, 2023
1 parent 6413c4a commit b72f202
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion netbox/internal/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,14 @@ func FieldNameToStructName(k string) string {
r := []rune(k)
r[0] = unicode.ToUpper(r[0])
k = string(r)
k = strings.Replace(k, "_", "", -1)

split := strings.Split(k, "_")
k = split[0]
if len(split) > 1 {
r2 := []rune(split[1])
r2[0] = unicode.ToUpper(r2[0])
k = k + string(r2)
}

return k
}

0 comments on commit b72f202

Please sign in to comment.