src

package
v0.0.0-...-b1d6434 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 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 {
		CreateDraft func(childComplexity int, input *CreateDraftInput) int
		DeletePost  func(childComplexity int, input *DeletePostInput) int
		Publish     func(childComplexity int, input *PublishInput) int
	}

	Post struct {
		AuthorID    func(childComplexity int) int
		Content     func(childComplexity int) int
		CreatedAt   func(childComplexity int) int
		ID          func(childComplexity int) int
		IsPublished func(childComplexity int) int
		Title       func(childComplexity int) int
		UpdatedAt   func(childComplexity int) int
	}

	Query struct {
		Drafts func(childComplexity int) int
		Feed   func(childComplexity int) int
		Post   func(childComplexity int, id string) int
	}

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

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type CreateDraftInput

type CreateDraftInput struct {
	Title       string `json:"title"`
	Content     string `json:"content"`
	AuthorEmail string `json:"authorEmail"`
}

type DeletePostInput

type DeletePostInput struct {
	ID string `json:"id"`
}

type DirectiveRoot

type DirectiveRoot struct {
}

type MutationResolver

type MutationResolver interface {
	CreateDraft(ctx context.Context, input *CreateDraftInput) (*models.Post, error)
	DeletePost(ctx context.Context, input *DeletePostInput) (*models.Post, error)
	Publish(ctx context.Context, input *PublishInput) (*models.Post, error)
}

type PublishInput

type PublishInput struct {
	ID string `json:"id"`
}

type QueryResolver

type QueryResolver interface {
	Feed(ctx context.Context) ([]*models.Post, error)
	Drafts(ctx context.Context) ([]*models.Post, error)
	Post(ctx context.Context, id string) (*models.Post, 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
}

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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