MCPcopy Index your code
hub / github.com/go-dev-frame/sponge / customToSnake

Function customToSnake

pkg/sql2code/parser/nameFormat.go:95–119  ·  view source on GitHub ↗
(str string)

Source from the content-addressed store, hash-verified

93}
94
95func customToSnake(str string) string {
96 str = toCamel(str)
97 l := len(str)
98 for k, _ := range peculiarNouns {
99 if str == k {
100 str = strings.ToLower(str)
101 break
102 }
103
104 nl := len(k)
105 if l > nl {
106 if str[l-nl:] == k {
107 str = str[:l-nl] + "_" + strings.ToLower(k)
108 break
109 }
110 }
111 }
112
113 str = xstrings.ToSnakeCase(str)
114 if strings.HasPrefix(str, "__") {
115 str = str[1:]
116 }
117
118 return str
119}

Callers 5

makeCodeFunction · 0.85
getHandlerStructCodesFunction · 0.85
goTypeToProtoFunction · 0.85
TestNameFormatFunction · 0.85

Calls 1

toCamelFunction · 0.85

Tested by 1

TestNameFormatFunction · 0.68