Documentation
¶
Index ¶
- func GetLoadersKey() contextKey
- func Middleware(fac models.Repo) func(next http.Handler) http.Handler
- type BodyModificationsLoader
- func (l *BodyModificationsLoader) Clear(key uuid.UUID)
- func (l *BodyModificationsLoader) Load(key uuid.UUID) ([]*models.BodyModification, error)
- func (l *BodyModificationsLoader) LoadAll(keys []uuid.UUID) ([][]*models.BodyModification, []error)
- func (l *BodyModificationsLoader) LoadAllThunk(keys []uuid.UUID) func() ([][]*models.BodyModification, []error)
- func (l *BodyModificationsLoader) LoadThunk(key uuid.UUID) func() ([]*models.BodyModification, error)
- func (l *BodyModificationsLoader) Prime(key uuid.UUID, value []*models.BodyModification) bool
- type BodyModificationsLoaderConfig
- type FingerprintsLoader
- func (l *FingerprintsLoader) Clear(key uuid.UUID)
- func (l *FingerprintsLoader) Load(key uuid.UUID) ([]*models.Fingerprint, error)
- func (l *FingerprintsLoader) LoadAll(keys []uuid.UUID) ([][]*models.Fingerprint, []error)
- func (l *FingerprintsLoader) LoadAllThunk(keys []uuid.UUID) func() ([][]*models.Fingerprint, []error)
- func (l *FingerprintsLoader) LoadThunk(key uuid.UUID) func() ([]*models.Fingerprint, error)
- func (l *FingerprintsLoader) Prime(key uuid.UUID, value []*models.Fingerprint) bool
- type FingerprintsLoaderConfig
- type ImageLoader
- func (l *ImageLoader) Clear(key uuid.UUID)
- func (l *ImageLoader) Load(key uuid.UUID) (*models.Image, error)
- func (l *ImageLoader) LoadAll(keys []uuid.UUID) ([]*models.Image, []error)
- func (l *ImageLoader) LoadAllThunk(keys []uuid.UUID) func() ([]*models.Image, []error)
- func (l *ImageLoader) LoadThunk(key uuid.UUID) func() (*models.Image, error)
- func (l *ImageLoader) Prime(key uuid.UUID, value *models.Image) bool
- type ImageLoaderConfig
- type Loaders
- type PerformerLoader
- func (l *PerformerLoader) Clear(key uuid.UUID)
- func (l *PerformerLoader) Load(key uuid.UUID) (*models.Performer, error)
- func (l *PerformerLoader) LoadAll(keys []uuid.UUID) ([]*models.Performer, []error)
- func (l *PerformerLoader) LoadAllThunk(keys []uuid.UUID) func() ([]*models.Performer, []error)
- func (l *PerformerLoader) LoadThunk(key uuid.UUID) func() (*models.Performer, error)
- func (l *PerformerLoader) Prime(key uuid.UUID, value *models.Performer) bool
- type PerformerLoaderConfig
- type SceneAppearancesLoader
- func (l *SceneAppearancesLoader) Clear(key uuid.UUID)
- func (l *SceneAppearancesLoader) Load(key uuid.UUID) (models.PerformersScenes, error)
- func (l *SceneAppearancesLoader) LoadAll(keys []uuid.UUID) ([]models.PerformersScenes, []error)
- func (l *SceneAppearancesLoader) LoadAllThunk(keys []uuid.UUID) func() ([]models.PerformersScenes, []error)
- func (l *SceneAppearancesLoader) LoadThunk(key uuid.UUID) func() (models.PerformersScenes, error)
- func (l *SceneAppearancesLoader) Prime(key uuid.UUID, value models.PerformersScenes) bool
- type SceneAppearancesLoaderConfig
- type SiteLoader
- func (l *SiteLoader) Clear(key uuid.UUID)
- func (l *SiteLoader) Load(key uuid.UUID) (*models.Site, error)
- func (l *SiteLoader) LoadAll(keys []uuid.UUID) ([]*models.Site, []error)
- func (l *SiteLoader) LoadAllThunk(keys []uuid.UUID) func() ([]*models.Site, []error)
- func (l *SiteLoader) LoadThunk(key uuid.UUID) func() (*models.Site, error)
- func (l *SiteLoader) Prime(key uuid.UUID, value *models.Site) bool
- type SiteLoaderConfig
- type StringsLoader
- func (l *StringsLoader) Clear(key uuid.UUID)
- func (l *StringsLoader) Load(key uuid.UUID) ([]string, error)
- func (l *StringsLoader) LoadAll(keys []uuid.UUID) ([][]string, []error)
- func (l *StringsLoader) LoadAllThunk(keys []uuid.UUID) func() ([][]string, []error)
- func (l *StringsLoader) LoadThunk(key uuid.UUID) func() ([]string, error)
- func (l *StringsLoader) Prime(key uuid.UUID, value []string) bool
- type StringsLoaderConfig
- type TagCategoryLoader
- func (l *TagCategoryLoader) Clear(key uuid.UUID)
- func (l *TagCategoryLoader) Load(key uuid.UUID) (*models.TagCategory, error)
- func (l *TagCategoryLoader) LoadAll(keys []uuid.UUID) ([]*models.TagCategory, []error)
- func (l *TagCategoryLoader) LoadAllThunk(keys []uuid.UUID) func() ([]*models.TagCategory, []error)
- func (l *TagCategoryLoader) LoadThunk(key uuid.UUID) func() (*models.TagCategory, error)
- func (l *TagCategoryLoader) Prime(key uuid.UUID, value *models.TagCategory) bool
- type TagCategoryLoaderConfig
- type TagLoader
- func (l *TagLoader) Clear(key uuid.UUID)
- func (l *TagLoader) Load(key uuid.UUID) (*models.Tag, error)
- func (l *TagLoader) LoadAll(keys []uuid.UUID) ([]*models.Tag, []error)
- func (l *TagLoader) LoadAllThunk(keys []uuid.UUID) func() ([]*models.Tag, []error)
- func (l *TagLoader) LoadThunk(key uuid.UUID) func() (*models.Tag, error)
- func (l *TagLoader) Prime(key uuid.UUID, value *models.Tag) bool
- type TagLoaderConfig
- type URLLoader
- func (l *URLLoader) Clear(key uuid.UUID)
- func (l *URLLoader) Load(key uuid.UUID) ([]*models.URL, error)
- func (l *URLLoader) LoadAll(keys []uuid.UUID) ([][]*models.URL, []error)
- func (l *URLLoader) LoadAllThunk(keys []uuid.UUID) func() ([][]*models.URL, []error)
- func (l *URLLoader) LoadThunk(key uuid.UUID) func() ([]*models.URL, error)
- func (l *URLLoader) Prime(key uuid.UUID, value []*models.URL) bool
- type URLLoaderConfig
- type UUIDsLoader
- func (l *UUIDsLoader) Clear(key uuid.UUID)
- func (l *UUIDsLoader) Load(key uuid.UUID) ([]uuid.UUID, error)
- func (l *UUIDsLoader) LoadAll(keys []uuid.UUID) ([][]uuid.UUID, []error)
- func (l *UUIDsLoader) LoadAllThunk(keys []uuid.UUID) func() ([][]uuid.UUID, []error)
- func (l *UUIDsLoader) LoadThunk(key uuid.UUID) func() ([]uuid.UUID, error)
- func (l *UUIDsLoader) Prime(key uuid.UUID, value []uuid.UUID) bool
- type UUIDsLoaderConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetLoadersKey ¶
func GetLoadersKey() contextKey
Types ¶
type BodyModificationsLoader ¶
type BodyModificationsLoader struct {
// contains filtered or unexported fields
}
BodyModificationsLoader batches and caches requests
func NewBodyModificationsLoader ¶
func NewBodyModificationsLoader(config BodyModificationsLoaderConfig) *BodyModificationsLoader
NewBodyModificationsLoader creates a new BodyModificationsLoader given a fetch, wait, and maxBatch
func (*BodyModificationsLoader) Clear ¶
func (l *BodyModificationsLoader) Clear(key uuid.UUID)
Clear the value at key from the cache, if it exists
func (*BodyModificationsLoader) Load ¶
func (l *BodyModificationsLoader) Load(key uuid.UUID) ([]*models.BodyModification, error)
Load a BodyModification by key, batching and caching will be applied automatically
func (*BodyModificationsLoader) LoadAll ¶
func (l *BodyModificationsLoader) LoadAll(keys []uuid.UUID) ([][]*models.BodyModification, []error)
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*BodyModificationsLoader) LoadAllThunk ¶
func (l *BodyModificationsLoader) LoadAllThunk(keys []uuid.UUID) func() ([][]*models.BodyModification, []error)
LoadAllThunk returns a function that when called will block waiting for a BodyModifications. 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 (*BodyModificationsLoader) LoadThunk ¶
func (l *BodyModificationsLoader) LoadThunk(key uuid.UUID) func() ([]*models.BodyModification, error)
LoadThunk returns a function that when called will block waiting for a BodyModification. 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 (*BodyModificationsLoader) Prime ¶
func (l *BodyModificationsLoader) Prime(key uuid.UUID, value []*models.BodyModification) 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 BodyModificationsLoaderConfig ¶
type BodyModificationsLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []uuid.UUID) ([][]*models.BodyModification, []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 }
BodyModificationsLoaderConfig captures the config to create a new BodyModificationsLoader
type FingerprintsLoader ¶
type FingerprintsLoader struct {
// contains filtered or unexported fields
}
FingerprintsLoader batches and caches requests
func NewFingerprintsLoader ¶
func NewFingerprintsLoader(config FingerprintsLoaderConfig) *FingerprintsLoader
NewFingerprintsLoader creates a new FingerprintsLoader given a fetch, wait, and maxBatch
func (*FingerprintsLoader) Clear ¶
func (l *FingerprintsLoader) Clear(key uuid.UUID)
Clear the value at key from the cache, if it exists
func (*FingerprintsLoader) Load ¶
func (l *FingerprintsLoader) Load(key uuid.UUID) ([]*models.Fingerprint, error)
Load a Fingerprint by key, batching and caching will be applied automatically
func (*FingerprintsLoader) LoadAll ¶
func (l *FingerprintsLoader) LoadAll(keys []uuid.UUID) ([][]*models.Fingerprint, []error)
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*FingerprintsLoader) LoadAllThunk ¶
func (l *FingerprintsLoader) LoadAllThunk(keys []uuid.UUID) func() ([][]*models.Fingerprint, []error)
LoadAllThunk returns a function that when called will block waiting for a Fingerprints. 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 (*FingerprintsLoader) LoadThunk ¶
func (l *FingerprintsLoader) LoadThunk(key uuid.UUID) func() ([]*models.Fingerprint, error)
LoadThunk returns a function that when called will block waiting for a Fingerprint. 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 (*FingerprintsLoader) Prime ¶
func (l *FingerprintsLoader) Prime(key uuid.UUID, value []*models.Fingerprint) 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 FingerprintsLoaderConfig ¶
type FingerprintsLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []uuid.UUID) ([][]*models.Fingerprint, []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 }
FingerprintsLoaderConfig captures the config to create a new FingerprintsLoader
type ImageLoader ¶
type ImageLoader struct {
// contains filtered or unexported fields
}
ImageLoader batches and caches requests
func NewImageLoader ¶
func NewImageLoader(config ImageLoaderConfig) *ImageLoader
NewImageLoader creates a new ImageLoader given a fetch, wait, and maxBatch
func (*ImageLoader) Clear ¶
func (l *ImageLoader) Clear(key uuid.UUID)
Clear the value at key from the cache, if it exists
func (*ImageLoader) LoadAll ¶
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*ImageLoader) LoadAllThunk ¶
LoadAllThunk returns a function that when called will block waiting for a Images. 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 (*ImageLoader) LoadThunk ¶
LoadThunk returns a function that when called will block waiting for a Image. 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 ImageLoaderConfig ¶
type ImageLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []uuid.UUID) ([]*models.Image, []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 }
ImageLoaderConfig captures the config to create a new ImageLoader
type Loaders ¶
type Loaders struct { SceneFingerprintsByID FingerprintsLoader ImageByID ImageLoader PerformerByID PerformerLoader PerformerAliasesByID StringsLoader PerformerImageIDsByID UUIDsLoader PerformerMergeIDsByID UUIDsLoader PerformerPiercingsByID BodyModificationsLoader PerformerTattoosByID BodyModificationsLoader PerformerUrlsByID URLLoader SceneImageIDsByID UUIDsLoader SceneAppearancesByID SceneAppearancesLoader SceneUrlsByID URLLoader StudioImageIDsByID UUIDsLoader StudioUrlsByID URLLoader SceneTagIDsByID UUIDsLoader SiteByID SiteLoader TagByID TagLoader TagCategoryByID TagCategoryLoader }
type PerformerLoader ¶
type PerformerLoader struct {
// contains filtered or unexported fields
}
PerformerLoader batches and caches requests
func NewPerformerLoader ¶
func NewPerformerLoader(config PerformerLoaderConfig) *PerformerLoader
NewPerformerLoader creates a new PerformerLoader given a fetch, wait, and maxBatch
func (*PerformerLoader) Clear ¶
func (l *PerformerLoader) Clear(key uuid.UUID)
Clear the value at key from the cache, if it exists
func (*PerformerLoader) Load ¶
Load a Performer by key, batching and caching will be applied automatically
func (*PerformerLoader) LoadAll ¶
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*PerformerLoader) LoadAllThunk ¶
LoadAllThunk returns a function that when called will block waiting for a Performers. 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 (*PerformerLoader) LoadThunk ¶
LoadThunk returns a function that when called will block waiting for a Performer. 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 PerformerLoaderConfig ¶
type PerformerLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []uuid.UUID) ([]*models.Performer, []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 }
PerformerLoaderConfig captures the config to create a new PerformerLoader
type SceneAppearancesLoader ¶
type SceneAppearancesLoader struct {
// contains filtered or unexported fields
}
SceneAppearancesLoader batches and caches requests
func NewSceneAppearancesLoader ¶
func NewSceneAppearancesLoader(config SceneAppearancesLoaderConfig) *SceneAppearancesLoader
NewSceneAppearancesLoader creates a new SceneAppearancesLoader given a fetch, wait, and maxBatch
func (*SceneAppearancesLoader) Clear ¶
func (l *SceneAppearancesLoader) Clear(key uuid.UUID)
Clear the value at key from the cache, if it exists
func (*SceneAppearancesLoader) Load ¶
func (l *SceneAppearancesLoader) Load(key uuid.UUID) (models.PerformersScenes, error)
Load a PerformersScenes by key, batching and caching will be applied automatically
func (*SceneAppearancesLoader) LoadAll ¶
func (l *SceneAppearancesLoader) LoadAll(keys []uuid.UUID) ([]models.PerformersScenes, []error)
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*SceneAppearancesLoader) LoadAllThunk ¶
func (l *SceneAppearancesLoader) LoadAllThunk(keys []uuid.UUID) func() ([]models.PerformersScenes, []error)
LoadAllThunk returns a function that when called will block waiting for a PerformersSceness. 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 (*SceneAppearancesLoader) LoadThunk ¶
func (l *SceneAppearancesLoader) LoadThunk(key uuid.UUID) func() (models.PerformersScenes, error)
LoadThunk returns a function that when called will block waiting for a PerformersScenes. 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 (*SceneAppearancesLoader) Prime ¶
func (l *SceneAppearancesLoader) Prime(key uuid.UUID, value models.PerformersScenes) 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 SceneAppearancesLoaderConfig ¶
type SceneAppearancesLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []uuid.UUID) ([]models.PerformersScenes, []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 }
SceneAppearancesLoaderConfig captures the config to create a new SceneAppearancesLoader
type SiteLoader ¶ added in v0.1.0
type SiteLoader struct {
// contains filtered or unexported fields
}
SiteLoader batches and caches requests
func NewSiteLoader ¶ added in v0.1.0
func NewSiteLoader(config SiteLoaderConfig) *SiteLoader
NewSiteLoader creates a new SiteLoader given a fetch, wait, and maxBatch
func (*SiteLoader) Clear ¶ added in v0.1.0
func (l *SiteLoader) Clear(key uuid.UUID)
Clear the value at key from the cache, if it exists
func (*SiteLoader) Load ¶ added in v0.1.0
Load a Site by key, batching and caching will be applied automatically
func (*SiteLoader) LoadAll ¶ added in v0.1.0
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*SiteLoader) LoadAllThunk ¶ added in v0.1.0
LoadAllThunk returns a function that when called will block waiting for a Sites. 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 (*SiteLoader) LoadThunk ¶ added in v0.1.0
LoadThunk returns a function that when called will block waiting for a Site. 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 SiteLoaderConfig ¶ added in v0.1.0
type SiteLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []uuid.UUID) ([]*models.Site, []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 }
SiteLoaderConfig captures the config to create a new SiteLoader
type StringsLoader ¶
type StringsLoader struct {
// contains filtered or unexported fields
}
StringsLoader batches and caches requests
func NewStringsLoader ¶
func NewStringsLoader(config StringsLoaderConfig) *StringsLoader
NewStringsLoader creates a new StringsLoader given a fetch, wait, and maxBatch
func (*StringsLoader) Clear ¶
func (l *StringsLoader) Clear(key uuid.UUID)
Clear the value at key from the cache, if it exists
func (*StringsLoader) Load ¶
func (l *StringsLoader) Load(key uuid.UUID) ([]string, error)
Load a string by key, batching and caching will be applied automatically
func (*StringsLoader) LoadAll ¶
func (l *StringsLoader) LoadAll(keys []uuid.UUID) ([][]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 (*StringsLoader) LoadAllThunk ¶
func (l *StringsLoader) LoadAllThunk(keys []uuid.UUID) 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 (*StringsLoader) LoadThunk ¶
func (l *StringsLoader) LoadThunk(key uuid.UUID) 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 (*StringsLoader) Prime ¶
func (l *StringsLoader) Prime(key uuid.UUID, 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 StringsLoaderConfig ¶
type StringsLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []uuid.UUID) ([][]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 }
StringsLoaderConfig captures the config to create a new StringsLoader
type TagCategoryLoader ¶
type TagCategoryLoader struct {
// contains filtered or unexported fields
}
TagCategoryLoader batches and caches requests
func NewTagCategoryLoader ¶
func NewTagCategoryLoader(config TagCategoryLoaderConfig) *TagCategoryLoader
NewTagCategoryLoader creates a new TagCategoryLoader given a fetch, wait, and maxBatch
func (*TagCategoryLoader) Clear ¶
func (l *TagCategoryLoader) Clear(key uuid.UUID)
Clear the value at key from the cache, if it exists
func (*TagCategoryLoader) Load ¶
func (l *TagCategoryLoader) Load(key uuid.UUID) (*models.TagCategory, error)
Load a TagCategory by key, batching and caching will be applied automatically
func (*TagCategoryLoader) LoadAll ¶
func (l *TagCategoryLoader) LoadAll(keys []uuid.UUID) ([]*models.TagCategory, []error)
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*TagCategoryLoader) LoadAllThunk ¶
func (l *TagCategoryLoader) LoadAllThunk(keys []uuid.UUID) func() ([]*models.TagCategory, []error)
LoadAllThunk returns a function that when called will block waiting for a TagCategorys. 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 (*TagCategoryLoader) LoadThunk ¶
func (l *TagCategoryLoader) LoadThunk(key uuid.UUID) func() (*models.TagCategory, error)
LoadThunk returns a function that when called will block waiting for a TagCategory. 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 (*TagCategoryLoader) Prime ¶
func (l *TagCategoryLoader) Prime(key uuid.UUID, value *models.TagCategory) 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 TagCategoryLoaderConfig ¶
type TagCategoryLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []uuid.UUID) ([]*models.TagCategory, []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 }
TagCategoryLoaderConfig captures the config to create a new TagCategoryLoader
type TagLoader ¶
type TagLoader struct {
// contains filtered or unexported fields
}
TagLoader batches and caches requests
func NewTagLoader ¶
func NewTagLoader(config TagLoaderConfig) *TagLoader
NewTagLoader creates a new TagLoader given a fetch, wait, and maxBatch
func (*TagLoader) LoadAll ¶
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*TagLoader) LoadAllThunk ¶
LoadAllThunk returns a function that when called will block waiting for a Tags. 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 (*TagLoader) LoadThunk ¶
LoadThunk returns a function that when called will block waiting for a Tag. 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 TagLoaderConfig ¶
type TagLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []uuid.UUID) ([]*models.Tag, []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 }
TagLoaderConfig captures the config to create a new TagLoader
type URLLoader ¶
type URLLoader struct {
// contains filtered or unexported fields
}
URLLoader batches and caches requests
func NewURLLoader ¶
func NewURLLoader(config URLLoaderConfig) *URLLoader
NewURLLoader creates a new URLLoader given a fetch, wait, and maxBatch
func (*URLLoader) LoadAll ¶
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*URLLoader) LoadAllThunk ¶
LoadAllThunk returns a function that when called will block waiting for a URLs. 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 (*URLLoader) LoadThunk ¶
LoadThunk returns a function that when called will block waiting for a URL. 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 URLLoaderConfig ¶
type URLLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []uuid.UUID) ([][]*models.URL, []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 }
URLLoaderConfig captures the config to create a new URLLoader
type UUIDsLoader ¶
type UUIDsLoader struct {
// contains filtered or unexported fields
}
UUIDsLoader batches and caches requests
func NewUUIDsLoader ¶
func NewUUIDsLoader(config UUIDsLoaderConfig) *UUIDsLoader
NewUUIDsLoader creates a new UUIDsLoader given a fetch, wait, and maxBatch
func (*UUIDsLoader) Clear ¶
func (l *UUIDsLoader) Clear(key uuid.UUID)
Clear the value at key from the cache, if it exists
func (*UUIDsLoader) LoadAll ¶
LoadAll fetches many keys at once. It will be broken into appropriate sized sub batches depending on how the loader is configured
func (*UUIDsLoader) LoadAllThunk ¶
LoadAllThunk returns a function that when called will block waiting for a UUIDs. 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 (*UUIDsLoader) LoadThunk ¶
LoadThunk returns a function that when called will block waiting for a UUID. 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 UUIDsLoaderConfig ¶
type UUIDsLoaderConfig struct { // Fetch is a method that provides the data for the loader Fetch func(keys []uuid.UUID) ([][]uuid.UUID, []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 }
UUIDsLoaderConfig captures the config to create a new UUIDsLoader