server

package
v0.0.0-...-0456d28 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2024 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,omitempty"`
	Hair    *BeingsHair `json:"hair,omitempty"`
}

func (Animal) GetID

func (this Animal) GetID() string

func (Animal) GetName

func (this Animal) GetName() string

func (Animal) IsBeing

func (Animal) IsBeing()

type Being

type Being interface {
	IsBeing()
	GetID() string
	GetName() string
}

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,omitempty"`
}

type Lucky

type Lucky interface {
	IsLucky()
	GetLuckyNumber() *int
}

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,omitempty"`
	Hair        *Hair   `json:"hair,omitempty"`
	Birthdate   *string `json:"birthdate,omitempty"`
	Friends     []*User `json:"friends"`
}

func (User) GetID

func (this User) GetID() string

func (User) GetLuckyNumber

func (this User) GetLuckyNumber() *int

func (User) GetName

func (this User) GetName() string

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