Documentation ¶
Index ¶
- func GetTeamById(ctx context.Context, id string) (*uac.Team, error)
- func GetUserById(ctx context.Context, id string) (*ai_verta_uac.UserInfo, error)
- func TeamDataloaderMiddleware(conn *connections.Connections) func(httprouter.Handle) httprouter.Handle
- func UserDataloaderMiddleware(conn *connections.Connections) func(httprouter.Handle) httprouter.Handle
- type TeamLoader
- func (l *TeamLoader) Clear(key string)
- func (l *TeamLoader) Load(key string) (*uac.Team, error)
- func (l *TeamLoader) LoadAll(keys []string) ([]*uac.Team, []error)
- func (l *TeamLoader) LoadAllThunk(keys []string) func() ([]*uac.Team, []error)
- func (l *TeamLoader) LoadThunk(key string) func() (*uac.Team, error)
- func (l *TeamLoader) Prime(key string, value *uac.Team) bool
- type TeamLoaderConfig
- type UserLoader
- func (l *UserLoader) Clear(key string)
- func (l *UserLoader) Load(key string) (*uac.UserInfo, error)
- func (l *UserLoader) LoadAll(keys []string) ([]*uac.UserInfo, []error)
- func (l *UserLoader) LoadAllThunk(keys []string) func() ([]*uac.UserInfo, []error)
- func (l *UserLoader) LoadThunk(key string) func() (*uac.UserInfo, error)
- func (l *UserLoader) Prime(key string, value *uac.UserInfo) bool
- type UserLoaderConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetUserById ¶
func TeamDataloaderMiddleware ¶
func TeamDataloaderMiddleware(conn *connections.Connections) func(httprouter.Handle) httprouter.Handle
func UserDataloaderMiddleware ¶
func UserDataloaderMiddleware(conn *connections.Connections) func(httprouter.Handle) httprouter.Handle
Types ¶
type TeamLoader ¶
type TeamLoader struct {
// contains filtered or unexported fields
}
TeamLoader batches and caches requests
func NewTeamLoader ¶
func NewTeamLoader(config TeamLoaderConfig) *TeamLoader
NewTeamLoader creates a new TeamLoader given a fetch, wait, and maxBatch
func (*TeamLoader) Clear ¶
func (l *TeamLoader) Clear(key string)
Clear the value at key from the cache, if it exists
func (*TeamLoader) Load ¶
func (l *TeamLoader) Load(key string) (*uac.Team, error)
Load a Team by key, batching and caching will be applied automatically
func (*TeamLoader) LoadAll ¶
func (l *TeamLoader) LoadAll(keys []string) ([]*uac.Team, []error)
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*TeamLoader) LoadAllThunk ¶
func (l *TeamLoader) LoadAllThunk(keys []string) func() ([]*uac.Team, []error)
LoadAllThunk returns a function that when called will block waiting for a Teams. 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 (*TeamLoader) LoadThunk ¶
func (l *TeamLoader) LoadThunk(key string) func() (*uac.Team, error)
LoadThunk returns a function that when called will block waiting for a Team. 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.
type TeamLoaderConfig ¶
type TeamLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []string) ([]*uac.Team, []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 }
TeamLoaderConfig captures the config to create a new TeamLoader
type UserLoader ¶
type UserLoader struct {
// contains filtered or unexported fields
}
UserLoader batches and caches requests
func NewUserLoader ¶
func NewUserLoader(config UserLoaderConfig) *UserLoader
NewUserLoader creates a new UserLoader given a fetch, wait, and maxBatch
func (*UserLoader) Clear ¶
func (l *UserLoader) Clear(key string)
Clear the value at key from the cache, if it exists
func (*UserLoader) Load ¶
func (l *UserLoader) Load(key string) (*uac.UserInfo, error)
Load a UserInfo by key, batching and caching will be applied automatically
func (*UserLoader) LoadAll ¶
func (l *UserLoader) LoadAll(keys []string) ([]*uac.UserInfo, []error)
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*UserLoader) LoadAllThunk ¶
func (l *UserLoader) LoadAllThunk(keys []string) func() ([]*uac.UserInfo, []error)
LoadAllThunk returns a function that when called will block waiting for a UserInfos. 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 (*UserLoader) LoadThunk ¶
func (l *UserLoader) LoadThunk(key string) func() (*uac.UserInfo, error)
LoadThunk returns a function that when called will block waiting for a UserInfo. 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 (*UserLoader) Prime ¶
func (l *UserLoader) Prime(key string, value *uac.UserInfo) 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 UserLoaderConfig ¶
type UserLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []string) ([]*uac.UserInfo, []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 }
UserLoaderConfig captures the config to create a new UserLoader