Skip to content

Commit

Permalink
codegen: executableSchema schema configurable
Browse files Browse the repository at this point in the history
  • Loading branch information
gitxiongpan committed Sep 28, 2023
1 parent 2c9f9c5 commit ffd3e72
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions codegen/generated!.gotpl
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
// NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.
func NewExecutableSchema(cfg Config) graphql.ExecutableSchema {
return &executableSchema{
schema: cfg.Schema,
resolvers: cfg.Resolvers,
directives: cfg.Directives,
complexity: cfg.Complexity,
}
}

type Config struct {
Schema *ast.Schema
Resolvers ResolverRoot
Directives DirectiveRoot
Complexity ComplexityRoot
Expand Down Expand Up @@ -93,12 +95,16 @@

{{ if eq .Config.Exec.Layout "single-file" }}
type executableSchema struct {
schema *ast.Schema
resolvers ResolverRoot
directives DirectiveRoot
complexity ComplexityRoot
}

func (e *executableSchema) Schema() *ast.Schema {
if e.schema != nil {
return e.schema
}
return parsedSchema
}

Expand Down

0 comments on commit ffd3e72

Please sign in to comment.