graphql

package
v0.0.0-...-cae665e Latest Latest
Warning

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

Go to latest
Published: May 17, 2019 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeJSON               = "application/json"
	ContentTypeGraphQL            = "application/graphql"
	ContentTypeFormURLEncoded     = "application/x-www-form-urlencoded"
	ContentTypeMultiplartFormData = "multipart/form-data"
)

Variables

This section is empty.

Functions

func NewHandlerFunc

func NewHandlerFunc(config HandlerConfig) func(http.ResponseWriter, *http.Request)

NewHandler creates a WebSocket handler for GraphQL WebSocket connections. This handler takes a SubscriptionManager and adds/removes subscriptions as they are started/stopped by the client.

Types

type AuthenticateFunc

type AuthenticateFunc func(token string) (interface{}, error)

AuthenticateFunc is a function that resolves an auth token into a user (or returns an error if that isn't possible).

type Handler

type Handler struct {
	Schema *graphql.Schema
	// contains filtered or unexported fields
}

func (*Handler) ContextHandler

func (h *Handler) ContextHandler(w http.ResponseWriter, r *http.Request)

ContextHandler provides an entrypoint into executing graphQL queries with a user-provided context.

type HandlerConfig

type HandlerConfig struct {
	SubscriptionManager graphqlws.SubscriptionManager
	Authenticate        AuthenticateFunc
	Secret              string
	Schema              *graphql.Schema
	Context             context.Context
}

HandlerConfig stores the configuration of a GraphQL handler.

type Request

type Request struct {
	OperationName string                 `json:"operationName"`
	Query         string                 `json:"query"`
	Variables     map[string]interface{} `json:"variables"`
	Context       context.Context
}

type RequestOptions

type RequestOptions struct {
	Query         string                 `json:"query" url:"query" schema:"query"`
	Variables     map[string]interface{} `json:"variables" url:"variables" schema:"variables"`
	OperationName string                 `json:"operationName" url:"operationName" schema:"operationName"`
}

func NewRequestOptions

func NewRequestOptions(r *http.Request) *RequestOptions

NewRequestOptions Parses a http.Request into GraphQL request options struct

type ResultCallbackFn

type ResultCallbackFn func(ctx context.Context, params *graphql.Params, result *graphql.Result, responseBody []byte)

type RootObjectFn

type RootObjectFn func(ctx context.Context, r *http.Request) map[string]interface{}

RootObjectFn allows a user to generate a RootObject per request

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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