generated

package
v0.0.0-...-64253c3 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2020 License: MIT Imports: 12 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.

Types

type ChannelResolver

type ChannelResolver interface {
	ID(ctx context.Context, obj *models.Channel) (string, error)
}

type ChannelSliceLoader

type ChannelSliceLoader struct {
	// contains filtered or unexported fields
}

ChannelSliceLoader batches and caches requests

func NewChannelSliceLoader

func NewChannelSliceLoader(config ChannelSliceLoaderConfig) *ChannelSliceLoader

NewChannelSliceLoader creates a new ChannelSliceLoader given a fetch, wait, and maxBatch

func (*ChannelSliceLoader) Clear

func (l *ChannelSliceLoader) Clear(key string)

Clear the value at key from the cache, if it exists

func (*ChannelSliceLoader) Load

func (l *ChannelSliceLoader) Load(key string) ([]*models.Channel, error)

Load a Channel by key, batching and caching will be applied automatically

func (*ChannelSliceLoader) LoadAll

func (l *ChannelSliceLoader) LoadAll(keys []string) ([][]*models.Channel, []error)

LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured

func (*ChannelSliceLoader) LoadAllThunk

func (l *ChannelSliceLoader) LoadAllThunk(keys []string) func() ([][]*models.Channel, []error)

LoadAllThunk returns a function that when called will block waiting for a Channels. This method should be used if you want one goroutine to make requests to many different data loaders without blocking until the thunk is called.

func (*ChannelSliceLoader) LoadThunk

func (l *ChannelSliceLoader) LoadThunk(key string) func() ([]*models.Channel, error)

LoadThunk returns a function that when called will block waiting for a Channel. This method should be used if you want one goroutine to make requests to many different data loaders without blocking until the thunk is called.

func (*ChannelSliceLoader) Prime

func (l *ChannelSliceLoader) Prime(key string, value []*models.Channel) bool

Prime the cache with the provided key and value. If the key already exists, no change is made and false is returned. (To forcefully prime the cache, clear the key first with loader.clear(key).prime(key, value).)

type ChannelSliceLoaderConfig

type ChannelSliceLoaderConfig struct {
	// Fetch is a method that provides the data for the loader
	Fetch func(keys []string) ([][]*models.Channel, []error)

	// Wait is how long wait before sending a batch
	Wait time.Duration

	// MaxBatch will limit the maximum number of keys to send in one batch, 0 = not limit
	MaxBatch int
}

ChannelSliceLoaderConfig captures the config to create a new ChannelSliceLoader

type ComplexityRoot

type ComplexityRoot struct {
	Channel struct {
		CreatedAt func(childComplexity int) int
		ID        func(childComplexity int) int
		Name      func(childComplexity int) int
		UpdatedAt func(childComplexity int) int
	}

	Listener struct {
		CreatedAt func(childComplexity int) int
		Followed  func(childComplexity int) int
		ID        func(childComplexity int) int
		Name      func(childComplexity int) int
		UpdatedAt func(childComplexity int) int
	}

	Mutation struct {
		AddListener func(childComplexity int) int
	}

	Query struct {
		Listener func(childComplexity int, id string) int
		Liteners func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type ListenerResolver

type ListenerResolver interface {
	ID(ctx context.Context, obj *models.Listener) (string, error)

	Followed(ctx context.Context, obj *models.Listener) ([]*models.Channel, error)
}

type MutationResolver

type MutationResolver interface {
	AddListener(ctx context.Context) (*models.Listener, error)
}

type QueryResolver

type QueryResolver interface {
	Listener(ctx context.Context, id string) (*models.Listener, error)
	Liteners(ctx context.Context) ([]*models.Listener, error)
}

type ResolverRoot

type ResolverRoot interface {
	Channel() ChannelResolver
	Listener() ListenerResolver
	Mutation() MutationResolver
	Query() QueryResolver
}

Jump to

Keyboard shortcuts

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