Skip to content

Commit

Permalink
shorten some generated code (#2120)
Browse files Browse the repository at this point in the history
* shorten some generated code

* generate examples
  • Loading branch information
vikstrous authored Apr 25, 2022
1 parent 4da17e1 commit 77260e8
Show file tree
Hide file tree
Showing 38 changed files with 1,026 additions and 3,709 deletions.
226 changes: 50 additions & 176 deletions _examples/chat/generated.go

Large diffs are not rendered by default.

231 changes: 51 additions & 180 deletions _examples/config/generated.go

Large diffs are not rendered by default.

234 changes: 50 additions & 184 deletions _examples/dataloader/generated.go

Large diffs are not rendered by default.

224 changes: 48 additions & 176 deletions _examples/federation/accounts/graph/generated/generated.go

Large diffs are not rendered by default.

229 changes: 49 additions & 180 deletions _examples/federation/products/graph/generated/generated.go

Large diffs are not rendered by default.

249 changes: 53 additions & 196 deletions _examples/federation/reviews/graph/generated/generated.go

Large diffs are not rendered by default.

237 changes: 57 additions & 180 deletions _examples/fileupload/generated.go

Large diffs are not rendered by default.

244 changes: 52 additions & 192 deletions _examples/scalars/generated.go

Large diffs are not rendered by default.

229 changes: 49 additions & 180 deletions _examples/selection/generated.go

Large diffs are not rendered by default.

306 changes: 66 additions & 240 deletions _examples/starwars/generated/exec.go

Large diffs are not rendered by default.

218 changes: 50 additions & 168 deletions _examples/todo/generated.go

Large diffs are not rendered by default.

216 changes: 48 additions & 168 deletions _examples/type-system-extension/generated.go

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions codegen/object.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,12 @@ func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.Selec
{{end}}
})
{{- else }}
innerFunc := func(ctx context.Context) (res graphql.Marshaler) {
return ec._{{$object.Name}}_{{$field.Name}}(ctx, field{{if not $object.Root}}, obj{{end}})
}
{{if $object.Root}}
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, innerFunc)
out.Values[i] = ec.OperationContext.RootResolverMiddleware(innerCtx, func(ctx context.Context) (res graphql.Marshaler) {
return ec._{{$object.Name}}_{{$field.Name}}(ctx, field)
})
{{else}}
out.Values[i] = innerFunc(ctx)
out.Values[i] = ec._{{$object.Name}}_{{$field.Name}}(ctx, field, obj)
{{end}}

{{- if $field.TypeReference.GQL.NonNull }}
Expand Down
5 changes: 1 addition & 4 deletions codegen/testserver/followschema/builtinscalar.generated.go

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

20 changes: 4 additions & 16 deletions codegen/testserver/followschema/complexity.generated.go

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

31 changes: 11 additions & 20 deletions codegen/testserver/followschema/defaults.generated.go

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

20 changes: 4 additions & 16 deletions codegen/testserver/followschema/directive.generated.go

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

15 changes: 3 additions & 12 deletions codegen/testserver/followschema/embedded.generated.go

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

Loading

0 comments on commit 77260e8

Please sign in to comment.