handler

package
v0.17.85 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2025 License: MIT Imports: 14 Imported by: 3,417

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldFunc

type FieldFunc func(ctx context.Context, next graphql.Resolver) (res any, err error)

func (FieldFunc) ExtensionName

func (f FieldFunc) ExtensionName() string

func (FieldFunc) InterceptField

func (f FieldFunc) InterceptField(ctx context.Context, next graphql.Resolver) (res any, err error)

func (FieldFunc) Validate

func (f FieldFunc) Validate(schema graphql.ExecutableSchema) error

type OperationFunc

type OperationFunc func(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler

func (OperationFunc) ExtensionName

func (r OperationFunc) ExtensionName() string

func (OperationFunc) InterceptOperation

func (r OperationFunc) InterceptOperation(
	ctx context.Context,
	next graphql.OperationHandler,
) graphql.ResponseHandler

func (OperationFunc) Validate

func (r OperationFunc) Validate(schema graphql.ExecutableSchema) error

type ResponseFunc

type ResponseFunc func(ctx context.Context, next graphql.ResponseHandler) *graphql.Response

func (ResponseFunc) ExtensionName

func (r ResponseFunc) ExtensionName() string

func (ResponseFunc) InterceptResponse

func (r ResponseFunc) InterceptResponse(
	ctx context.Context,
	next graphql.ResponseHandler,
) *graphql.Response

func (ResponseFunc) Validate

func (r ResponseFunc) Validate(schema graphql.ExecutableSchema) error

type Server

type Server struct {
	// contains filtered or unexported fields
}

func New

New returns a new Server for the given executable schema. The Server is not ready for use until the transports you require are added and configured with Server.AddTransport. See the implementation of NewDefaultServer for an example.

func NewDefaultServer deprecated

func NewDefaultServer(es graphql.ExecutableSchema) *Server

NewDefaultServer returns a Server for the given executable schema which is only suitable for use in examples.

Deprecated: The Server returned by NewDefaultServer is not suitable for production use. Use New instead and add transports configured for your use case, appropriate caches, and introspection if required. See the implementation of NewDefaultServer for an example of starting point to construct a Server.

SSE is not supported using this example. SSE when used over HTTP/1.1 (but not HTTP/2 or HTTP/3) suffers from a severe limitation to the maximum number of open connections of 6 per browser, see [Using server-sent events].

[Using server-sent events]: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events#sect1

func (*Server) AddTransport

func (s *Server) AddTransport(transport graphql.Transport)

AddTransport adds a transport to the Server. The server picks the first supported transport. Adding a transport which has already been added has no effect.

func (*Server) AroundFields

func (s *Server) AroundFields(f graphql.FieldMiddleware)

AroundFields is a convenience method for creating an extension that only implements field middleware

func (*Server) AroundOperations

func (s *Server) AroundOperations(f graphql.OperationMiddleware)

AroundOperations is a convenience method for creating an extension that only implements operation middleware

func (*Server) AroundResponses

func (s *Server) AroundResponses(f graphql.ResponseMiddleware)

AroundResponses is a convenience method for creating an extension that only implements response middleware

func (*Server) AroundRootFields added in v0.15.0

func (s *Server) AroundRootFields(f graphql.RootFieldMiddleware)

AroundRootFields is a convenience method for creating an extension that only implements field middleware

func (*Server) ServeHTTP

func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request)

func (*Server) SetDisableSuggestion added in v0.17.58

func (s *Server) SetDisableSuggestion(value bool)

func (*Server) SetErrorPresenter

func (s *Server) SetErrorPresenter(f graphql.ErrorPresenterFunc)

func (*Server) SetParserTokenLimit added in v0.17.49

func (s *Server) SetParserTokenLimit(limit int)

func (*Server) SetQueryCache

func (s *Server) SetQueryCache(cache graphql.Cache[*ast.QueryDocument])

func (*Server) SetRecoverFunc

func (s *Server) SetRecoverFunc(f graphql.RecoverFunc)

func (*Server) SetValidationRulesFn added in v0.17.79

func (s *Server) SetValidationRulesFn(f func() *rules.Rules)

SetValidationRulesFn is to customize the Default GraphQL Validation Rules

func (*Server) Use

func (s *Server) Use(extension graphql.HandlerExtension)

Use adds the given extension middleware to the server. Extensions are run in order from first to last added.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL