diff options
author | Amine Hilaly <hilalyamine@gmail.com> | 2019-05-15 15:04:57 +0200 |
---|---|---|
committer | Amine Hilaly <hilalyamine@gmail.com> | 2019-05-15 15:04:57 +0200 |
commit | 6949d6c543e9397578c7c840812df9bbf8531528 (patch) | |
tree | cdbc6c797b406029f03b5e5391fe1afdea88ce8e /vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl | |
parent | 97476ff5fadaf0a457d0f0133db58415b6075940 (diff) | |
download | git-bug-6949d6c543e9397578c7c840812df9bbf8531528.tar.gz |
Upgrade gqlgen version to v0.9.0
Diffstat (limited to 'vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl')
-rw-r--r-- | vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl | 33 |
1 files changed, 20 insertions, 13 deletions
diff --git a/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl b/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl index dce8ce97..5753f1d1 100644 --- a/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl +++ b/vendor/github.com/99designs/gqlgen/codegen/generated!.gotpl @@ -4,6 +4,7 @@ {{ reserveImport "strconv" }} {{ reserveImport "time" }} {{ reserveImport "sync" }} +{{ reserveImport "sync/atomic" }} {{ reserveImport "errors" }} {{ reserveImport "bytes" }} @@ -46,7 +47,8 @@ type ComplexityRoot struct { {{ range $object := .Objects }} {{ if not $object.IsReserved -}} {{ $object.Name|go }} struct { - {{ range $field := $object.UniqueFields -}} + {{ range $_, $fields := $object.UniqueFields }} + {{- $field := index $fields 0 -}} {{ if not $field.IsReserved -}} {{ $field.GoFieldName }} {{ $field.ComplexitySignature }} {{ end }} @@ -84,20 +86,25 @@ func (e *executableSchema) Complexity(typeName, field string, childComplexity in switch typeName + "." + field { {{ range $object := .Objects }} {{ if not $object.IsReserved }} - {{ range $field := $object.UniqueFields }} - {{ if not $field.IsReserved }} - case "{{$object.Name}}.{{$field.GoFieldName}}": - if e.complexity.{{$object.Name|go}}.{{$field.GoFieldName}} == nil { - break - } - {{ if $field.Args }} - args, err := ec.{{ $field.ArgsFunc }}(context.TODO(),rawArgs) - if err != nil { - return 0, false + {{ range $_, $fields := $object.UniqueFields }} + {{- $len := len $fields }} + {{- range $i, $field := $fields }} + {{- $last := eq (add $i 1) $len }} + {{- if not $field.IsReserved }} + {{- if eq $i 0 }}case {{ end }}"{{$object.Name}}.{{$field.Name}}"{{ if not $last }},{{ else }}: + if e.complexity.{{$object.Name|go}}.{{$field.GoFieldName}} == nil { + break } + {{ if $field.Args }} + args, err := ec.{{ $field.ArgsFunc }}(context.TODO(),rawArgs) + if err != nil { + return 0, false + } + {{ end }} + return e.complexity.{{$object.Name|go}}.{{$field.GoFieldName}}(childComplexity{{if $field.Args}}, {{$field.ComplexityArgs}} {{ end }}), true {{ end }} - return e.complexity.{{$object.Name|go}}.{{$field.GoFieldName}}(childComplexity{{if $field.Args}}, {{$field.ComplexityArgs}} {{end}}), true - {{ end }} + {{- end }} + {{- end }} {{ end }} {{ end }} {{ end }} |