aboutsummaryrefslogblamecommitdiffstats
path: root/vendor/github.com/vektah/gqlgen/codegen/templates/args.gotpl
blob: f53aceec1e53f3b197c56431723051dde0a3bbd9 (plain) (tree)





























                                                                       
	{{- 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 -}}