Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ASTLookup ¶
type ASTLookup interface {
LookupType(ast.Type) ast.TypeDefinition
}
ASTLookup must lookup types in the original schema.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model defines the linkage between a GraphQL schema and a codebase. Schema types are bound to Go types, for example:
- Object type bound to Go struct or interface type
- Array type bound to Go struct or channel type
- Any type bound to Go channel(s) indicating mutable real-time value
This representation yields Resolver implementations that emit Go code to resolve at runtime.
func BuildModel ¶
func BuildModel( rootSchema *ast.ObjectDefinition, astLookup ASTLookup, rootResolverType gtypes.Type, ) (*Model, error)
BuildModel computes the execution model from a schema and code sample.
func (*Model) GenerateResolverFile ¶
GenerateResolverFile generates the Go resolver file.
func (*Model) GetAllResolvers ¶
GetAllResolvers returns the list of all generated resolvers.
func (*Model) GetImportPaths ¶
GetImportPaths returns the import path list.
func (*Model) GetRootResolver ¶
GetRootResolver returns the root resolver reference.
type Resolver ¶
type Resolver interface { // GetName returns the resolver name. // This is typically the function name. GetName() string // GenerateGoASTDecls generates Go declarations to fulfill the resolver. GenerateGoASTDecls() ([]gast.Decl, error) // GenerateGoASTRef generates the Go statements to call the resolver. GenerateGoASTRef() ([]gast.Stmt, error) }
Resolver implements resolution of a piece of the schema with Go code.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.