data

package
v0.0.0-...-8150c3c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2020 License: MIT Imports: 8 Imported by: 0

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

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL