MCPcopy Index your code
hub / github.com/coder/coder / nameFromSnakeCase

Function nameFromSnakeCase

scripts/dbgen/main.go:473–498  ·  view source on GitHub ↗

nameFromSnakeCase converts snake_case to CamelCase.

(s string)

Source from the content-addressed store, hash-verified

471
472// nameFromSnakeCase converts snake_case to CamelCase.
473func nameFromSnakeCase(s string) string {
474 var ret string
475 for _, ss := range strings.Split(s, "_") {
476 switch ss {
477 case "id":
478 ret += "ID"
479 case "ids":
480 ret += "IDs"
481 case "jwt":
482 ret += "JWT"
483 case "idx":
484 ret += "Index"
485 case "api":
486 ret += "API"
487 case "uuid":
488 ret += "UUID"
489 case "gitsshkeys":
490 ret += "GitSSHKeys"
491 case "fkey":
492 // ignore
493 default:
494 ret += strings.Title(ss)
495 }
496 }
497 return ret
498}
499
500// interfaceMethods returns all embedded methods of an interface.
501func interfaceMethods(i *dst.InterfaceType) []*dst.Field {

Callers 1

generateConstraintsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected