Skip to content

Commit

Permalink
refactor: improve customCamelCase (#165)
Browse files Browse the repository at this point in the history
  • Loading branch information
byashimov authored Oct 16, 2024
1 parent 11641d8 commit 2292345
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 3 additions & 8 deletions generator/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -649,13 +649,8 @@ func fmtQueryParamType() *jen.Statement {
return jen.Index(jen.Lit(queryParamArraySize)).String()
}

var reNonWord = regexp.MustCompile(`\W+`)

func customCamelCase(s string) string {
// Split the string by ":"
parts := strings.Split(s, ":")
for i, part := range parts {
// Convert each part to camelCase using strcase.ToCamel
parts[i] = strcase.ToCamel(part)
}
// Join the parts back together
return strings.Join(parts, "")
return strcase.ToCamel(reNonWord.ReplaceAllString(s, "_"))
}
2 changes: 1 addition & 1 deletion handler/kafkatopic/kafkatopic.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2292345

Please sign in to comment.