Skip to content

Commit

Permalink
Merge pull request 99designs#680 from asp24/collect-fields-performance
Browse files Browse the repository at this point in the history
Better CollectFields performance
  • Loading branch information
vektah authored Apr 17, 2019
2 parents 6b9c07c + 0cf6bb6 commit 60bedda
Show file tree
Hide file tree
Showing 14 changed files with 145 additions and 140 deletions.
4 changes: 2 additions & 2 deletions codegen/object.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ var {{ $object.Name|lcFirst}}Implementors = {{$object.Implementors}}

{{- if .Stream }}
func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet) func() graphql.Marshaler {
fields := graphql.CollectFields(ctx, sel, {{$object.Name|lcFirst}}Implementors)
fields := graphql.CollectFields(ec.RequestContext, sel, {{$object.Name|lcFirst}}Implementors)
ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{
Object: {{$object.Name|quote}},
})
Expand All @@ -24,7 +24,7 @@ func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.Selec
}
{{- else }}
func (ec *executionContext) _{{$object.Name}}(ctx context.Context, sel ast.SelectionSet{{ if not $object.Root }},obj {{$object.Reference | ref }}{{ end }}) graphql.Marshaler {
fields := graphql.CollectFields(ctx, sel, {{$object.Name|lcFirst}}Implementors)
fields := graphql.CollectFields(ec.RequestContext, sel, {{$object.Name|lcFirst}}Implementors)
{{if $object.Root}}
ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{
Object: {{$object.Name|quote}},
Expand Down
70 changes: 35 additions & 35 deletions codegen/testserver/generated.go

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions example/chat/generated.go

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

20 changes: 10 additions & 10 deletions example/config/generated.go

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

22 changes: 11 additions & 11 deletions example/dataloader/generated.go

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

Loading

0 comments on commit 60bedda

Please sign in to comment.