gqlgo

package module
v0.0.0-...-df93e13 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2023 License: MIT Imports: 8 Imported by: 0

README

gqlgo

Golang's GraphQL for better DX

Documentation

Index

Constants

This section is empty.

Variables

Functions

func RelayIDFromObject

func RelayIDFromObject(object any, info graphql.ResolveInfo, ctx context.Context) (string, error)

Types

type Arg

type Arg struct {
	Type        Output
	Description string
	Default     any
}

type Args

type Args map[string]*Arg

type Config

type Config struct {
	IDFromObject IDFromObjectFn
}

type Field

type Field struct {
	Type        Output
	Description string
	Args        Args
	Resolve     FieldResolver
	Middlewares []FieldMiddlewareFn
}

type FieldMiddlewareFn

type FieldMiddlewareFn func(next FieldResolver) FieldResolver

type FieldResolver

type FieldResolver func(p ResolveParams) (any, error)

type Fields

type Fields map[string]*Field

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(schema Schema, opts ...HandlerOption) *Handler

func (*Handler) ServeHTTP

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

type HandlerBody

type HandlerBody struct {
	OperationName string         `json:"operationName"`
	Query         string         `json:"query"`
	Variables     map[string]any `json:"variables"`
}

type HandlerOption

type HandlerOption func(h *Handler)

func WithExplorer

func WithExplorer(explorer explorer.Explorer) HandlerOption

type IDFromObjectFn

type IDFromObjectFn func(object any, info graphql.ResolveInfo, ctx context.Context) (string, error)

type Input

type Input struct {
	Name        string
	Description string
	Args        Args
}

func (*Input) Output

func (i *Input) Output(s Schema) graphql.Output

type Modifier

type Modifier func(s Schema) graphql.Output

func List

func List(output Output) Modifier

func NotNull

func NotNull(output Output) Modifier

func (Modifier) Output

func (m Modifier) Output(s Schema) graphql.Output

type Output

type Output interface {
	Output(Schema) graphql.Output
}

type ResolveParams

type ResolveParams graphql.ResolveParams

type Scalar

type Scalar struct {
	// contains filtered or unexported fields
}

func FromGraphqlScalar

func FromGraphqlScalar(scalar *graphql.Scalar) *Scalar

func (*Scalar) Output

func (s *Scalar) Output(Schema) graphql.Output

type Schema

type Schema struct {
	Query    *Type
	Mutation *Type
	Config   Config
	// contains filtered or unexported fields
}

type Type

type Type struct {
	Name        string
	Description string
	Fields      Fields
}

func (*Type) Output

func (t *Type) Output(s Schema) graphql.Output

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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