loader

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 27, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadConf

func LoadConf(ctx context.Context, key string) (*model.Configuration, error)

func LoadModule added in v0.1.11

func LoadModule(ctx context.Context, name string) (*model.Module, error)

func LoadRole

func LoadRole(ctx context.Context, key string) (*model.Role, error)

func LoadUser

func LoadUser(ctx context.Context, key string) (*model.User, error)

Types

type Cache added in v0.1.11

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

Cache implements the dataloader.Cache interface

func (*Cache) Clear added in v0.1.11

func (c *Cache) Clear()

Clear clears the cache

func (*Cache) Delete added in v0.1.11

func (c *Cache) Delete(_ context.Context, key dataloader.Key) bool

Delete deletes and item in the cache

func (*Cache) Get added in v0.1.11

func (c *Cache) Get(_ context.Context, key dataloader.Key) (dataloader.Thunk, bool)

Get gets a value from the cache

func (*Cache) Set added in v0.1.11

func (c *Cache) Set(_ context.Context, key dataloader.Key, value dataloader.Thunk)

Set sets a value in the cache

type Client added in v0.1.11

type Client interface {
	// contains filtered or unexported methods
}

type LoaderCollection

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

Collection holds an internal lookup of initialized batch data load functions.

func NewLoaderCollection

func NewLoaderCollection(client Client) LoaderCollection

Initialize a lookup map of context keys to batch functions.

When Attach is called on the Collection, the batch functions are used to create new dataloader instances. The instances are attached to the request context at the provided keys.

The keys are then used to extract the dataloader instances from the request context.

func (LoaderCollection) Attach

type ModuleLoader added in v0.1.11

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

type ModuleResult added in v0.1.11

type ModuleResult struct {
	Module *model.Module
	Error  error
}

type ModuleResults added in v0.1.11

type ModuleResults []ModuleResult

func LoadModules added in v0.1.11

func LoadModules(ctx context.Context, names []string) (ModuleResults, error)

func (ModuleResults) WithoutErrors added in v0.1.11

func (results ModuleResults) WithoutErrors() []*model.Module

Jump to

Keyboard shortcuts

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