Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EnsureAuthenticated ¶
This is a bit of a hack workaround to make the `middleware.GetClaimsFromContext` function return an error, to gracefully handle situations where no auth claims were injected by any middleware. This change is necessary because the GraphQL middleware does not prevent requests from reaching the resolvers if no token is present, so they could panic with an unhelpful error message if they tried to call the standard function
Types ¶
type GraphQLTracer ¶
type GraphQLTracer interface { graphql.HandlerExtension graphql.FieldInterceptor graphql.ResponseInterceptor }
func NewGraphQLTracer ¶
func NewGraphQLTracer() GraphQLTracer
Creates a GraphQL tracing extension that can be used with a gqlgen server like this (you will need to prepend NewGraphQLTracer with whatever package prefix you assign it in the import statement)
graphqlSrv := handler.NewDefaultServer(generated.NewExecutableSchema(generated.Config{ Resolvers: &graph.Resolver{}, })) graphqlSrv.Use(NewGraphQLTracer())
Click to show internal directories.
Click to hide internal directories.