schema

package
v0.0.0-...-3d9c2c9 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	HeadersContextKey = "Headers"
)

Variables

This section is empty.

Functions

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

Types

type ComplexityRoot

type ComplexityRoot struct {
	DistinguishingFeature struct {
		Description        func(childComplexity int) int
		SpottingDifficulty func(childComplexity int) int
	}

	Dog struct {
		DistinguishingFeatures func(childComplexity int) int
		ID                     func(childComplexity int) int
		Name                   func(childComplexity int) int
		OwnerID                func(childComplexity int) int
		TailLength             func(childComplexity int) int
	}

	Header struct {
		Name   func(childComplexity int) int
		Values func(childComplexity int) int
	}

	Human struct {
		Dogs func(childComplexity int) int
		ID   func(childComplexity int) int
		Name func(childComplexity int) int
	}

	Mutation struct {
		CreateDog       func(childComplexity int, humanID string, in DogInput) int
		CreateHuman     func(childComplexity int, in HumanInput) int
		ErrorsMutation  func(childComplexity int) int
		HeadersMutation func(childComplexity int) int
	}

	Query struct {
		Dog          func(childComplexity int, id string) int
		Dogs         func(childComplexity int) int
		ErrorsQuery  func(childComplexity int) int
		HeadersQuery func(childComplexity int) int
		Human        func(childComplexity int, id string) int
		Humans       func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type DistinguishingFeature

type DistinguishingFeature struct {
	Description        string   `json:"description"`
	SpottingDifficulty *float64 `json:"spottingDifficulty"`
}

type DistinguishingFeatureInput

type DistinguishingFeatureInput struct {
	Description        string   `json:"description"`
	SpottingDifficulty *float64 `json:"spottingDifficulty"`
}

type Dog

type Dog struct {
	ID                     string                   `json:"id"`
	Name                   string                   `json:"name"`
	OwnerID                string                   `json:"ownerId"`
	TailLength             *int                     `json:"tailLength"`
	DistinguishingFeatures []*DistinguishingFeature `json:"distinguishingFeatures"`
}

type DogInput

type DogInput struct {
	Name                   string                        `json:"name"`
	TailLength             *int                          `json:"tailLength"`
	DistinguishingFeatures []*DistinguishingFeatureInput `json:"distinguishingFeatures"`
}
type Header struct {
	Name   string    `json:"name"`
	Values []*string `json:"values"`
}

type Human

type Human struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Dogs []*Dog `json:"dogs"`
}

type HumanInput

type HumanInput struct {
	Name string      `json:"name"`
	Dogs []*DogInput `json:"dogs"`
}

type MutationResolver

type MutationResolver interface {
	CreateHuman(ctx context.Context, in HumanInput) (*Human, error)
	CreateDog(ctx context.Context, humanID string, in DogInput) (*Dog, error)
	HeadersMutation(ctx context.Context) ([]*Header, error)
	ErrorsMutation(ctx context.Context) (string, error)
}

type QueryResolver

type QueryResolver interface {
	Humans(ctx context.Context) ([]*Human, error)
	Human(ctx context.Context, id string) (*Human, error)
	Dogs(ctx context.Context) ([]*Dog, error)
	Dog(ctx context.Context, id string) (*Dog, error)
	HeadersQuery(ctx context.Context) ([]*Header, error)
	ErrorsQuery(ctx context.Context) (string, error)
}

type Resolver

type Resolver struct {
	HumansDb []*Human
	DogsDb   []*Dog
}

func (*Resolver) CreateDog

func (r *Resolver) CreateDog(ctx context.Context, humanID string, in DogInput) (*Dog, error)

func (*Resolver) CreateHuman

func (r *Resolver) CreateHuman(ctx context.Context, in HumanInput) (*Human, error)

func (*Resolver) Dog

func (r *Resolver) Dog(ctx context.Context, id string) (*Dog, error)

func (*Resolver) Dogs

func (r *Resolver) Dogs(ctx context.Context) ([]*Dog, error)

func (*Resolver) ErrorsMutation

func (r *Resolver) ErrorsMutation(ctx context.Context) (string, error)

func (*Resolver) ErrorsQuery

func (r *Resolver) ErrorsQuery(ctx context.Context) (string, error)

func (*Resolver) HeadersMutation

func (r *Resolver) HeadersMutation(ctx context.Context) ([]*Header, error)

func (*Resolver) HeadersQuery

func (r *Resolver) HeadersQuery(ctx context.Context) ([]*Header, error)

func (*Resolver) Human

func (r *Resolver) Human(ctx context.Context, id string) (*Human, error)

func (*Resolver) Humans

func (r *Resolver) Humans(ctx context.Context) ([]*Human, error)

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

func (*Resolver) ResetData

func (r *Resolver) ResetData()

type ResolverRoot

type ResolverRoot interface {
	Mutation() MutationResolver
	Query() QueryResolver
}

Jump to

Keyboard shortcuts

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