Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Currencies ¶
type Currencies struct {
// contains filtered or unexported fields
}
func NewCurrencies ¶
func NewCurrencies(l hclog.Logger) *Currencies
func (*Currencies) GetCurencies ¶
func (c *Currencies) GetCurencies() ([]string, error)
type ExchangeRate ¶
type ExchangeRate struct {
// contains filtered or unexported fields
}
func NewExchangeRate ¶
func NewExchangeRate(l hclog.Logger) (*ExchangeRate, error)
NewExchangeRate returns a new instance of Exchange rate. Sigleton
func (*ExchangeRate) GetRate ¶
func (e *ExchangeRate) GetRate(base, destination string) (float64, error)
Get rate returns the ratio from base and destination rates for conversion between different currencies
func (*ExchangeRate) MonitorRates ¶
func (e *ExchangeRate) MonitorRates(interval time.Duration) chan struct{}
MonitorRates checks the rates in the EXChangerate API every interval and sends a message to the returned channel when there are changes
Note: the ECB API only returns data once a day, this function only simulates the changes in rates for demonstration purposes
Click to show internal directories.
Click to hide internal directories.