loader

package
v0.0.0-...-87de96b Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2020 License: MIT Imports: 11 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

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

func LoadRole

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

func LoadUser

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

Types

type Cache

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

Cache implements the dataloader.Cache interface

func (*Cache) Clear

func (c *Cache) Clear()

Clear clears the cache

func (*Cache) Delete

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

Delete deletes and item in the cache

func (*Cache) Get

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

Get gets a value from the cache

func (*Cache) Set

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

Set sets a value in the cache

type Client

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

type Collection

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

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

func NewCollection

func NewCollection(client Client) Collection

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 (Collection) Attach

func (c Collection) Attach(ctx context.Context) context.Context

type ModuleLoader

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

type ModuleResult

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

type ModuleResults

type ModuleResults []ModuleResult

func LoadModules

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

func (ModuleResults) WithoutErrors

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

Jump to

Keyboard shortcuts

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