MCPcopy Create free account
hub / github.com/go-dev-frame/sponge / toCamel

Function toCamel

pkg/sql2code/parser/nameFormat.go:45–69  ·  view source on GitHub ↗
(s string)

Source from the content-addressed store, hash-verified

43}
44
45func toCamel(s string) string {
46 str := xstrings.ToCamelCase(s)
47
48 name := strings.ToUpper(str)
49 if _, ok := peculiarNouns[name]; ok {
50 return name
51 }
52
53 l := len(str)
54 for k, v := range peculiarNouns {
55 nl := len(v)
56 if l > nl {
57 if str[l-nl:] == v {
58 str = str[:l-nl] + k
59 break
60 }
61 }
62 }
63
64 if str == "_ID" { // special case for table column ID
65 str = "ID"
66 }
67
68 return str
69}
70
71func firstLetterToLower(str string) string {
72 if len(str) == 0 {

Callers 5

customToCamelFunction · 0.85
customToSnakeFunction · 0.85
ParseSQLFunction · 0.85
makeCodeFunction · 0.85
TestNameFormatFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestNameFormatFunction · 0.68