graphql

package
v0.0.0-...-b6d7c9a Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

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 {
	Mutation struct {
		CreateTodo func(childComplexity int, title string, description *string, userID string) int
		CreateUser func(childComplexity int, username string, email string) int
	}

	Query struct {
		ListTodos func(childComplexity int) int
		ListUsers func(childComplexity int) int
	}

	Todo struct {
		Description func(childComplexity int) int
		Id          func(childComplexity int) int
		Title       func(childComplexity int) int
		User        func(childComplexity int) int
	}

	User struct {
		Email    func(childComplexity int) int
		Id       func(childComplexity int) int
		Name     func(childComplexity int) int
		Username 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 {
	CreateUser(ctx context.Context, username string, email string) (*models.User, error)
	CreateTodo(ctx context.Context, title string, description *string, userID string) (*models.Todo, error)
}

type QueryResolver

type QueryResolver interface {
	ListUsers(ctx context.Context) ([]*models.User, error)
	ListTodos(ctx context.Context) ([]*models.Todo, error)
}

type Resolver

type Resolver struct {
	Users []*models.User
	Todos []*models.Todo
}

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
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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