schema

package
v0.0.0-...-558fac8 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AllActions = []Actions{
	ActionsAdd,
	ActionsRemove,
}

Functions

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

Types

type Actions

type Actions string
const (
	ActionsAdd    Actions = "Add"
	ActionsRemove Actions = "Remove"
)

func (Actions) IsValid

func (e Actions) IsValid() bool

func (Actions) MarshalGQL

func (e Actions) MarshalGQL(w io.Writer)

func (Actions) String

func (e Actions) String() string

func (*Actions) UnmarshalGQL

func (e *Actions) UnmarshalGQL(v interface{}) error

type ComplexityRoot

type ComplexityRoot struct {
	Info struct {
		Address func(childComplexity int) int
		Hours   func(childComplexity int) int
	}

	Item struct {
		Action    func(childComplexity int) int
		CreatedAt func(childComplexity int) int
		ItemType  func(childComplexity int) int
		Name      func(childComplexity int) int
	}

	Mutation struct {
		MutateItem func(childComplexity int, itemType ItemTypes, name string, action Actions) int
		UpdateInfo func(childComplexity int, hours string, address string) int
	}

	Query struct {
		AllInfo func(childComplexity int) int
		Items   func(childComplexity int) int
	}

	Subscription struct {
		InfoChanged func(childComplexity int) int
		ItemChanged func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
	Deprecated func(ctx context.Context, obj interface{}, next graphql.Resolver, reason *string) (res interface{}, err error)
	Include    func(ctx context.Context, obj interface{}, next graphql.Resolver, ifArg bool) (res interface{}, err error)
	Skip       func(ctx context.Context, obj interface{}, next graphql.Resolver, ifArg bool) (res interface{}, err error)
}

type Info

type Info struct {
	Address string `json:"address"`
	Hours   string `json:"hours"`
}

type Item

type Item struct {
	ItemType  ItemTypes `json:"itemType"`
	Name      string    `json:"name"`
	Action    Actions   `json:"action"`
	CreatedAt time.Time `json:"createdAt"`
}

type ItemTypes

type ItemTypes string
const (
	ItemTypesAppetizer ItemTypes = "Appetizer"
	ItemTypesEntree    ItemTypes = "Entree"
	ItemTypesDessert   ItemTypes = "Dessert"
)

func (ItemTypes) IsValid

func (e ItemTypes) IsValid() bool

func (ItemTypes) MarshalGQL

func (e ItemTypes) MarshalGQL(w io.Writer)

func (ItemTypes) String

func (e ItemTypes) String() string

func (*ItemTypes) UnmarshalGQL

func (e *ItemTypes) UnmarshalGQL(v interface{}) error

type MutationResolver

type MutationResolver interface {
	MutateItem(ctx context.Context, itemType ItemTypes, name string, action Actions) (*Item, error)
	UpdateInfo(ctx context.Context, hours string, address string) (*Info, error)
}

type QueryResolver

type QueryResolver interface {
	Items(ctx context.Context) ([]*Item, error)
	AllInfo(ctx context.Context) (*Info, error)
}

type ResolverRoot

type ResolverRoot interface {
	Mutation() MutationResolver
	Query() QueryResolver
	Subscription() SubscriptionResolver
}

type SubscriptionResolver

type SubscriptionResolver interface {
	ItemChanged(ctx context.Context) (<-chan *Item, error)
	InfoChanged(ctx context.Context) (<-chan *Info, error)
}

Jump to

Keyboard shortcuts

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