graphql

package
v0.0.0-...-6b0313b Latest Latest
Warning

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

Go to latest
Published: May 7, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Handle

func Handle(ctx context.Context, schema Schema, playground http.Handler, w http.ResponseWriter, r *http.Request)

func Handler

func Handler(schema Schema, playground http.Handler) http.Handler

func MustType

func MustType(o reflect.Type) graphql.Output

func RegisterEnum

func RegisterEnum(o reflect.Type, name string, fields ...interface{})

func RegisterType

func RegisterType(o reflect.Type, v Output)

Types

type Error

type Error struct {
	Message    string                 `json:"message"`
	Locations  []ErrorLocation        `json:"locations,omitempty"`
	Path       []interface{}          `json:"path,omitempty"`
	Extensions map[string]interface{} `json:"extensions,omitempty"`
	Err        error                  `json:"-"`
}

func NewError

func NewError(err error) Error

func (Error) Error

func (e Error) Error() string

func (Error) Unwrap

func (e Error) Unwrap() error

type ErrorLocation

type ErrorLocation struct {
	Line   int `json:"line"`
	Column int `json:"column"`
}

type Extension

type Extension interface{}

func Tracing

func Tracing() Extension

type GraphiQL

type GraphiQL struct {
	URL             string
	SubscriptionURL string
}

func (GraphiQL) ServeHTTP

func (h GraphiQL) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ID

type ID string

type Meta

type Meta string

type Number

type Number json.Number

type Output

type Output graphql.Output

func Type

func Type(o reflect.Type) (Output, error)

type PageInfo

type PageInfo struct {
	HasPreviousPage bool   `graphql:"hasPreviousPage,nonnull"`
	HasNextPage     bool   `graphql:"hasNextPage,nonnull"`
	StartCursor     string `graphql:"startCursor"`
	EndCursor       string `graphql:"endCursor"`
}

type Params

type Params struct {
	Query         string                 `json:"query"`
	OperationName string                 `json:"operationName"`
	Variables     map[string]interface{} `json:"variables"`
	Extensions    map[string]interface{} `json:"extensions"`
}

type PersistedQuery

type PersistedQuery struct {
	Store    sync.Map // map[hex encoded hash string]query string
	Required bool
	Readonly bool
}

func (*PersistedQuery) PreParse

func (e *PersistedQuery) PreParse(ctx context.Context, params *Params) error

type Result

type Result struct {
	Data       interface{}            `json:"data"`
	Errors     []Error                `json:"errors,omitempty"`
	Extensions map[string]interface{} `json:"extensions,omitempty"`
}

type Schema

type Schema struct {
	Schema     graphql.Schema
	Extensions []Extension
}

func NewSchema

func NewSchema(query, mutation, subscription interface{}) (Schema, error)

func (Schema) Do

func (s Schema) Do(ctx context.Context, params Params) Result

func (Schema) Subscribe

func (s Schema) Subscribe(ctx context.Context, params Params) <-chan Result

Jump to

Keyboard shortcuts

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