Skip to content

Commit

Permalink
Hold reference to avoid casting
Browse files Browse the repository at this point in the history
Remove not more required comment regarding naming collision
  • Loading branch information
janboll committed Mar 30, 2022
1 parent e9e5ad1 commit 5e47208
Show file tree
Hide file tree
Showing 52 changed files with 199 additions and 335 deletions.
16 changes: 6 additions & 10 deletions example/generated.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 4 additions & 10 deletions generate/operation.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,6 @@ func {{.Name}}(
OpName: "{{.Name}}",
Query: `{{.Body}}`,
{{if .Input -}}
{{/* We need to avoid conflicting with any of the function's argument names
which are derived from the GraphQL argument names; notably `input` is
a common one. So we use a name that's not legal in GraphQL, namely
one starting with a double-underscore. */ -}}
Variables: &{{.Input.GoName}}{
{{range .Input.Fields -}}
{{.GoName}}: {{.GraphQLName}},
Expand All @@ -37,16 +33,14 @@ func {{.Name}}(
return nil, {{if .Config.Extensions -}}nil,{{end -}} err
}
{{end}}
resp := &graphql.Response{
Data: &{{.ResponseName}}{},
}
var data {{.ResponseName}}
resp := &graphql.Response{Data: &data}

err = client.MakeRequest(
{{if ne .Config.ContextType "-"}}ctx{{else}}nil{{end}},
req,
resp,
)

retval := resp.Data.(*{{.ResponseName}})
return retval, {{if .Config.Extensions -}}resp.Extensions,{{end -}} err

return &data, {{if .Config.Extensions -}}resp.Extensions,{{end -}} err
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 5e47208

Please sign in to comment.