Versions in this module Expand all Collapse all v1 v1.0.0 Jan 19, 2024 Changes in this version + const CLDRVersion + const DefaultDigits + func ForCountryCode(countryCode string) (currencyCode string, ok bool) + func GetCurrencyCodes() []string + func GetDigits(currencyCode string) (digits uint8, ok bool) + func GetNumericCode(currencyCode string) (numericCode string, ok bool) + func GetSymbol(currencyCode string, locale Locale) (symbol string, ok bool) + func IsValid(currencyCode string) bool + type Amount struct + func CurrencyOrZeroEur(amount, code string) Amount + func NewAmount(n, currencyCode string) (Amount, error) + func NewAmountFromBigInt(n *big.Int, currencyCode string) (Amount, error) + func NewAmountFromInt64(n int64, currencyCode string) (Amount, error) + func (a *Amount) Scan(src interface{}) error + func (a *Amount) UnmarshalBSON(data []byte) error + func (a *Amount) UnmarshalBinary(data []byte) error + func (a *Amount) UnmarshalJSON(data []byte) error + func (a Amount) Add(b Amount) (Amount, error) + func (a Amount) BigInt() *big.Int + func (a Amount) Cmp(b Amount) (int, error) + func (a Amount) Convert(currencyCode, rate string) (Amount, error) + func (a Amount) CurrencyCode() string + func (a Amount) Div(n string) (Amount, error) + func (a Amount) Equal(b Amount) bool + func (a Amount) Int64() (int64, error) + func (a Amount) IsNegative() bool + func (a Amount) IsPositive() bool + func (a Amount) IsZero() bool + func (a Amount) MarshalBSON() ([]byte, error) + func (a Amount) MarshalBinary() ([]byte, error) + func (a Amount) MarshalJSON() ([]byte, error) + func (a Amount) Mul(n string) (Amount, error) + func (a Amount) Number() string + func (a Amount) Round() Amount + func (a Amount) RoundTo(digits uint8, mode RoundingMode) Amount + func (a Amount) String() string + func (a Amount) Sub(b Amount) (Amount, error) + func (a Amount) Value() (driver.Value, error) + type AmountDao struct + CurrencyCode string + Number int64 + type Display uint8 + const DisplayCode + const DisplayNone + const DisplaySymbol + type Formatter struct + AccountingStyle bool + AddPlusSign bool + CurrencyDisplay Display + MaxDigits uint8 + MinDigits uint8 + NoGrouping bool + RoundingMode RoundingMode + SymbolMap map[string]string + func NewFormatter(locale Locale) *Formatter + func (f *Formatter) Format(amount Amount) string + func (f *Formatter) Locale() Locale + func (f *Formatter) Parse(s, currencyCode string) (Amount, error) + type InvalidCurrencyCodeError struct + CurrencyCode string + func (e InvalidCurrencyCodeError) Error() string + type InvalidNumberError struct + Number string + func (e InvalidNumberError) Error() string + type Locale struct + Language string + Script string + Territory string + func NewLocale(id string) Locale + func (l *Locale) UnmarshalText(b []byte) error + func (l Locale) GetParent() Locale + func (l Locale) IsEmpty() bool + func (l Locale) MarshalText() ([]byte, error) + func (l Locale) String() string + type MismatchError struct + A Amount + B Amount + func (e MismatchError) Error() string + type RoundingMode uint8 + const RoundDown + const RoundHalfDown + const RoundHalfEven + const RoundHalfUp + const RoundUp