Documentation
¶
Overview ¶
Package costcenter provides cost center hierarchy management
Index ¶
- type CostCenter
- type CostCenterHierarchy
- func (h *CostCenterHierarchy) AddCenter(center *CostCenter) error
- func (h *CostCenterHierarchy) GetBudgetUtilization(id string) (float64, error)
- func (h *CostCenterHierarchy) GetCenter(id string) (*CostCenter, error)
- func (h *CostCenterHierarchy) GetChildren(id string) []*CostCenter
- func (h *CostCenterHierarchy) GetHierarchyReport() []HierarchyReport
- func (h *CostCenterHierarchy) GetRootCenters() []*CostCenter
- func (h *CostCenterHierarchy) UpdateSpend(id string, amount float64) error
- type HierarchyReport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CostCenter ¶
type CostCenter struct {
ID string
Name string
Description string
ParentID string
Children []string
Budget float64
ActualSpend float64
Owner string
Tags map[string]string
CreatedAt time.Time
UpdatedAt time.Time
}
CostCenter represents a cost center in the hierarchy
type CostCenterHierarchy ¶
type CostCenterHierarchy struct {
// contains filtered or unexported fields
}
CostCenterHierarchy manages the cost center hierarchy
func NewCostCenterHierarchy ¶
func NewCostCenterHierarchy() *CostCenterHierarchy
NewCostCenterHierarchy creates a new hierarchy
func (*CostCenterHierarchy) AddCenter ¶
func (h *CostCenterHierarchy) AddCenter(center *CostCenter) error
AddCenter adds a cost center
func (*CostCenterHierarchy) GetBudgetUtilization ¶
func (h *CostCenterHierarchy) GetBudgetUtilization(id string) (float64, error)
GetBudgetUtilization returns budget utilization for a cost center
func (*CostCenterHierarchy) GetCenter ¶
func (h *CostCenterHierarchy) GetCenter(id string) (*CostCenter, error)
GetCenter returns a cost center by ID
func (*CostCenterHierarchy) GetChildren ¶
func (h *CostCenterHierarchy) GetChildren(id string) []*CostCenter
GetChildren returns all children of a cost center
func (*CostCenterHierarchy) GetHierarchyReport ¶
func (h *CostCenterHierarchy) GetHierarchyReport() []HierarchyReport
GetHierarchyReport returns a report of the entire hierarchy
func (*CostCenterHierarchy) GetRootCenters ¶
func (h *CostCenterHierarchy) GetRootCenters() []*CostCenter
GetRootCenters returns all root cost centers
func (*CostCenterHierarchy) UpdateSpend ¶
func (h *CostCenterHierarchy) UpdateSpend(id string, amount float64) error
UpdateSpend updates the actual spend for a cost center
type HierarchyReport ¶
type HierarchyReport struct {
ID string `json:"id"`
Name string `json:"name"`
ParentID string `json:"parent_id"`
Budget float64 `json:"budget"`
ActualSpend float64 `json:"actual_spend"`
Utilization float64 `json:"utilization"`
ChildrenCount int `json:"children_count"`
Owner string `json:"owner"`
}
HierarchyReport represents a cost center report
Click to show internal directories.
Click to hide internal directories.