import "golang.org/x/text/currency"
        
Package currency contains currency-related functionality.
NOTE: the formatting functionality is currently under development and may change without notice.
common.go currency.go format.go tables.go
const CLDRVersion = "28"CLDRVersion is the CLDR version from which the tables in this package are derived.
type Amount struct {
    // contains filtered or unexported fields
}Amount is an amount-currency unit pair.
Currency reports the currency unit of this amount.
Format implements fmt.Formatter. It accepts format.State for language-specific rendering.
type Formatter func(amount interface{}) formattedValueFormatter decorates a given number, Unit or Amount with formatting options.
var (
    // Uses Narrow symbols. Overrides Symbol, if present.
    NarrowSymbol Formatter = Formatter(formNarrow)
    // Use Symbols instead of ISO codes, when available.
    Symbol Formatter = Formatter(formSymbol)
    // Use ISO code as symbol.
    ISO Formatter = Formatter(formISO)
)Default creates a new Formatter that defaults to currency unit c if a numeric value is passed that is not associated with a currency.
Kind sets the kind of the underlying currency unit.
type Kind struct {
    // contains filtered or unexported fields
}Kind determines the rounding and rendering properties of a currency value.
var (
    // Standard defines standard rounding and formatting for currencies.
    Standard Kind = Kind{rounding: standard}
    // Cash defines rounding and formatting standards for cash transactions.
    Cash Kind = Kind{rounding: cash}
    // Accounting defines rounding and formatting standards for accounting.
    Accounting Kind = Kind{rounding: standard}
)Rounding reports the rounding characteristics for the given currency, where scale is the number of fractional decimals and increment is the number of units in terms of 10^(-scale) to which to round to.
type Unit struct {
    // contains filtered or unexported fields
}Unit is an ISO 4217 currency designator.
var (
    // Undefined and testing.
    XXX Unit = Unit{}
    XTS Unit = Unit{xts}
    // G10 currencies https://en.wikipedia.org/wiki/G10_currencies.
    USD Unit = Unit{usd}
    EUR Unit = Unit{eur}
    JPY Unit = Unit{jpy}
    GBP Unit = Unit{gbp}
    CHF Unit = Unit{chf}
    AUD Unit = Unit{aud}
    NZD Unit = Unit{nzd}
    CAD Unit = Unit{cad}
    SEK Unit = Unit{sek}
    NOK Unit = Unit{nok}
    // Additional common currencies as defined by CLDR.
    BRL Unit = Unit{brl}
    CNY Unit = Unit{cny}
    DKK Unit = Unit{dkk}
    INR Unit = Unit{inr}
    RUB Unit = Unit{rub}
    HKD Unit = Unit{hkd}
    IDR Unit = Unit{idr}
    KRW Unit = Unit{krw}
    MXN Unit = Unit{mxn}
    PLN Unit = Unit{pln}
    SAR Unit = Unit{sar}
    THB Unit = Unit{thb}
    TRY Unit = Unit{try}
    TWD Unit = Unit{twd}
    ZAR Unit = Unit{zar}
    // Precious metals.
    XAG Unit = Unit{xag}
    XAU Unit = Unit{xau}
    XPT Unit = Unit{xpt}
    XPD Unit = Unit{xpd}
)FromRegion reports the currency unit that is currently legal tender in the given region according to CLDR. It will return false if region currently does not have a legal tender.
FromTag reports the most likely currency for the given tag. It considers the currency defined in the -u extension and infers the region if necessary.
MustParseISO is like ParseISO, but panics if the given currency unit cannot be parsed. It simplifies safe initialization of Unit values.
ParseISO parses a 3-letter ISO 4217 currency code. It returns an error if s is not well-formed or not a recognized currency code.
Amount creates an Amount for the given currency unit and amount.
String returns the ISO code of u.
Package currency imports 8 packages (graph) and is imported by 3 packages. Updated about 17 hours ago. Refresh now. Tools for package owners.