GraphQL

Functions

Public API reference for the GraphQL extension

Extension Entry Points

FunctionDescription
NewExtension(opts ...ConfigOption) forge.ExtensionCreate the GraphQL extension with functional options
NewExtensionWithConfig(config Config) forge.ExtensionCreate the GraphQL extension with a complete config
DefaultConfig() ConfigReturns the default configuration

GraphQL Interface -- Schema

MethodDescription
RegisterQuery(name, resolver, config) errorRegister a query field resolver
RegisterMutation(name, resolver, config) errorRegister a mutation field resolver
RegisterSubscription(name, resolver, config) errorRegister a subscription resolver
RegisterType(name, definition) errorRegister a custom type definition
GetSchema() *GraphQLSchemaGet the current schema

GraphQL Interface -- Execution

MethodDescription
Execute(ctx, request) (*Response, error)Execute a GraphQL request
Use(middleware...)Add executor middleware

GraphQL Interface -- Lifecycle

MethodDescription
Start(ctx) errorInitialize the GraphQL server
Stop(ctx) errorShut down the server
Health(ctx) errorCheck server health

GraphQL Interface -- Stats

MethodDescription
Stats() ServerStatsGet server statistics

Key Types

Request

FieldTypePurpose
QuerystringGraphQL query string
OperationNamestringOperation name for multi-operation documents
Variablesmap[string]anyQuery variables

Response

FieldTypePurpose
DataanyQuery result data
Errors[]ErrorExecution errors
Extensionsmap[string]anyResponse extensions (timing, tracing)

How is this guide?

On this page