currency_rates

package
v0.0.0-...-4d895cd Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BaseCurrency = currency.USD
View Source
var SupportedCurrencies = []currency.Code{
	currency.USD,
	currency.EUR,
	currency.THB,
	currency.RUB,
}

Functions

This section is empty.

Types

type OpenExchangeRatesAPI

type OpenExchangeRatesAPI interface {
	GetByDate(base currency.Code, symbols []currency.Code, date datetime.Date) (*openexchange.HistoricalRates, error)
}

type RatesRepository

type RatesRepository interface {
	SetCurrencyRatesByDate(ctx context.Context, rates map[currency.Code]float64, date datetime.DateTime) error
	GetCurrencyRateByDate(ctx context.Context, code currency.Code, date datetime.DateTime) (float64, error)
}

type Service

type Service struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(rates RatesRepository, api OpenExchangeRatesAPI) *Service

func (*Service) Convert

func (s *Service) Convert(ctx context.Context, amount currency.Amount, to currency.Code, date datetime.DateTime) (*currency.Amount, error)

Jump to

Keyboard shortcuts

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