Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change variable name to avoid conflict with auto generated receiver name #566

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions entgql/template/collection.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ import (
{{ $query := $node.QueryName }}
// CollectFields tells the query-builder to eagerly load connected nodes by resolver context.
func ({{ $receiver }} *{{ $query }}) CollectFields(ctx context.Context, satisfies ...string) (*{{ $query }}, error) {
fc := graphql.GetFieldContext(ctx)
if fc == nil {
fieldContext := graphql.GetFieldContext(ctx)
if fieldContext == nil {
return {{ $receiver }}, nil
}
if err := {{ $receiver }}.collectField(ctx, graphql.GetOperationContext(ctx), fc.Field, nil, satisfies...); err != nil {
if err := {{ $receiver }}.collectField(ctx, graphql.GetOperationContext(ctx), fieldContext.Field, nil, satisfies...); err != nil {
return nil, err
}
return {{ $receiver }}, nil
Expand Down
Loading