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

Function Singular

internal/inflection/singular.go:14–52  ·  view source on GitHub ↗
(s SingularParams)

Source from the content-addressed store, hash-verified

12}
13
14func Singular(s SingularParams) string {
15 for _, exclusion := range s.Exclusions {
16 if strings.EqualFold(s.Name, exclusion) {
17 return s.Name
18 }
19 }
20
21 // Manual fix for incorrect handling of "campus"
22 //
23 // https://github.com/sqlc-dev/sqlc/issues/430
24 // https://github.com/jinzhu/inflection/issues/13
25 if strings.ToLower(s.Name) == "campus" {
26 return s.Name
27 }
28 // Manual fix for incorrect handling of "meta"
29 //
30 // https://github.com/sqlc-dev/sqlc/issues/1217
31 // https://github.com/jinzhu/inflection/issues/21
32 if strings.ToLower(s.Name) == "meta" {
33 return s.Name
34 }
35 // Manual fix for incorrect handling of "calories"
36 //
37 // https://github.com/sqlc-dev/sqlc/issues/2017
38 // https://github.com/jinzhu/inflection/issues/23
39 if strings.ToLower(s.Name) == "calories" {
40 return "calorie"
41 }
42 // Manual fix for incorrect handling of "-ves" suffix
43 if strings.ToLower(s.Name) == "waves" {
44 return "wave"
45 }
46
47 if strings.ToLower(s.Name) == "metadata" {
48 return "metadata"
49 }
50
51 return upstream.Singular(s.Name)
52}

Callers 1

buildStructsFunction · 0.92

Calls

no outgoing calls

Tested by

no test coverage detected