graphdata

package
v0.0.0-...-d724b4b Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2021 License: MIT Imports: 11 Imported by: 1

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 {
		CreateEdge func(childComplexity int, edge NewEdge) int
		CreateNode func(childComplexity int, node NewNode) int
	}

	Node struct {
		Children func(childComplexity int) int
		ID       func(childComplexity int) int
		Parent   func(childComplexity int) int
	}

	Query struct {
		Get  func(childComplexity int, id string) int
		List func(childComplexity int, skip *int, take *int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type MutationResolver

type MutationResolver interface {
	CreateNode(ctx context.Context, node NewNode) (string, error)
	CreateEdge(ctx context.Context, edge NewEdge) (string, error)
}

type NewEdge

type NewEdge struct {
	Parent string `json:"parent"`
	Child  string `json:"child"`
}

type NewNode

type NewNode struct {
	ID     string  `json:"id"`
	Parent *string `json:"parent"`
}

type NodeResolver

type NodeResolver interface {
	Parent(ctx context.Context, obj *graphstore.Node) (*graphstore.Node, error)
	Children(ctx context.Context, obj *graphstore.Node) ([]graphstore.Node, error)
}

type QueryResolver

type QueryResolver interface {
	List(ctx context.Context, skip *int, take *int) ([]graphstore.Node, error)
	Get(ctx context.Context, id string) (*graphstore.Node, error)
}

type Resolver

type Resolver struct {
	Store *graphstore.Store
}

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

func (*Resolver) Node

func (r *Resolver) Node() NodeResolver

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

type ResolverRoot

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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