Documentation
¶
Overview ¶
Package seeddata populates an empty, migrated okpos database with a large, internally-consistent set of fake demo data: two businesses (a retail minimarket and a coffee shop) with realistic historical orders, inventory movement, and expenses.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Business ¶
type Business struct {
Company *model.Company
Branches []*model.Branch
Stations []*model.POSStation
// StationBranchIdx[i] is the index into Branches that Stations[i] belongs to.
StationBranchIdx []int
OwnerID uuid.UUID
ManagerID uuid.UUID
CashierID uuid.UUID
// Sellable holds simple+recipe products orderable at the POS, with a
// parallel popularity Weight used for order-item selection and
// procurement sizing.
Sellable []*model.Product
SellableWeights []float64
// StockTracked holds every product that carries its own stock_movements
// (simple products, which also appear in Sellable, plus ingredients,
// which never appear in Sellable).
StockTracked []*model.Product
UnitCost map[uuid.UUID]int64
// RecipeComponents maps a recipe product ID to its ingredient breakdown.
RecipeComponents map[uuid.UUID][]model.RecipeComponent
Discounts []*model.Discount
StartDate time.Time
AvgOrdersPerDay float64
HourWeights [24]float64
BranchWeights []float64
}
Business holds everything the history generator needs for one seeded company.
func (*Business) TotalDays ¶
TotalDays returns the number of full historical days to simulate: from StartDate through yesterday. Today itself is handled separately by generateTodayHistory, which adds a partial day of activity (through the current hour) while leaving today's session(s) open for live interactive use.
type Config ¶
type Config struct {
// Seed seeds the deterministic RNG driving every random choice. The same
// seed always produces the same dataset.
Seed int64
// Scale multiplies the average daily order count (and therefore most
// downstream row counts). 1.0 is the full ~100 orders/day/business
// dataset described in the design; smaller values are useful for fast
// local smoke tests.
Scale float64
}
Config controls the volume and reproducibility of generated data.
type Stats ¶
type Stats struct {
Companies int
Branches int
Stations int
Users int
Products int
Discounts int
Sessions int
Orders int
OrderItems int
Payments int
StockMovements int
Expenses int
JournalEntries int
}
Stats summarizes what Run generated, for the final CLI report.