-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Now a function is generated for each field and directive that has arguments. This function can be used by both field methods as well as the `Complexity` method. The `args.gotpl` template now generates the code for this function, so its purpose is a little different than it used to be.
- Loading branch information
Showing
6 changed files
with
59 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,13 @@ | ||
{{- if . }}args := map[string]interface{}{} {{end}} | ||
args := map[string]interface{}{} | ||
{{- range $i, $arg := . }} | ||
var arg{{$i}} {{$arg.Signature }} | ||
if tmp, ok := rawArgs[{{$arg.GQLName|quote}}]; ok { | ||
var err error | ||
{{$arg.Unmarshal (print "arg" $i) "tmp" }} | ||
if err != nil { | ||
ec.Error(ctx, err) | ||
{{- if $arg.Stream }} | ||
return nil | ||
{{- else }} | ||
return graphql.Null | ||
{{- end }} | ||
return nil, err | ||
} | ||
} | ||
args[{{$arg.GQLName|quote}}] = arg{{$i}} | ||
{{- end -}} | ||
{{- end }} | ||
return args, nil |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters