Documentation ¶
Index ¶
- func GetPurchaseHistory(s string) ([]PurchaseHistory, []PurchaseHistory, error)
- func GetTopMembers(nrecords int) (map[int][]MonthlySales, error)
- func GetTopProducts(nrecords int) (map[int][]MonthlySales, error)
- type MemberRecord
- type MonthlySales
- type Product
- type ProductRecord
- type PurchaseHistory
- type SalesRecord
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetPurchaseHistory ¶
func GetPurchaseHistory(s string) ([]PurchaseHistory, []PurchaseHistory, error)
GetPurchaseHistory gets the monthly purchase history of the member queried member name is matched with fuzzy search (loosely)
func GetTopMembers ¶
func GetTopMembers(nrecords int) (map[int][]MonthlySales, error)
func GetTopProducts ¶
func GetTopProducts(nrecords int) (map[int][]MonthlySales, error)
Types ¶
type MemberRecord ¶
type MemberRecord struct { Date time.Time ID string Username string Total float64 Average float64 GrandTotal float64 }
MemberRecord as sales record for different members
func GetDailyMember ¶
func GetDailyMember(d string, n int) ([]MemberRecord, error)
GetDailyMember returns daily member spendings
func GetMonthlyMember ¶
func GetMonthlyMember(d string, n int) ([]MemberRecord, error)
GetMonthlyMember returns daily member spendings
func GetWeeklyMember ¶
func GetWeeklyMember(d string, n int) ([]MemberRecord, error)
GetWeeklyMember returns weekly member spendings TODO: fix lumpsum
type MonthlySales ¶
type Product ¶
type Product struct { ID int // product_id Code string // code Name string // Name URL string // url Price float64 // price ListedPrice float64 // tb_list_price Discount float64 // price Active bool }
Product as the product details of a particular item
func GetProductDetails ¶
GetProductDetails gets product details with the provided product id
type ProductRecord ¶
type ProductRecord struct { Date time.Time Category string ProductID int ProductName string Total float64 Quantity int }
ProductRecord as sales record for differernt products
func GetDailyProduct ¶
func GetDailyProduct(start, end string) ([]ProductRecord, error)
GetDailyProduct returns the latest product sales record for the past n days
func GetMonthlyProduct ¶
func GetMonthlyProduct(d string, n int) ([]ProductRecord, error)
GetMonthlyProduct returns the latest product sales record for the past n months
func GetProductSalesRecords ¶
func GetProductSalesRecords(id int) ([]ProductRecord, error)
GetProductSalesRecords gets the historical record (weekly) of a particular product
func GetWeeklyProduct ¶
func GetWeeklyProduct(d string, n int) ([]ProductRecord, error)
GetWeeklyProduct returns the latest product sales record for the past n weeks
type PurchaseHistory ¶
type SalesRecord ¶
SalesRecord as daily sales for
func GetDailySales ¶
func GetDailySales(start, end string) ([]SalesRecord, error)
GetDailySales returns the latest sales record for the past n days
func GetMonthlySales ¶
func GetMonthlySales(d string, n int) ([]SalesRecord, error)
GetMonthlySales returns the latest sales record for the past n months
func GetWeeklySales ¶
func GetWeeklySales(d string, n int) ([]SalesRecord, error)
GetWeeklySales returns the latest sales record for the past n weeks