Documentation ¶
Index ¶
- func NewExecutableSchema(cfg Config) graphql.ExecutableSchema
- type ChannelResolver
- type ChannelSliceLoader
- func (l *ChannelSliceLoader) Clear(key string)
- func (l *ChannelSliceLoader) Load(key string) ([]*models.Channel, error)
- func (l *ChannelSliceLoader) LoadAll(keys []string) ([][]*models.Channel, []error)
- func (l *ChannelSliceLoader) LoadAllThunk(keys []string) func() ([][]*models.Channel, []error)
- func (l *ChannelSliceLoader) LoadThunk(key string) func() ([]*models.Channel, error)
- func (l *ChannelSliceLoader) Prime(key string, value []*models.Channel) bool
- type ChannelSliceLoaderConfig
- type ComplexityRoot
- type Config
- type DirectiveRoot
- type ListenerResolver
- type MutationResolver
- type QueryResolver
- type ResolverRoot
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 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 MutationResolver ¶
type QueryResolver ¶
type ResolverRoot ¶
type ResolverRoot interface { Channel() ChannelResolver Listener() ListenerResolver Mutation() MutationResolver Query() QueryResolver }