Documentation
¶
Index ¶
- func AmountRound(x float64, decimalPlace int) float64
- func CalculateDistance(lat1, lng1, lat2, lng2 float64) float64
- func CalculateExcludeTax(subtotalExclTax float64, taxRate float64) float64
- func CalculateIncludeTax(subtotalInclTax float64, taxRate float64) float64
- func ContainsString(arr []string, str string) bool
- func CreateSlugFromTitle(title string) string
- func CreateUsernameFromFullName(fullName string) string
- func FileHeaderToBytes(fileHeader *multipart.FileHeader) ([]byte, error)
- func FilenameTrimSpace(filename string) string
- func FixRequest(request *http.Request)
- func FormatCurrency(amount float64) string
- func FormatDateIndonesian(date time.Time) string
- func FormatFloatWithThousandSeparator(number float64) string
- func FormatRupiah(amount float64) string
- func GenTemplate(layout, body string, data any) (string, error)
- func GenerateHTMLPDF(dataHtml string, footer string) ([]byte, error)
- func GenerateInvoicePDF(data InvoicePDF, templatePath string, footer string) ([]byte, error)
- func GenerateJWT(userID string, expiredAt int64, secretKey string) (string, error)
- func GenerateOrderReceipt(data ReceiptData, templatePath string) ([]byte, error)
- func GeneratePDF(wkhtmltopdfPath, footer, html string) ([]byte, error)
- func GenerateRandomNumber(length int) string
- func GenerateRandomString(length int) string
- func GetMimeType(url string) string
- func HandleDBError(err error) error
- func IntegerToRoman(number int) string
- func IsValidEmail(email string) bool
- func LogJson(data interface{})
- func LogPrint(v ...any)
- func LogPrintf(format string, v ...any)
- func NumToAlphabet(num int) string
- func ParseDate(dateStr string) (time.Time, error)
- func ParsePhoneNumber(value string, country string) string
- func ParseTime(hm string) time.Time
- func PtrFloat64(value float64) *float64
- func PtrInt(value int) *int
- func RandString(n int, uppercase bool) string
- func RandomStringNumber(n int, uppercase bool) string
- func ReduceMap(data map[string]interface{}, keys []string) map[string]interface{}
- func RenderFromDBTemplate(tmplString string, data any) (string, error)
- func SaveJson(data interface{})
- func StringOrEmpty(s *string) string
- func URLify(str string) string
- func Uuid() string
- func ValidateEmail(email string) bool
- type InvoicePDF
- type InvoicePDFContact
- type InvoicePDFItem
- type InvoicePDFPayment
- type ReceiptData
- type ReceiptItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AmountRound ¶
func CalculateDistance ¶
func CalculateExcludeTax ¶
func CalculateIncludeTax ¶
func ContainsString ¶
func CreateSlugFromTitle ¶
func CreateUsernameFromFullName ¶
CreateUsernameFromFullName creates a username from a full name
func FileHeaderToBytes ¶
func FileHeaderToBytes(fileHeader *multipart.FileHeader) ([]byte, error)
func FilenameTrimSpace ¶
func FixRequest ¶
func FormatCurrency ¶
func FormatDateIndonesian ¶
func FormatRupiah ¶
func GenerateInvoicePDF ¶
func GenerateInvoicePDF(data InvoicePDF, templatePath string, footer string) ([]byte, error)
func GenerateJWT ¶
func GenerateOrderReceipt ¶
func GenerateOrderReceipt(data ReceiptData, templatePath string) ([]byte, error)
func GeneratePDF ¶
func GenerateRandomNumber ¶
func GenerateRandomString ¶
func GetMimeType ¶
func HandleDBError ¶
func IntegerToRoman ¶
func IsValidEmail ¶
func LogPrint ¶
func LogPrint(v ...any)
LogPrint print error message with RFC3339 timestamp. This function is used to log error message from goroutine.
func NumToAlphabet ¶
func ParsePhoneNumber ¶
func PtrFloat64 ¶
Helper function to return pointer to a float64
func RandString ¶
RandString generates a random string of length n
func RandomStringNumber ¶
RandomStringNumber generates a random string of length n including numbers
func StringOrEmpty ¶
func ValidateEmail ¶
Types ¶
type InvoicePDF ¶
type InvoicePDF struct {
Company InvoicePDFContact
Number string
Date string
DueDate string
Items []InvoicePDFItem
SubTotal string
TotalDiscount string
AfterDiscount string
TotalTax string
GrandTotal string
InvoicePayments []InvoicePDFPayment
Balance string
Paid string
BilledTo InvoicePDFContact
ShippedTo InvoicePDFContact
TermCondition string
PaymentTerms string
ShowCompany bool
ShowShipped bool
}
type InvoicePDFContact ¶
type InvoicePDFItem ¶
type InvoicePDFPayment ¶
type ReceiptData ¶
type ReceiptData struct {
Items []ReceiptItem `json:"items"`
SubTotalPrice string `json:"sub_total_price"`
DiscountAmount string `json:"discount_amount"`
TotalPrice string `json:"total_price"`
CashierName string `json:"cashier_name"`
Code string `json:"code"`
Date string `json:"date"`
CustomerName string `json:"customer_name"`
MerchantName string `json:"merchant_name"`
MerchantAddress string `json:"merchant_address"`
}
Directories
¶
| Path | Synopsis |
|---|---|
|
Package fin is a library containing a collection of financial functions for time value of money (annuities), cash flow, interest rate conversions, bonds and depreciation calculations.
|
Package fin is a library containing a collection of financial functions for time value of money (annuities), cash flow, interest rate conversions, bonds and depreciation calculations. |
Click to show internal directories.
Click to hide internal directories.