aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go
diff options
context:
space:
mode:
authorAmine <hilalyamine@gmail.com>2019-08-17 01:30:57 +0200
committerGitHub <noreply@github.com>2019-08-17 01:30:57 +0200
commit6428352bd14828f670206b60862de7f71c52d235 (patch)
treeac117a0360bcf03a948b373e2dfd34c61e932226 /vendor/github.com/99designs/gqlgen/codegen/templates/templates.go
parenta3815d2ebb7d4a12d7b0db434b0b244e03e5e98a (diff)
parentd571deef57b682f92e71f9374c2c59893db811af (diff)
downloadgit-bug-6428352bd14828f670206b60862de7f71c52d235.tar.gz
Merge pull request #194 from MichaelMure/dependabot/dep/github.com/99designs/gqlgen-0.9.2
build(deps): bump github.com/99designs/gqlgen from 0.9.1 to 0.9.2
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/codegen/templates/templates.go')
-rw-r--r--vendor/github.com/99designs/gqlgen/codegen/templates/templates.go14
1 files changed, 8 insertions, 6 deletions
diff --git a/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go b/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go
index f2fcb568..5d5f69bf 100644
--- a/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go
+++ b/vendor/github.com/99designs/gqlgen/codegen/templates/templates.go
@@ -285,7 +285,8 @@ func ToGoPrivate(name string) string {
first := true
wordWalker(name, func(info *wordInfo) {
word := info.Word
- if first {
+ switch {
+ case first:
if strings.ToUpper(word) == word || strings.ToLower(word) == word {
// ID → id, CAMEL → camel
word = strings.ToLower(info.Word)
@@ -294,9 +295,9 @@ func ToGoPrivate(name string) string {
word = lcFirst(info.Word)
}
first = false
- } else if info.MatchCommonInitial {
+ case info.MatchCommonInitial:
word = strings.ToUpper(word)
- } else if !info.HasCommonInitial {
+ case !info.HasCommonInitial:
word = ucFirst(strings.ToLower(word))
}
runes = append(runes, []rune(word)...)
@@ -319,9 +320,10 @@ func wordWalker(str string, f func(*wordInfo)) {
hasCommonInitial := false
for i+1 <= len(runes) {
eow := false // whether we hit the end of a word
- if i+1 == len(runes) {
+ switch {
+ case i+1 == len(runes):
eow = true
- } else if isDelimiter(runes[i+1]) {
+ case isDelimiter(runes[i+1]):
// underscore; shift the remainder forward over any run of underscores
eow = true
n := 1
@@ -336,7 +338,7 @@ func wordWalker(str string, f func(*wordInfo)) {
copy(runes[i+1:], runes[i+n+1:])
runes = runes[:len(runes)-n]
- } else if unicode.IsLower(runes[i]) && !unicode.IsLower(runes[i+1]) {
+ case unicode.IsLower(runes[i]) && !unicode.IsLower(runes[i+1]):
// lower->non-lower
eow = true
}