graph

package
v0.0.0-...-c55a17e Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2023 License: MIT Imports: 14 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 CategoryResolver

type CategoryResolver interface {
	Courses(ctx context.Context, obj *model.Category) ([]*model.Course, error)
}

type ComplexityRoot

type ComplexityRoot struct {
	Category struct {
		Courses     func(childComplexity int) int
		Description func(childComplexity int) int
		ID          func(childComplexity int) int
		Name        func(childComplexity int) int
	}

	Course struct {
		Category    func(childComplexity int) int
		Description func(childComplexity int) int
		ID          func(childComplexity int) int
		Name        func(childComplexity int) int
	}

	Mutation struct {
		CreateCategory func(childComplexity int, input model.NewCategory) int
		CreateCourse   func(childComplexity int, input model.NewCourse) int
	}

	Query struct {
		Categories func(childComplexity int) int
		Courses    func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type CourseResolver

type CourseResolver interface {
	Category(ctx context.Context, obj *model.Course) (*model.Category, error)
}

type DirectiveRoot

type DirectiveRoot struct {
}

type MutationResolver

type MutationResolver interface {
	CreateCategory(ctx context.Context, input model.NewCategory) (*model.Category, error)
	CreateCourse(ctx context.Context, input model.NewCourse) (*model.Course, error)
}

type QueryResolver

type QueryResolver interface {
	Categories(ctx context.Context) ([]*model.Category, error)
	Courses(ctx context.Context) ([]*model.Course, error)
}

type Resolver

type Resolver struct {
	CategoryDB *database.Category
	CourseDB   *database.Course
}

func (*Resolver) Category

func (r *Resolver) Category() CategoryResolver

Category returns CategoryResolver implementation.

func (*Resolver) Course

func (r *Resolver) Course() CourseResolver

Course returns CourseResolver implementation.

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

Mutation returns MutationResolver implementation.

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

Query returns QueryResolver implementation.

type ResolverRoot

type ResolverRoot interface {
	Category() CategoryResolver
	Course() CourseResolver
	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