Documentation
¶
Index ¶
- func AuthDirective(ctx context.Context, next func(ctx context.Context) (interface{}, error)) (interface{}, error)
- func LoadSchema(dir string, resolver interface{}, opts ...graphql.SchemaOpt) (*graphql.Schema, error)
- func NewDataLoader[K comparable, V any](batchFn dataloader.BatchFunc[K, V]) *dataloader.Loader[K, V]
- func PlaygroundHandler(endpoint string) http.HandlerFunc
- type BatchResult
- type DateTime
- type Directive
- type Handler
- type JSON
- type UUID
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthDirective ¶
func AuthDirective(ctx context.Context, next func(ctx context.Context) (interface{}, error)) (interface{}, error)
AuthDirective implements the @auth directive. It checks if a user is authenticated in the context.
func LoadSchema ¶
func LoadSchema(dir string, resolver interface{}, opts ...graphql.SchemaOpt) (*graphql.Schema, error)
LoadSchema reads all .graphql files in a directory and parses them into a Schema.
func NewDataLoader ¶
func NewDataLoader[K comparable, V any](batchFn dataloader.BatchFunc[K, V]) *dataloader.Loader[K, V]
NewDataLoader creates a new dataloader with default settings.
func PlaygroundHandler ¶
func PlaygroundHandler(endpoint string) http.HandlerFunc
PlaygroundHandler returns an http.Handler that renders the GraphiQL playground.
Types ¶
type BatchResult ¶
BatchResult is a helper to wrap values and errors for Dataloader.
type DateTime ¶
DateTime is a custom scalar for time.Time values in GraphQL.
func (DateTime) ImplementsGraphQLType ¶
ImplementsGraphQLType maps this Go type to the GraphQL scalar type.
func (DateTime) MarshalJSON ¶
MarshalJSON serializes a DateTime to JSON as an RFC3339 string.
func (*DateTime) UnmarshalGraphQL ¶
UnmarshalGraphQL parses a DateTime from an input value.
type Directive ¶
type Directive func(ctx context.Context, next func(ctx context.Context) (interface{}, error)) (interface{}, error)
Directive is a function that can wrap a resolver execution.
type Handler ¶
Handler implements http.Handler for executing GraphQL queries.
func NewHandler ¶
NewHandler creates a new GraphQL handler.
type JSON ¶
type JSON struct {
Value any
}
JSON is a custom scalar for arbitrary JSON values in GraphQL.
func (JSON) ImplementsGraphQLType ¶
ImplementsGraphQLType maps this Go type to the GraphQL scalar type.
func (JSON) MarshalJSON ¶
MarshalJSON serializes the JSON scalar to JSON.
func (*JSON) UnmarshalGraphQL ¶
UnmarshalGraphQL parses a JSON value from an input.
type UUID ¶
UUID is a custom scalar for uuid.UUID values in GraphQL.
func (UUID) ImplementsGraphQLType ¶
ImplementsGraphQLType maps this Go type to the GraphQL scalar type.
func (UUID) MarshalJSON ¶
MarshalJSON serializes a UUID to JSON.
func (*UUID) UnmarshalGraphQL ¶
UnmarshalGraphQL parses a UUID from an input value.