loader

package
v0.0.0-...-9a7bc8d Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadApp

func LoadApp(ctx context.Context, key string) (*pb.AppInfo, error)

LoadApp Data

func LoadApps

func LoadApps(ctx context.Context, keys []string) ([]*pb.AppInfo, error)

LoadApps Data

func LoadGroup

func LoadGroup(ctx context.Context, key string) (*pb.GroupInfo, error)

LoadGroup Data

func LoadGroups

func LoadGroups(ctx context.Context, keys []string) ([]*pb.GroupInfo, error)

LoadGroups Data

func LoadOrg

func LoadOrg(ctx context.Context, key string) (*pb.OrgInfo, error)

LoadOrg Data

func LoadOrgs

func LoadOrgs(ctx context.Context, keys []string) ([]*pb.OrgInfo, error)

LoadOrgs Data

func LoadUser

func LoadUser(ctx context.Context, key string) (*pb.UserInfo, error)

LoadUser Data

func LoadUsers

func LoadUsers(ctx context.Context, keys []string) ([]*pb.UserInfo, error)

LoadUsers Data

Types

type Collection

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

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

func Initialize

func Initialize(service *client.MicroClient) 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

Attach creates new instances of dataloader.Loader and attaches the instances on the request context. We do this because the dataloader has an in-memory cache that is scoped to the request.

Jump to

Keyboard shortcuts

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