Documentation
¶
Index ¶
- func Middleware(cat *catalog.Catalog, logger *zap.Logger) func(context.Context) context.Context
- type CategoryLoader
- type CollectionLoader
- func (l *CollectionLoader) Clear()
- func (l *CollectionLoader) Load(ctx context.Context, id string) (*catalog.Collection, error)
- func (l *CollectionLoader) LoadMany(ctx context.Context, ids []string) ([]*catalog.Collection, []error)
- func (l *CollectionLoader) Prime(id string, collection *catalog.Collection)
- type Loaders
- type ProductLoader
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CategoryLoader ¶
type CategoryLoader struct {
// contains filtered or unexported fields
}
CategoryLoader batches category lookups
func NewCategoryLoader ¶
func NewCategoryLoader(cat *catalog.Catalog, logger *zap.Logger) *CategoryLoader
NewCategoryLoader creates a new category data loader
func (*CategoryLoader) Clear ¶
func (l *CategoryLoader) Clear()
Clear clears the loader state (called on catalog reload)
type CollectionLoader ¶
type CollectionLoader struct {
// contains filtered or unexported fields
}
CollectionLoader batches collection lookups
func NewCollectionLoader ¶
func NewCollectionLoader(cat *catalog.Catalog, logger *zap.Logger) *CollectionLoader
NewCollectionLoader creates a new collection data loader
func (*CollectionLoader) Clear ¶
func (l *CollectionLoader) Clear()
Clear clears the loader state (called on catalog reload)
func (*CollectionLoader) Load ¶
func (l *CollectionLoader) Load(ctx context.Context, id string) (*catalog.Collection, error)
Load loads a single collection by ID (batched)
func (*CollectionLoader) LoadMany ¶
func (l *CollectionLoader) LoadMany(ctx context.Context, ids []string) ([]*catalog.Collection, []error)
LoadMany loads multiple collections by IDs (batched)
func (*CollectionLoader) Prime ¶
func (l *CollectionLoader) Prime(id string, collection *catalog.Collection)
Prime preloads a collection into the cache
type Loaders ¶
type Loaders struct {
Product *ProductLoader
Category *CategoryLoader
Collection *CollectionLoader
}
Loaders holds all data loaders for a request
func FromContext ¶
FromContext retrieves loaders from the context
func NewLoaders ¶
NewLoaders creates a new set of data loaders for a catalog
type ProductLoader ¶
type ProductLoader struct {
// contains filtered or unexported fields
}
ProductLoader batches product lookups
func NewProductLoader ¶
func NewProductLoader(cat *catalog.Catalog, logger *zap.Logger) *ProductLoader
NewProductLoader creates a new product data loader
func (*ProductLoader) Clear ¶
func (l *ProductLoader) Clear()
Clear clears the loader state (called on catalog reload)