aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/github.com/vektah/gqlgen/codegen/templates/args.gotpl
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/vektah/gqlgen/codegen/templates/args.gotpl')
-rw-r--r--vendor/github.com/vektah/gqlgen/codegen/templates/args.gotpl30
1 files changed, 30 insertions, 0 deletions
diff --git a/vendor/github.com/vektah/gqlgen/codegen/templates/args.gotpl b/vendor/github.com/vektah/gqlgen/codegen/templates/args.gotpl
new file mode 100644
index 00000000..f53aceec
--- /dev/null
+++ b/vendor/github.com/vektah/gqlgen/codegen/templates/args.gotpl
@@ -0,0 +1,30 @@
+ {{- if . }}args := map[string]interface{}{} {{end}}
+ {{- range $i, $arg := . }}
+ var arg{{$i}} {{$arg.Signature }}
+ if tmp, ok := field.Args[{{$arg.GQLName|quote}}]; ok {
+ var err error
+ {{$arg.Unmarshal (print "arg" $i) "tmp" }}
+ if err != nil {
+ ec.Error(ctx, err)
+ {{- if $arg.Object.Stream }}
+ return nil
+ {{- else }}
+ return graphql.Null
+ {{- end }}
+ }
+ } {{ if $arg.Default }} else {
+ var tmp interface{} = {{ $arg.Default | dump }}
+ var err error
+ {{$arg.Unmarshal (print "arg" $i) "tmp" }}
+ if err != nil {
+ ec.Error(ctx, err)
+ {{- if $arg.Object.Stream }}
+ return nil
+ {{- else }}
+ return graphql.Null
+ {{- end }}
+ }
+ }
+ {{end }}
+ args[{{$arg.GQLName|quote}}] = arg{{$i}}
+ {{- end -}}