promotions

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2025 License: MIT Imports: 3 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL