server

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func RunServer

func RunServer() *httptest.Server

Types

type Animal

type Animal struct {
	ID      string      `json:"id"`
	Name    string      `json:"name"`
	Species Species     `json:"species"`
	Owner   Being       `json:"owner"`
	Hair    *BeingsHair `json:"hair"`
}

func (Animal) IsBeing

func (Animal) IsBeing()

type Being

type Being interface {
	IsBeing()
}

type BeingsHair

type BeingsHair struct {
	HasHair bool `json:"hasHair"`
}

type ComplexityRoot

type ComplexityRoot struct {
	Animal struct {
		Hair    func(childComplexity int) int
		ID      func(childComplexity int) int
		Name    func(childComplexity int) int
		Owner   func(childComplexity int) int
		Species func(childComplexity int) int
	}

	BeingsHair struct {
		HasHair func(childComplexity int) int
	}

	Hair struct {
		Color func(childComplexity int) int
	}

	Mutation struct {
		CreateUser func(childComplexity int, input NewUser) int
	}

	Query struct {
		Being            func(childComplexity int, id string) int
		Beings           func(childComplexity int, ids []string) int
		Fail             func(childComplexity int) int
		LotteryWinner    func(childComplexity int, number int) int
		Me               func(childComplexity int) int
		User             func(childComplexity int, id *string) int
		UserSearch       func(childComplexity int, birthdate *string, id *string) int
		UsersBornOn      func(childComplexity int, date string) int
		UsersBornOnDates func(childComplexity int, dates []string) int
	}

	User struct {
		Birthdate   func(childComplexity int) int
		Friends     func(childComplexity int) int
		Hair        func(childComplexity int) int
		ID          func(childComplexity int) int
		LuckyNumber func(childComplexity int) int
		Name        func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type Hair

type Hair struct {
	Color *string `json:"color"`
}

type Lucky

type Lucky interface {
	IsLucky()
}

type MutationResolver

type MutationResolver interface {
	CreateUser(ctx context.Context, input NewUser) (*User, error)
}

type NewUser

type NewUser struct {
	Name string `json:"name"`
}

type QueryResolver

type QueryResolver interface {
	Me(ctx context.Context) (*User, error)
	User(ctx context.Context, id *string) (*User, error)
	Being(ctx context.Context, id string) (Being, error)
	Beings(ctx context.Context, ids []string) ([]Being, error)
	LotteryWinner(ctx context.Context, number int) (Lucky, error)
	UsersBornOn(ctx context.Context, date string) ([]*User, error)
	UsersBornOnDates(ctx context.Context, dates []string) ([]*User, error)
	UserSearch(ctx context.Context, birthdate *string, id *string) ([]*User, error)
	Fail(ctx context.Context) (*bool, error)
}

type ResolverRoot

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

type Species

type Species string
const (
	SpeciesDog        Species = "DOG"
	SpeciesCoelacanth Species = "COELACANTH"
)

func (Species) IsValid

func (e Species) IsValid() bool

func (Species) MarshalGQL

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

func (Species) String

func (e Species) String() string

func (*Species) UnmarshalGQL

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

type User

type User struct {
	ID          string  `json:"id"`
	Name        string  `json:"name"`
	LuckyNumber *int    `json:"luckyNumber"`
	Hair        *Hair   `json:"hair"`
	Birthdate   *string `json:"birthdate"`
	Friends     []*User `json:"friends"`
}

func (User) IsBeing

func (User) IsBeing()

func (User) IsLucky

func (User) IsLucky()

Jump to

Keyboard shortcuts

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