Documentation ¶
Index ¶
- Constants
- Variables
- func CurrencyCanonical(value string) string
- func CurrencyCodeKnown(value string) bool
- func CurrencyCodes0D() []string
- func CurrencyCodes3D() []string
- func CurrencyCodesAll() []string
- func MustSymbol(iso4217 string) string
- func MustSymbolOrDefault(iso4217, defSymbol string) string
- func ParseCurrency(opts *ParseCurrencyOpts, s string) (string, float64, error)
- func ParseCurrencyUnit(abbr, symbol string) (string, error)
- func Symbol(iso4217 string) (string, error)
- func SymbolPrefix(iso4217 string) string
- type Currencies
- type Currency
- type CurrencySet
- type ExchangeRateSimple
- type ParseCurrencyOpts
Constants ¶
View Source
const ( CurrencyAFN = "AFN" // Afghanistan Afghani CurrencyALL = "ALL" // Albania Lek CurrencyANG = "ANG" // Netherlands Antilles Guilder CurrencyARS = "ARS" // Argentina Peso CurrencyAUD = "AUD" // Australia Dollar CurrencyAWG = "AWG" // Aruba Guilder CurrencyAZN = "AZN" // Azerbaijan New Manat CurrencyBAM = "BAM" // Bosnia and Herzegovina Convertible Marka CurrencyBBD = "BBD" // Barbados Dollar CurrencyBGN = "BGN" // Bulgaria Lev CurrencyBHD = "BHD" // Bahrain Dinar CurrencyBIF = "BIF" // Burundian Franc CurrencyBMD = "BMD" // Bermuda Dollar CurrencyBND = "BND" // Brunei Darussalam Dollar CurrencyBOB = "BOB" // Bolivia Bolíviano CurrencyBRL = "BRL" // Brazil Real CurrencyBSD = "BSD" // Bahamas Dollar CurrencyBTC = "BTC" // Crypto Bitcoin CurrencyBWP = "BWP" // Botswana Pula CurrencyBYN = "BYN" // Belarus Ruble CurrencyBZD = "BZD" // Belize Dollar CurrencyCAD = "CAD" // Canada Dollar CurrencyCHF = "CHF" // Switzerland Franc CurrencyCLP = "CLP" // Chile Peso CurrencyCNY = "CNY" // China Yuan Renminbi CurrencyCRC = "CRC" // Costa Rica Colon CurrencyCUP = "CUP" // Cuba Peso CurrencyDJF = "DJF" // Djibouti Franc CurrencyDKK = "DKK" // Danish Krone CurrencyEGP = "EGP" // Egypt Pound CurrencyETH = "ETH" // Crypto Ether CurrencyEUR = "EUR" // Eurozone Euro CurrencyFKP = "FKP" // Falkland Islands Pound CurrencyGBP = "GBP" // United Kingdom Pound CurrencyGNF = "GNF" // Guinean Franc CurrencyHKD = "HKD" // Hong Kong Dollar CurrencyIDR = "IDR" // Indonesian Rupiah CurrencyILS = "ILS" // Israel Shekel CurrencyINR = "INR" // Indian Rupee CurrencyIRR = "IRR" // Iran Rial CurrencyJOD = "JOD" // Jordan Dinar CurrencyJPY = "JPY" // Japan Yen CurrencyKGS = "KGS" // Kyrgyzstan Som CurrencyKHR = "KHR" // Cambodia Riel CurrencyKMF = "KMF" // Comorian Franc CurrencyKPW = "KPW" // North Korea Won CurrencyKRW = "KRW" // South Korea Won CurrencyKWD = "KWD" // Kuwait Dinar CurrencyLKR = "LKR" // Sri Lanka Rupee CurrencyLTC = "LTC" // Crypto Litecoin CurrencyMGA = "MGA" // Malagasy Ariary CurrencyMNT = "MNT" // Mongolia Tughrik CurrencyMUR = "MUR" // Mauritius Rupee CurrencyMXN = "MXN" // Mexican Peso CurrencyMYR = "MYR" // Malaysia Ringgit CurrencyNGN = "NGN" // Nigeria Naira CurrencyNOK = "NOK" // Norway Krone CurrencyNPR = "NPR" // Nepal Rupee CurrencyNZD = "NZD" // New Zealand Dollar CurrencyOMR = "OMR" // Oman Rial CurrencyPHP = "PHP" // Philippines Peso CurrencyPKR = "PKR" // Pakistan Rupee CurrencyPLN = "PLN" // Poland Zloty CurrencyPYG = "PYG" // Paraguayan Guarani CurrencyQAR = "QAR" // Qatar Riyal CurrencyRON = "RON" // Romania New Leu CurrencyRSD = "RSD" // Serbia Dinar CurrencyRUB = "RUB" // Russia Ruble CurrencyRWF = "RWF" // Rwandan Franc CurrencySAR = "SAR" // Saudi Arabia Riyal CurrencySCR = "SCR" // Seychelles Rupee CurrencySEK = "SEK" // Sweden Krona CurrencySGD = "SGD" // Singapore Dollar CurrencySYP = "SYP" // Syria Pound CurrencyTHB = "THB" // Thailand Baht CurrencyTND = "TND" // Tunisia Dinar CurrencyTRY = "TRY" // Turkey Lira CurrencyTWD = "TWD" // Taiwan Dollar CurrencyUAH = "UAH" // Ukraine Hryvnia CurrencyUGX = "UGX" // Uganda Shilling CurrencyUSD = "USD" // United States Dollar CurrencyUZS = "UZS" // Uzbekistan Som CurrencyVND = "VND" // Viet Nam Dong CurrencyVUV = "VUV" // Vanuatu Vatu CurrencyXAF = "XAF" // Central African CFA Franc CurrencyXAG = "XAG" // Metal Silver CurrencyXAU = "XAU" // Metal Gold CurrencyXOF = "XOF" // West African CFA Franc CurrencyXPD = "XPD" // Metal Palladium CurrencyXPF = "XPF" // CFP Franc CurrencyXPT = "XPT" // Metal Platinum CurrencyXTS = "XTS" // Testing Testing CurrencyXXX = "XXX" // Undefined Undefined CurrencyYER = "YER" // Yemen Rial CurrencyZAR = "ZAR" // South Africa Rand )
View Source
const ( USDSymbol = "$" UnitsBillionsDesc = "billions" UnitsBillionsInt = 1000000000 UnitsMillionsDesc = "millions" UnitsMillionsInt = 1000000 UnitsThousandsDesc = "thousands" UnitsThousandsInt = 1000 )
Variables ¶
View Source
var ( ErrUnknownCurrencyPrefix = errors.New("unknown currency prefix") ErrUnknownCurrencySuffix = errors.New("unknown currency suffix") )
View Source
var ErrNoCurrencyCode = errors.New("currency code not set")
View Source
var ErrSymbolNotFound = errors.New("symbol not found")
View Source
var SymbolMap = map[string]string{
"AFN": "؋",
"ARS": "$",
"AWG": "ƒ",
"BRL": "R$",
"CAD": "$",
"CLP": "$",
"CNY": "¥",
"CRC": "₡",
"CUP": "₱",
"EGP": "£",
"EUR": "€",
"FKP": "£",
"GBP": "£",
"ILS": "₪",
"IRR": "﷼",
"JPY": "¥",
"KHR": "៛",
"KLR": "₨",
"KPW": "₩",
"KRW": "₩",
"MNT": "₮",
"NGN": "₦",
"NOK": "kr",
"PHP": "₱",
"PLN": "zł",
"RUB": "₽",
"SAR": "﷼",
"THB": "฿",
"UAH": "₴",
"USD": "$",
"UZS": "лв",
"VND": "₫",
"YER": "﷼"}
Functions ¶
func CurrencyCanonical ¶
func CurrencyCodeKnown ¶
func CurrencyCodes0D ¶
func CurrencyCodes0D() []string
CurrencyCodes0D returns zero decimal currencies. Listed at: https://stripe.com/docs/currencies
func CurrencyCodes3D ¶
func CurrencyCodes3D() []string
CurrencyCodes3D returns three decimal currencies. Listed at: https://stripe.com/docs/currencies
func CurrencyCodesAll ¶
func CurrencyCodesAll() []string
func MustSymbol ¶
func MustSymbolOrDefault ¶
func ParseCurrency ¶
func ParseCurrency(opts *ParseCurrencyOpts, s string) (string, float64, error)
func ParseCurrencyUnit ¶
func SymbolPrefix ¶
Types ¶
type Currencies ¶
type Currencies []Currency
func (Currencies) Codes ¶
func (c Currencies) Codes() []string
type CurrencySet ¶
func NewCurrencySet ¶
func NewCurrencySet(c ...Currency) (CurrencySet, error)
func (*CurrencySet) Add ¶
func (set *CurrencySet) Add(c ...Currency) error
func (CurrencySet) Codes ¶
func (set CurrencySet) Codes() []string
type ExchangeRateSimple ¶
func ExampleExchangeRates ¶
func ExampleExchangeRates() ExchangeRateSimple
func (*ExchangeRateSimple) ConvertToBase ¶
func (xr *ExchangeRateSimple) ConvertToBase(in float64, cur string) (float64, error)
type ParseCurrencyOpts ¶
type ParseCurrencyOpts struct { Comma string Decimal string BillionsAbbr []string MillionsAbbr []string ThousandsAbbr []string }
func NewParseCurrencyOpts ¶
func NewParseCurrencyOpts() ParseCurrencyOpts
Source Files ¶
Click to show internal directories.
Click to hide internal directories.