Documentation ¶
Index ¶
- Constants
- func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc
- func Playground(title string, endpoint string) http.HandlerFunc
- type Config
- type Option
- func CacheSize(size int) Option
- func ComplexityLimit(limit int) Option
- func ErrorPresenter(f graphql.ErrorPresenterFunc) Option
- func RecoverFunc(recover graphql.RecoverFunc) Option
- func RequestMiddleware(middleware graphql.RequestMiddleware) Option
- func ResolverMiddleware(middleware graphql.FieldMiddleware) Option
- func WebsocketUpgrader(upgrader websocket.Upgrader) Option
Constants ¶
const DefaultCacheSize = 1000
Variables ¶
This section is empty.
Functions ¶
func GraphQL ¶
func GraphQL(exec graphql.ExecutableSchema, options ...Option) http.HandlerFunc
func Playground ¶
func Playground(title string, endpoint string) http.HandlerFunc
Types ¶
type Option ¶
type Option func(cfg *Config)
func CacheSize ¶ added in v0.5.0
CacheSize sets the maximum size of the query cache. If size is less than or equal to 0, the cache is disabled.
func ComplexityLimit ¶ added in v0.5.0
ComplexityLimit sets a maximum query complexity that is allowed to be executed. If a query is submitted that exceeds the limit, a 422 status code will be returned.
func ErrorPresenter ¶
func ErrorPresenter(f graphql.ErrorPresenterFunc) Option
ErrorPresenter transforms errors found while resolving into errors that will be returned to the user. It provides a good place to add any extra fields, like error.type, that might be desired by your frontend. Check the default implementation in graphql.DefaultErrorPresenter for an example.
func RecoverFunc ¶
func RecoverFunc(recover graphql.RecoverFunc) Option
func RequestMiddleware ¶
func RequestMiddleware(middleware graphql.RequestMiddleware) Option
RequestMiddleware allows you to define a function that will be called around the root request, after the query has been parsed. This is useful for logging and tracing
func ResolverMiddleware ¶
func ResolverMiddleware(middleware graphql.FieldMiddleware) Option
ResolverMiddleware allows you to define a function that will be called around every resolver, useful for tracing and logging.