Skip to content

Commit

Permalink
graphql.CollectFields now accept *RequestContext as first arg
Browse files Browse the repository at this point in the history
It was done because RequestContext is a part of executionContext and can
be passed directly without extraction from ctx. This is increasing
performance when model depth is high
  • Loading branch information
asp24 authored and asp24 committed Apr 17, 2019
1 parent 5dfa228 commit 7ba1b3b
Show file tree
Hide file tree
Showing 14 changed files with 136 additions and 135 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 7ba1b3b

Please sign in to comment.