MCPcopy Index your code
hub / github.com/sqlc-dev/sqlc / toJsonCamelCase

Function toJsonCamelCase

internal/codegen/golang/field.go:115–135  ·  view source on GitHub ↗
(name string, idUppercase bool)

Source from the content-addressed store, hash-verified

113}
114
115func toJsonCamelCase(name string, idUppercase bool) string {
116 out := ""
117 idStr := "Id"
118
119 if idUppercase {
120 idStr = "ID"
121 }
122
123 for i, p := range strings.Split(name, "_") {
124 if i == 0 {
125 out += p
126 continue
127 }
128 if p == "id" {
129 out += idStr
130 } else {
131 out += strings.Title(p)
132 }
133 }
134 return out
135}
136
137func toLowerCase(str string) string {
138 if str == "" {

Callers 1

SetJSONCaseStyleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected