graph

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2021 License: Unlicense Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	TodoA = &Todo{
		ID:   "0be25fcf-20e6-4a6d-b0f9-7804224ef20e",
		Text: "Todo A",
		Done: false,
		User: &User{
			ID:   "123",
			Name: "Name A",
		},
	}

	TodoB = &Todo{
		ID:   "53314dfd-35a8-4665-b528-20d06ba549be",
		Text: "Todo B",
		Done: false,
		User: &User{
			ID:   "456",
			Name: "Name B",
		},
	}

	TodoC = &Todo{
		ID:   "bb5893c7-eb8d-496b-ae36-6002bbe50b7e",
		Text: "Todo C",
		Done: false,
		User: &User{
			ID:   "789",
			Name: "Name C",
		},
	}
)

Functions

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

Types

type ComplexityRoot

type ComplexityRoot struct {
	Mutation struct {
		CreateTodo func(childComplexity int, input NewTodo) int
	}

	Query struct {
		Todos func(childComplexity int) int
	}

	Todo struct {
		Done func(childComplexity int) int
		ID   func(childComplexity int) int
		Text func(childComplexity int) int
		User func(childComplexity int) int
	}

	User struct {
		ID   func(childComplexity int) int
		Name func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type MutationResolver

type MutationResolver interface {
	CreateTodo(ctx context.Context, input NewTodo) (*Todo, error)
}

type NewTodo

type NewTodo struct {
	Text   string `json:"text"`
	UserID string `json:"userId"`
}

type QueryResolver

type QueryResolver interface {
	Todos(ctx context.Context) ([]*Todo, error)
}

type Resolver

type Resolver struct{}

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

type ResolverRoot

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

type Todo

type Todo struct {
	ID   string `json:"id"`
	Text string `json:"text"`
	Done bool   `json:"done"`
	User *User  `json:"user"`
}

type User

type User struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

Jump to

Keyboard shortcuts

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