MCPcopy
hub / github.com/sqlc-dev/sqlc / SetJSONCaseStyle

Function SetJSONCaseStyle

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

Source from the content-addressed store, hash-verified

65}
66
67func SetJSONCaseStyle(name string, style string, idUppercase bool) string {
68 switch style {
69 case "camel":
70 return toJsonCamelCase(name, idUppercase)
71 case "pascal":
72 return toPascalCase(name)
73 case "snake":
74 return toSnakeCase(name)
75 default:
76 panic(fmt.Sprintf("unsupported JSON tags case style: '%s'", style))
77 }
78}
79
80var camelPattern = regexp.MustCompile("[^A-Z][A-Z]+")
81

Callers 1

JSONTagNameFunction · 0.85

Calls 3

toJsonCamelCaseFunction · 0.85
toPascalCaseFunction · 0.85
toSnakeCaseFunction · 0.85

Tested by

no test coverage detected