Forge
1.x
Docs/Forge/Functions
Open

Reading1 min
Updated31 Jul 2026
Sourcev1/extensions/graphql/functions.mdx

Extension Entry Points01

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 -- Schema02

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 -- Execution03

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

GraphQL Interface -- Lifecycle04

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

GraphQL Interface -- Stats05

MethodDescription
Stats() ServerStatsGet server statistics

Key Types06

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)