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

Added include/skip directives support. #187

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion codegen/templates/data.go

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

5 changes: 5 additions & 0 deletions codegen/templates/inliner/inliner.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
Inliner used to generate const string templates from .gotpl files.
Notice that working directory must be vektah/gqlgen/codegen/templates
*/

package main

import (
Expand Down
6 changes: 4 additions & 2 deletions codegen/templates/object.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var {{ $object.GQLType|lcFirst}}Implementors = {{$object.Implementors}}
// nolint: gocyclo, errcheck, gas, goconst
{{- if .Stream }}
func (ec *executionContext) _{{$object.GQLType}}(ctx context.Context, sel []query.Selection) func() graphql.Marshaler {
fields := graphql.CollectFields(ec.Doc, sel, {{$object.GQLType|lcFirst}}Implementors, ec.Variables)
reqctx := graphql.GetRequestContext(ctx)
fields := graphql.CollectFields(reqctx, sel, {{$object.GQLType|lcFirst}}Implementors, ec.Variables)
ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{
Object: {{$object.GQLType|quote}},
})
Expand All @@ -25,7 +26,8 @@ func (ec *executionContext) _{{$object.GQLType}}(ctx context.Context, sel []quer
}
{{- else }}
func (ec *executionContext) _{{$object.GQLType}}(ctx context.Context, sel []query.Selection{{if not $object.Root}}, obj *{{$object.FullName}} {{end}}) graphql.Marshaler {
fields := graphql.CollectFields(ec.Doc, sel, {{$object.GQLType|lcFirst}}Implementors, ec.Variables)
reqctx := graphql.GetRequestContext(ctx)
fields := graphql.CollectFields(reqctx, sel, {{$object.GQLType|lcFirst}}Implementors, ec.Variables)
{{if $object.Root}}
ctx = graphql.WithResolverContext(ctx, &graphql.ResolverContext{
Object: {{$object.GQLType|quote}},
Expand Down
33 changes: 22 additions & 11 deletions example/chat/generated.go

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

33 changes: 22 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