server

package
v0.0.0-...-78b4d84 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 22 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.

func NewGraphQLServer

func NewGraphQLServer(redisURL string) (*graphQLServer, error)

Types

type ComplexityRoot

type ComplexityRoot struct {
	Message struct {
		CreatedAt func(childComplexity int) int
		ID        func(childComplexity int) int
		Text      func(childComplexity int) int
		User      func(childComplexity int) int
	}

	Mutation struct {
		PostMessage func(childComplexity int, user string, text string) int
	}

	Query struct {
		Messages func(childComplexity int) int
		Users    func(childComplexity int) int
	}

	Subscription struct {
		MessagePosted func(childComplexity int, user string) int
		UserJoined    func(childComplexity int, user string) 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 Message

type Message struct {
	ID        string    `json:"id"`
	User      string    `json:"user"`
	CreatedAt time.Time `json:"createdAt"`
	Text      string    `json:"text"`
}

type MutationResolver

type MutationResolver interface {
	PostMessage(ctx context.Context, user string, text string) (*Message, error)
}

type QueryResolver

type QueryResolver interface {
	Messages(ctx context.Context) ([]*Message, error)
	Users(ctx context.Context) ([]string, error)
}

type ResolverRoot

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

type SubscriptionResolver

type SubscriptionResolver interface {
	MessagePosted(ctx context.Context, user string) (<-chan *Message, error)
	UserJoined(ctx context.Context, user string) (<-chan string, error)
}

Jump to

Keyboard shortcuts

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