Categorygithub.com/aaron-hardin/gopher-money
modulepackage
0.1.4
Repository: https://github.com/aaron-hardin/gopher-money.git
Documentation: pkg.go.dev

# README

Test GoDoc

gopher-money

Command line utility for all things money

gopher-money convert USD JPY 44.3
> 4679.36746875
gopher-money round JPY 44.3
> 44
gopher-money format USD 44.3
> $44.30

Install using the following command

go get github.com/aaron-hardin/gopher-money

gopher-money - rates GoDoc

Wrapper around Open Exchange Rates to provide a convenient way to get current exchange rates

client := rates.NewApiClient(apiKey)
// rates is map[string]float64
// mapping currency code to current exchange rate
rates, err := client.GetRates()

gopher-money - money GoDoc

Provides functionality for using rates to convert between currencies

converter := money.NewConverter(rates)
rawValue, err := converter.Convert(fromCurrencyCode, toCurrencyCode, value)

gopher-money - format GoDoc

Provides functionality for formatting currencies, allows converting to correct precision as well as formatting to string with symbol

When providing a custom format string, %v is used for the value and %s is used for the currency symbol

roundedValue, err := format.Round(currencyCode, value)
displayValue, err := format.Format(currencyCode, value)
displayValue, err = format.FormatAs(currencyCode, value, customFormat)

TODO

  • Add more features to rates library to support more features of Open Exchange Rates

# Packages

Package format is used to format currencies.
Package money provides support for converting between currencies.
Package rates provides support for getting exchange rates from Open Exchange Rates.

# Structs

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author