Documentation
¶
Index ¶
- type Config
- type DataLoader
- type PlayerLoader
- func (l *PlayerLoader) Clear(key int)
- func (l *PlayerLoader) Load(key int) (*twmodel.Player, error)
- func (l *PlayerLoader) LoadAll(keys []int) ([]*twmodel.Player, []error)
- func (l *PlayerLoader) LoadAllThunk(keys []int) func() ([]*twmodel.Player, []error)
- func (l *PlayerLoader) LoadThunk(key int) func() (*twmodel.Player, error)
- func (l *PlayerLoader) Prime(key int, value *twmodel.Player) bool
- type PlayerLoaderConfig
- type PlayerNameChangesLoader
- func (l *PlayerNameChangesLoader) Clear(key int)
- func (l *PlayerNameChangesLoader) Load(key int) ([]*twmodel.PlayerNameChange, error)
- func (l *PlayerNameChangesLoader) LoadAll(keys []int) ([][]*twmodel.PlayerNameChange, []error)
- func (l *PlayerNameChangesLoader) LoadAllThunk(keys []int) func() ([][]*twmodel.PlayerNameChange, []error)
- func (l *PlayerNameChangesLoader) LoadThunk(key int) func() ([]*twmodel.PlayerNameChange, error)
- func (l *PlayerNameChangesLoader) Prime(key int, value []*twmodel.PlayerNameChange) bool
- type PlayerNameChangesLoaderConfig
- type PlayerServersLoader
- func (l *PlayerServersLoader) Clear(key int)
- func (l *PlayerServersLoader) Load(key int) ([]string, error)
- func (l *PlayerServersLoader) LoadAll(keys []int) ([][]string, []error)
- func (l *PlayerServersLoader) LoadAllThunk(keys []int) func() ([][]string, []error)
- func (l *PlayerServersLoader) LoadThunk(key int) func() ([]string, error)
- func (l *PlayerServersLoader) Prime(key int, value []string) bool
- type PlayerServersLoaderConfig
- type ServerDataLoader
- type TribeLoader
- func (l *TribeLoader) Clear(key int)
- func (l *TribeLoader) Load(key int) (*twmodel.Tribe, error)
- func (l *TribeLoader) LoadAll(keys []int) ([]*twmodel.Tribe, []error)
- func (l *TribeLoader) LoadAllThunk(keys []int) func() ([]*twmodel.Tribe, []error)
- func (l *TribeLoader) LoadThunk(key int) func() (*twmodel.Tribe, error)
- func (l *TribeLoader) Prime(key int, value *twmodel.Tribe) bool
- type TribeLoaderConfig
- type VersionDataLoader
- type VersionLoader
- func (l *VersionLoader) Clear(key string)
- func (l *VersionLoader) Load(key string) (*twmodel.Version, error)
- func (l *VersionLoader) LoadAll(keys []string) ([]*twmodel.Version, []error)
- func (l *VersionLoader) LoadAllThunk(keys []string) func() ([]*twmodel.Version, []error)
- func (l *VersionLoader) LoadThunk(key string) func() (*twmodel.Version, error)
- func (l *VersionLoader) Prime(key string, value *twmodel.Version) bool
- type VersionLoaderConfig
- type VillageLoader
- func (l *VillageLoader) Clear(key int)
- func (l *VillageLoader) Load(key int) (*twmodel.Village, error)
- func (l *VillageLoader) LoadAll(keys []int) ([]*twmodel.Village, []error)
- func (l *VillageLoader) LoadAllThunk(keys []int) func() ([]*twmodel.Village, []error)
- func (l *VillageLoader) LoadThunk(key int) func() (*twmodel.Village, error)
- func (l *VillageLoader) Prime(key int, value *twmodel.Village) bool
- type VillageLoaderConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
PlayerRepo player.Repository
TribeRepo tribe.Repository
VillageRepo village.Repository
VersionRepo version.Repository
}
type DataLoader ¶
type DataLoader struct {
VersionByCode *VersionLoader
}
func NewDataLoader ¶
func NewDataLoader(cfg Config) *DataLoader
type PlayerLoader ¶
type PlayerLoader struct {
// contains filtered or unexported fields
}
PlayerLoader batches and caches requests
func NewPlayerLoader ¶
func NewPlayerLoader(config PlayerLoaderConfig) *PlayerLoader
NewPlayerLoader creates a new PlayerLoader given a fetch, wait, and maxBatch
func (*PlayerLoader) Clear ¶
func (l *PlayerLoader) Clear(key int)
Clear the value at key from the cache, if it exists
func (*PlayerLoader) Load ¶
func (l *PlayerLoader) Load(key int) (*twmodel.Player, error)
Load a Player by key, batching and caching will be applied automatically
func (*PlayerLoader) LoadAll ¶
func (l *PlayerLoader) LoadAll(keys []int) ([]*twmodel.Player, []error)
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*PlayerLoader) LoadAllThunk ¶
func (l *PlayerLoader) LoadAllThunk(keys []int) func() ([]*twmodel.Player, []error)
LoadAllThunk returns a function that when called will block waiting for a Players. 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 (*PlayerLoader) LoadThunk ¶
func (l *PlayerLoader) LoadThunk(key int) func() (*twmodel.Player, error)
LoadThunk returns a function that when called will block waiting for a Player. 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 (*PlayerLoader) Prime ¶
func (l *PlayerLoader) Prime(key int, value *twmodel.Player) 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 PlayerLoaderConfig ¶
type PlayerLoaderConfig struct {
// Fetch is a method that provides the data for the loader
Fetch func(keys []int) ([]*twmodel.Player, []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
}
PlayerLoaderConfig captures the config to create a new PlayerLoader
type PlayerNameChangesLoader ¶
type PlayerNameChangesLoader struct {
// contains filtered or unexported fields
}
PlayerNameChangesLoader batches and caches requests
func NewPlayerNameChangesLoader ¶
func NewPlayerNameChangesLoader(config PlayerNameChangesLoaderConfig) *PlayerNameChangesLoader
NewPlayerNameChangesLoader creates a new PlayerNameChangesLoader given a fetch, wait, and maxBatch
func (*PlayerNameChangesLoader) Clear ¶
func (l *PlayerNameChangesLoader) Clear(key int)
Clear the value at key from the cache, if it exists
func (*PlayerNameChangesLoader) Load ¶
func (l *PlayerNameChangesLoader) Load(key int) ([]*twmodel.PlayerNameChange, error)
Load a PlayerNameChange by key, batching and caching will be applied automatically
func (*PlayerNameChangesLoader) LoadAll ¶
func (l *PlayerNameChangesLoader) LoadAll(keys []int) ([][]*twmodel.PlayerNameChange, []error)
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*PlayerNameChangesLoader) LoadAllThunk ¶
func (l *PlayerNameChangesLoader) LoadAllThunk(keys []int) func() ([][]*twmodel.PlayerNameChange, []error)
LoadAllThunk returns a function that when called will block waiting for a PlayerNameChanges. 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 (*PlayerNameChangesLoader) LoadThunk ¶
func (l *PlayerNameChangesLoader) LoadThunk(key int) func() ([]*twmodel.PlayerNameChange, error)
LoadThunk returns a function that when called will block waiting for a PlayerNameChange. 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 (*PlayerNameChangesLoader) Prime ¶
func (l *PlayerNameChangesLoader) Prime(key int, value []*twmodel.PlayerNameChange) 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 PlayerNameChangesLoaderConfig ¶
type PlayerNameChangesLoaderConfig struct {
// Fetch is a method that provides the data for the loader
Fetch func(keys []int) ([][]*twmodel.PlayerNameChange, []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
}
PlayerNameChangesLoaderConfig captures the config to create a new PlayerNameChangesLoader
type PlayerServersLoader ¶
type PlayerServersLoader struct {
// contains filtered or unexported fields
}
PlayerServersLoader batches and caches requests
func NewPlayerServersLoader ¶
func NewPlayerServersLoader(config PlayerServersLoaderConfig) *PlayerServersLoader
NewPlayerServersLoader creates a new PlayerServersLoader given a fetch, wait, and maxBatch
func (*PlayerServersLoader) Clear ¶
func (l *PlayerServersLoader) Clear(key int)
Clear the value at key from the cache, if it exists
func (*PlayerServersLoader) Load ¶
func (l *PlayerServersLoader) Load(key int) ([]string, error)
Load a string by key, batching and caching will be applied automatically
func (*PlayerServersLoader) LoadAll ¶
func (l *PlayerServersLoader) LoadAll(keys []int) ([][]string, []error)
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*PlayerServersLoader) LoadAllThunk ¶
func (l *PlayerServersLoader) LoadAllThunk(keys []int) func() ([][]string, []error)
LoadAllThunk returns a function that when called will block waiting for a strings. 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 (*PlayerServersLoader) LoadThunk ¶
func (l *PlayerServersLoader) LoadThunk(key int) func() ([]string, error)
LoadThunk returns a function that when called will block waiting for a string. 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 (*PlayerServersLoader) Prime ¶
func (l *PlayerServersLoader) Prime(key int, value []string) 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 PlayerServersLoaderConfig ¶
type PlayerServersLoaderConfig struct {
// Fetch is a method that provides the data for the loader
Fetch func(keys []int) ([][]string, []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
}
PlayerServersLoaderConfig captures the config to create a new PlayerServersLoader
type ServerDataLoader ¶
type ServerDataLoader struct {
PlayerByID *PlayerLoader
TribeByID *TribeLoader
VillageByID *VillageLoader
}
func NewServerDataLoader ¶
func NewServerDataLoader(server string, cfg Config) *ServerDataLoader
type TribeLoader ¶
type TribeLoader struct {
// contains filtered or unexported fields
}
TribeLoader batches and caches requests
func NewTribeLoader ¶
func NewTribeLoader(config TribeLoaderConfig) *TribeLoader
NewTribeLoader creates a new TribeLoader given a fetch, wait, and maxBatch
func (*TribeLoader) Clear ¶
func (l *TribeLoader) Clear(key int)
Clear the value at key from the cache, if it exists
func (*TribeLoader) Load ¶
func (l *TribeLoader) Load(key int) (*twmodel.Tribe, error)
Load a Tribe by key, batching and caching will be applied automatically
func (*TribeLoader) LoadAll ¶
func (l *TribeLoader) LoadAll(keys []int) ([]*twmodel.Tribe, []error)
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*TribeLoader) LoadAllThunk ¶
func (l *TribeLoader) LoadAllThunk(keys []int) func() ([]*twmodel.Tribe, []error)
LoadAllThunk returns a function that when called will block waiting for a Tribes. 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 (*TribeLoader) LoadThunk ¶
func (l *TribeLoader) LoadThunk(key int) func() (*twmodel.Tribe, error)
LoadThunk returns a function that when called will block waiting for a Tribe. 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 (*TribeLoader) Prime ¶
func (l *TribeLoader) Prime(key int, value *twmodel.Tribe) 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 TribeLoaderConfig ¶
type TribeLoaderConfig struct {
// Fetch is a method that provides the data for the loader
Fetch func(keys []int) ([]*twmodel.Tribe, []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
}
TribeLoaderConfig captures the config to create a new TribeLoader
type VersionDataLoader ¶
type VersionDataLoader struct {
PlayerServersByID *PlayerServersLoader
PlayerNameChangesByID *PlayerNameChangesLoader
}
func NewVersionDataLoader ¶
func NewVersionDataLoader(versionCode twmodel.VersionCode, cfg Config) *VersionDataLoader
type VersionLoader ¶
type VersionLoader struct {
// contains filtered or unexported fields
}
VersionLoader batches and caches requests
func NewVersionLoader ¶
func NewVersionLoader(config VersionLoaderConfig) *VersionLoader
NewVersionLoader creates a new VersionLoader given a fetch, wait, and maxBatch
func (*VersionLoader) Clear ¶
func (l *VersionLoader) Clear(key string)
Clear the value at key from the cache, if it exists
func (*VersionLoader) Load ¶
func (l *VersionLoader) Load(key string) (*twmodel.Version, error)
Load a Version by key, batching and caching will be applied automatically
func (*VersionLoader) LoadAll ¶
func (l *VersionLoader) LoadAll(keys []string) ([]*twmodel.Version, []error)
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*VersionLoader) LoadAllThunk ¶
func (l *VersionLoader) LoadAllThunk(keys []string) func() ([]*twmodel.Version, []error)
LoadAllThunk returns a function that when called will block waiting for a Versions. 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 (*VersionLoader) LoadThunk ¶
func (l *VersionLoader) LoadThunk(key string) func() (*twmodel.Version, error)
LoadThunk returns a function that when called will block waiting for a Version. 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 (*VersionLoader) Prime ¶
func (l *VersionLoader) Prime(key string, value *twmodel.Version) 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 VersionLoaderConfig ¶
type VersionLoaderConfig struct {
// Fetch is a method that provides the data for the loader
Fetch func(keys []string) ([]*twmodel.Version, []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
}
VersionLoaderConfig captures the config to create a new VersionLoader
type VillageLoader ¶
type VillageLoader struct {
// contains filtered or unexported fields
}
VillageLoader batches and caches requests
func NewVillageLoader ¶
func NewVillageLoader(config VillageLoaderConfig) *VillageLoader
NewVillageLoader creates a new VillageLoader given a fetch, wait, and maxBatch
func (*VillageLoader) Clear ¶
func (l *VillageLoader) Clear(key int)
Clear the value at key from the cache, if it exists
func (*VillageLoader) Load ¶
func (l *VillageLoader) Load(key int) (*twmodel.Village, error)
Load a Village by key, batching and caching will be applied automatically
func (*VillageLoader) LoadAll ¶
func (l *VillageLoader) LoadAll(keys []int) ([]*twmodel.Village, []error)
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*VillageLoader) LoadAllThunk ¶
func (l *VillageLoader) LoadAllThunk(keys []int) func() ([]*twmodel.Village, []error)
LoadAllThunk returns a function that when called will block waiting for a Villages. 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 (*VillageLoader) LoadThunk ¶
func (l *VillageLoader) LoadThunk(key int) func() (*twmodel.Village, error)
LoadThunk returns a function that when called will block waiting for a Village. 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 (*VillageLoader) Prime ¶
func (l *VillageLoader) Prime(key int, value *twmodel.Village) 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 VillageLoaderConfig ¶
type VillageLoaderConfig struct {
// Fetch is a method that provides the data for the loader
Fetch func(keys []int) ([]*twmodel.Village, []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
}
VillageLoaderConfig captures the config to create a new VillageLoader