Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AlexaSpeakerPromotion ¶
type AlexaSpeakerPromotion struct{}
AlexaSpeakerPromotion applies a 10% discount if more than 3 are bought.
func (*AlexaSpeakerPromotion) Apply ¶
func (p *AlexaSpeakerPromotion) Apply(items []*model.Item) (*model.Promotions, error)
type GoogleTVPromotion ¶
type GoogleTVPromotion struct{}
GoogleTVPromotion applies a "Buy 3 for the price of 2" discount.
func (*GoogleTVPromotion) Apply ¶
func (p *GoogleTVPromotion) Apply(items []*model.Item) (*model.Promotions, error)
type MacBookProPromotion ¶
type MacBookProPromotion struct {
// contains filtered or unexported fields
}
MacBookProPromotion adds a free Raspberry Pi B for each MacBook Pro.
func NewMacBookProPromotion ¶ added in v0.1.0
func NewMacBookProPromotion(db database.Database) *MacBookProPromotion
func (*MacBookProPromotion) Apply ¶
func (p *MacBookProPromotion) Apply(items []*model.Item) (*model.Promotions, error)
type Promotion ¶
type Promotion interface {
Apply(items []*model.Item) (*model.Promotions, error)
}
Promotion defines the interface for a promotion strategy.
type PromotionsEngine ¶
type PromotionsEngine struct {
// contains filtered or unexported fields
}
PromotionsEngine applies all registered promotions.
func NewPromotionsEngine ¶
func NewPromotionsEngine(promotions ...Promotion) *PromotionsEngine
NewPromotionsEngine creates a new PromotionsEngine with the given promotions.
func (*PromotionsEngine) ApplyPromotions ¶
func (e *PromotionsEngine) ApplyPromotions(items []*model.Item) (*model.Promotions, error)
ApplyPromotions applies all registered promotions to the items.
Click to show internal directories.
Click to hide internal directories.