Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CurrencyBeaconFetcher ¶
type CurrencyBeaconFetcher struct { APIKey string // contains filtered or unexported fields }
func NewCurrencyBeaconFetcher ¶
func NewCurrencyBeaconFetcher(apiKey string) *CurrencyBeaconFetcher
func (*CurrencyBeaconFetcher) SetNext ¶
func (c *CurrencyBeaconFetcher) SetNext(r RateFetcher)
func (*CurrencyBeaconFetcher) String ¶
func (c *CurrencyBeaconFetcher) String() string
func (*CurrencyBeaconFetcher) SupportedCurrencies ¶
func (c *CurrencyBeaconFetcher) SupportedCurrencies(ctx context.Context) []string
type NBURateFetcher ¶
type NBURateFetcher struct {
// contains filtered or unexported fields
}
NBURateFetcher is a RateFetcher implementation that fetches rates from the National Bank of Ukraine API docs: https://bank.gov.ua/ua/open-data/api-dev NOTE: CurrencyTo can only be "UAH", as the NBU API only supports fetching rates for UAH
Example usage:
fetcher := NewNBURateFetcher() rate, err := fetcher.FetchRate(context.Background(), "USD", "UAH") if err != nil { log.Fatal(err) } fmt.Println(rate)
func NewNBURateFetcher ¶
func NewNBURateFetcher() *NBURateFetcher
func (*NBURateFetcher) SetNext ¶
func (n *NBURateFetcher) SetNext(next RateFetcher)
func (*NBURateFetcher) String ¶
func (n *NBURateFetcher) String() string
func (*NBURateFetcher) SupportedCurrencies ¶
func (n *NBURateFetcher) SupportedCurrencies(_ context.Context) []string
type RateFetcher ¶
type RateFetcher interface { FetchRate(ctx context.Context, ccFrom, ccTo string) (rate.Rate, error) SetNext(next RateFetcher) }
RateFetcher is an interface that defines the general behavior of a rate fetcher. This fetcher interfaces presumes the use of Chain of Responsibility pattern.
Click to show internal directories.
Click to hide internal directories.