graph

package
v0.0.0-...-11ce410 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnsureAuthenticated

func EnsureAuthenticated(ctx context.Context) (c auth.Claim, e error)

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

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())

Jump to

Keyboard shortcuts

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