Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidMoneyObject = errors.New("missing exchange rates")
View Source
var ErrUnsupportedCurrency = errors.New("unsupported currency")
Functions ¶
This section is empty.
Types ¶
type Money ¶
type Money struct { // Amount which needs to be converted Amount float64 // Base currency of the amount. BaseCurrency string // contains filtered or unexported fields }
Represents the basic Money unit. Contains 3 main fields, viz., Amount, BaseCurrency and CurrConversion
func NewMoney ¶
Returns a new Money instance amount: [float64] Amount of the currency you want the money struct to be initialted with baseCurrency: [string] 3 char value of string. Accepted values are (case insensitive)
[]string{ "USD", "JPY", "BGN", "CZK", "DKK", "GBP", "HUF", "PLN", "RON", "SEK", "CHF", "NOK", "HRK", "RUB", "TRY", "AUD", "BRL", "CAD", "CNY", "HKD", "IDR", "ILS", "INR", "KRW", "MXN", "MYR", "NZD", "PHP", "SGD", "THB", "ZAR", }
func (*Money) Convert ¶
Converts the money into the currency inputted currency: [string] 3 char value of string. Accepted values are (case insensitive)
[]string{ "USD", "JPY", "BGN", "CZK", "DKK", "GBP", "HUF", "PLN", "RON", "SEK", "CHF", "NOK", "HRK", "RUB", "TRY", "AUD", "BRL", "CAD", "CNY", "HKD", "IDR", "ILS", "INR", "KRW", "MXN", "MYR", "NZD", "PHP", "SGD", "THB", "ZAR", }
Click to show internal directories.
Click to hide internal directories.