Documentation
¶
Index ¶
- Variables
- func Capitalize(s string) string
- func FilteredSlice[T any](arr []T, test func(T) bool) []T
- func FoldSlice[T any, U any, R any](slice []T, f func(T, R) R, initial R) R
- func FormatPrice(price float64, curr string) (string, error)
- func GenerateNonce() (string, error)
- func GenerateUniqueID() uint
- func IncreaseHTTPRequestCount(method, path string, status int)
- func MapSlice[T any, U any](slice []T, f func(T) U) []U
- func MustRenderHTML(page templ.Component) []byte
- func NormalizeFloatStrToIntStr(number string) string
- func ParseNumberString(input string) (int64, error)
- func RecordBusinessEvent(eventType string)
- func RecordDBQueryLatency(queryType string, start time.Time)
- func RecordHTTPRequestDuration(method, path string, status int, duration float64)
- func RenderHTML(page templ.Component) ([]byte, error)
- func Shuffle(slice []string)
- func SortSlice[T any](arr []T, less func(a, b T) bool)
- type CalculationResults
- type MonthCalcResults
- type Reporter
- type Severity
- type SeverityType
- type YearCalcResults
Constants ¶
This section is empty.
Variables ¶
View Source
var SeverityLevels = &Severity{
PANIC: "PANIC",
ERROR: "ERROR",
WARN: "WARN",
INFO: "INFO",
DEBUG: "DEBUG",
}
Instantiate Severity constants
Functions ¶
func Capitalize ¶
func FilteredSlice ¶
func GenerateNonce ¶
func GenerateUniqueID ¶
func GenerateUniqueID() uint
func MustRenderHTML ¶
func ParseNumberString ¶
func RecordBusinessEvent ¶
func RecordBusinessEvent(eventType string)
RecordBusinessEvent is a helper to record a business event
func RecordDBQueryLatency ¶
RecordDBQueryLatency is a helper to record database query latency
Types ¶
type CalculationResults ¶
type CalculationResults struct {
SID string `json:"sid"`
Price string `json:"price"`
Principal string `json:"principal"`
Rate string `json:"rate"`
RateFreq string `json:"rateFreq"`
Currency string `json:"currency"`
Profit string `json:"profit"`
TotalContributions string `json:"totalContributions"`
ContribFreq string `json:"contribFreq"`
FinalBalance string `json:"finalBalance"`
YearResults []YearCalcResults `json:"yearResults"`
}
CalculationResults stores the final output
func CalculateHISAInvestment ¶
func CalculateInvestment ¶
func CalculateInvestment(sid string, stockPrice, dividendYield, expenseRatio, principal, contribution float64, contributionFreqStr, dividendFreqStr string, annualPriceIncreasePercent, annualDividendIncreasePercent float64, compoundingYears int, payoutMonth int, currency string, ) (CalculationResults, error)
Function to calculate investment results
func DecodeResults ¶
func DecodeResults(encoded string) (CalculationResults, error)
func (CalculationResults) Encoded ¶
func (cr CalculationResults) Encoded() (string, error)
type MonthCalcResults ¶
type MonthCalcResults struct {
MonthName string `json:"monthName"`
Contributions string `json:"contributions"`
MonthlyGainedFromPriceInc string `json:"monthlyGainedFromPriceIncrease"`
MonthlyGainedFromDividends string `json:"monthlyGainedFromDividends"`
MonthlyGain string `json:"monthlyGain"`
CumGain string `json:"cumGain"`
Balance string `json:"balance"`
Return string `json:"return"`
DRIP string `json:"drip"`
}
MonthCalcResults stores monthly calculations
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
func NewReporter ¶
type Severity ¶
type Severity struct {
PANIC SeverityType
ERROR SeverityType
WARN SeverityType
INFO SeverityType
DEBUG SeverityType
}
Structured Severity "enum"
type YearCalcResults ¶
type YearCalcResults struct {
YearName string `json:"yearName"`
TotalYearGains string `json:"totalYearGains"`
CumGain string `json:"cumGain"`
YoyGrowth string `json:"yoyGrowth"`
TotalGrowth string `json:"totalGrowth"`
Balance string `json:"balance"`
MonthsResults []MonthCalcResults `json:"monthsResults"`
}
YearCalcResults stores yearly calculations
Click to show internal directories.
Click to hide internal directories.