Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ItemTypeLuxury is a labels as Luxury item ItemTypeLuxury = "LUXURY" // ItemTypeNormal is a labels as Non Luxury item ItemTypeNormal = "NORMAL" )
Variables ¶
View Source
var ( // PriceCheckRule is a rule definition for test. PriceCheckRule = `` /* 507-byte string literal not displayed */ )
View Source
var ( // Purchases contains list of purchases to be evaluated. Purchases = []*Purchase{ &Purchase{ PurchaseDate: time.Date(2019, time.January, 4, 13, 0, 0, 0, time.Local), ItemType: ItemTypeLuxury, Price: 100000, }, &Purchase{ PurchaseDate: time.Date(2019, time.January, 17, 15, 0, 0, 0, time.Local), ItemType: ItemTypeLuxury, Price: 100000, }, &Purchase{ PurchaseDate: time.Date(2019, time.February, 12, 7, 0, 0, 0, time.Local), ItemType: ItemTypeLuxury, Price: 100000, }, &Purchase{ PurchaseDate: time.Date(2019, time.February, 24, 3, 0, 0, 0, time.Local), ItemType: ItemTypeLuxury, Price: 100000, }, &Purchase{ PurchaseDate: time.Date(2019, time.March, 22, 22, 0, 0, 0, time.Local), ItemType: ItemTypeLuxury, Price: 100000, }, &Purchase{ PurchaseDate: time.Date(2019, time.March, 24, 17, 0, 0, 0, time.Local), ItemType: ItemTypeLuxury, Price: 100000, }, &Purchase{ PurchaseDate: time.Date(2019, time.March, 15, 14, 0, 0, 0, time.Local), ItemType: ItemTypeLuxury, Price: 100000, }, &Purchase{ PurchaseDate: time.Date(2019, time.March, 25, 10, 0, 0, 0, time.Local), ItemType: ItemTypeLuxury, Price: 100000, }, &Purchase{ PurchaseDate: time.Date(2019, time.March, 19, 13, 0, 0, 0, time.Local), ItemType: ItemTypeLuxury, Price: 100000, }, &Purchase{ PurchaseDate: time.Date(2019, time.June, 6, 21, 0, 0, 0, time.Local), ItemType: ItemTypeLuxury, Price: 100000, }, &Purchase{ PurchaseDate: time.Date(2019, time.June, 19, 22, 0, 0, 0, time.Local), ItemType: ItemTypeLuxury, Price: 100000, }, } )
Functions ¶
This section is empty.
Types ¶
type CashFlow ¶
type CashFlow struct {
TotalPurchases float64
PurchaseCount int
TotalTax float64
PurchasesAfterTax float64
}
CashFlow stores simulated cash flow
type CashFlowCalculator ¶
type CashFlowCalculator struct {
}
CashFlowCalculator to simulate a calculator
func (*CashFlowCalculator) CalculatePurchases ¶
func (cf *CashFlowCalculator) CalculatePurchases()
CalculatePurchases will calculate a speciffic purchase by rule engine.
type ItemCart ¶
type ItemCart struct {
Items []*Item
}
ItemCart simulates a shopping cart.
func (*ItemCart) CountItemWithPriceAboveWithNoDiscount ¶
CountItemWithPriceAboveWithNoDiscount will count items in a cart that have some minimum price
func (*ItemCart) GiveDiscountForItemPriceAbove ¶
GiveDiscountForItemPriceAbove will apply discount to items that have some minimum price.
func (*ItemCart) ShowDiscount ¶
func (cart *ItemCart) ShowDiscount()
ShowDiscount will print out each discounted items.
type ItemPriceChecker ¶
type ItemPriceChecker struct {
}
ItemPriceChecker serve a checker object
func (*ItemPriceChecker) CheckCart ¶
func (cf *ItemPriceChecker) CheckCart()
CheckCart will execute cart checking.
func (*ItemPriceChecker) CheckPrices ¶
func (cf *ItemPriceChecker) CheckPrices()
CheckPrices will test the rule to check item prices.
type MyPoGo ¶
type MyPoGo struct {
}
MyPoGo serve as example plain Plai Old Go Object.
func (*MyPoGo) GetStringLength ¶
GetStringLength will return the length of provided string argument
Click to show internal directories.
Click to hide internal directories.