graph

package
v0.0.0-...-dc6aef0 Latest Latest
Warning

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

Go to latest
Published: Dec 5, 2019 License: MIT Imports: 12 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 App

type App struct {
	Path  string
	Store *data.Store
}

func NewApp

func NewApp(path string) *App

func (*App) Book

func (a *App) Book() BookResolver

func (*App) Chapter

func (a *App) Chapter() ChapterResolver

func (*App) Mutation

func (a *App) Mutation() MutationResolver

func (*App) Query

func (a *App) Query() QueryResolver

type BookInput

type BookInput struct {
	Title            *string  `json:"title"`
	Authors          []string `json:"authors"`
	URL              *string  `json:"url"`
	Isbn             *string  `json:"isbn"`
	ImageURLTemplate *string  `json:"imageUrlTemplate"`
}

type BookResolver

type BookResolver interface {
	Chapters(ctx context.Context, obj *data.Book) ([]*data.Chapter, error)
}

type ChapterResolver

type ChapterResolver interface {
	Pages(ctx context.Context, obj *data.Chapter) ([]*data.Page, error)
}

type ComplexityRoot

type ComplexityRoot struct {
	Book struct {
		Authors          func(childComplexity int) int
		Chapters         func(childComplexity int) int
		ISBN             func(childComplexity int) int
		ImageURLTemplate func(childComplexity int) int
		Slug             func(childComplexity int) int
		Title            func(childComplexity int) int
		URL              func(childComplexity int) int
	}

	Chapter struct {
		FirstPage func(childComplexity int) int
		ID        func(childComplexity int) int
		LastPage  func(childComplexity int) int
		Number    func(childComplexity int) int
		Pages     func(childComplexity int) int
		Subtitle  func(childComplexity int) int
		Title     func(childComplexity int) int
	}

	Mutation struct {
		CreateBook func(childComplexity int, slug string, book BookInput) int
		UpdateBook func(childComplexity int, slug string, book BookInput) int
	}

	Page struct {
		ActualNumber  func(childComplexity int) int
		ID            func(childComplexity int) int
		VisibleNumber func(childComplexity int) int
	}

	Query struct {
		Book  func(childComplexity int, slug string) int
		Books 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 {
	CreateBook(ctx context.Context, slug string, book BookInput) (*data.Book, error)
	UpdateBook(ctx context.Context, slug string, book BookInput) (*data.Book, error)
}

type QueryResolver

type QueryResolver interface {
	Books(ctx context.Context) ([]*data.Book, error)
	Book(ctx context.Context, slug string) (*data.Book, error)
}

type ResolverRoot

type ResolverRoot interface {
	Book() BookResolver
	Chapter() ChapterResolver
	Mutation() MutationResolver
	Query() QueryResolver
}

Jump to

Keyboard shortcuts

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