Documentation
¶
Index ¶
- Constants
- func GetLoader[K comparable, T any](ctx context.Context, factory LoaderFactory[K, T]) *dataloader.Loader[K, T]
- func NewErrorPresenter(params ErrorPresenterParams) graphql.ErrorPresenterFunc
- func NewGraphqlServer(params ServerParams) *handler.Server
- func NewHandlerRoute(handler *handler.Server, config Config) (modulusHttp.RouteProvider, modulusHttp.RouteProvider)
- func NewManifesto() module.Manifesto
- func NewModule(options ...module.Option) *module.Module
- func NewPlaygroundHandlerRoute(config Config) modulusHttp.RouteProvider
- func OverrideErrorPresenter[T ErrorPresenterFactory](gqlModule *module.Module) *module.Module
- func WithLoaders(ctx context.Context, loaders *sync.Map) context.Context
- type Config
- type ErrorPresenterFactory
- type ErrorPresenterParams
- type LoaderFactory
- type LoadersInitializer
- func (LoadersInitializer) ExtensionName() string
- func (l LoadersInitializer) InterceptOperation(ctx context.Context, next graphql.OperationHandler) graphql.ResponseHandler
- func (l LoadersInitializer) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response
- func (LoadersInitializer) Validate(graphql.ExecutableSchema) error
- type PlaygroundConfig
- type ServerParams
Constants ¶
View Source
const (
LoadersKey contextKey = "Loaders"
)
Variables ¶
This section is empty.
Functions ¶
func GetLoader ¶
func GetLoader[K comparable, T any](ctx context.Context, factory LoaderFactory[K, T]) *dataloader.Loader[K, T]
func NewErrorPresenter ¶
func NewErrorPresenter(params ErrorPresenterParams) graphql.ErrorPresenterFunc
func NewGraphqlServer ¶
func NewGraphqlServer( params ServerParams, ) *handler.Server
func NewHandlerRoute ¶
func NewHandlerRoute(handler *handler.Server, config Config) (modulusHttp.RouteProvider, modulusHttp.RouteProvider)
func NewManifesto ¶
NewManifestModule creates a new graphql module with the manifest module.
func NewPlaygroundHandlerRoute ¶
func NewPlaygroundHandlerRoute(config Config) modulusHttp.RouteProvider
func OverrideErrorPresenter ¶
func OverrideErrorPresenter[T ErrorPresenterFactory](gqlModule *module.Module) *module.Module
OverrideErrorPresenter overrides the error presenter provider.
Types ¶
type Config ¶
type Config struct {
ComplexityLimit int `env:"GQL_COMPLEXITY_LIMIT, default=200"`
Path string `env:"GQL_API_URL, default=/graphql"`
IntrospectionEnabled bool `env:"GQL_INTROSPECTION_ENABLED, default=true"`
TracingEnabled bool `env:"GQL_TRACING_ENABLED, default=false"`
ReturnCause bool `env:"GQL_RETURN_CAUSE, default=false"`
Playground PlaygroundConfig
}
type ErrorPresenterFactory ¶
type ErrorPresenterFactory interface {
NewErrorPresenter() graphql.ErrorPresenterFunc
}
type ErrorPresenterParams ¶
type ErrorPresenterParams struct {
fx.In
ErrorPipeline *errhttp.ErrorPipeline `optional:"true"`
Config Config
}
type LoaderFactory ¶
type LoaderFactory[K comparable, T any] interface { Create() *dataloader.Loader[K, T] }
type LoadersInitializer ¶
type LoadersInitializer struct{}
func NewLoadersInitializer ¶
func NewLoadersInitializer() *LoadersInitializer
func (LoadersInitializer) ExtensionName ¶
func (LoadersInitializer) ExtensionName() string
func (LoadersInitializer) InterceptOperation ¶
func (l LoadersInitializer) InterceptOperation( ctx context.Context, next graphql.OperationHandler, ) graphql.ResponseHandler
InterceptOperation Init loaders before each operation
func (LoadersInitializer) InterceptResponse ¶
func (l LoadersInitializer) InterceptResponse(ctx context.Context, next graphql.ResponseHandler) *graphql.Response
InterceptResponse Init loaders before each event in subscription
func (LoadersInitializer) Validate ¶
func (LoadersInitializer) Validate(graphql.ExecutableSchema) error
type PlaygroundConfig ¶
type ServerParams ¶
type ServerParams struct {
fx.In
Config Config
Schema graphql.ExecutableSchema
LoadersInitializer *LoadersInitializer `optional:"true"`
Logger *slog.Logger
ErrorPresenter graphql.ErrorPresenterFunc
}
Click to show internal directories.
Click to hide internal directories.