Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseProvider ¶
type BaseProvider struct { }
BaseProvider implements base provider functionality
func (*BaseProvider) BuildEntity ¶
func (b *BaseProvider) BuildEntity(endpoint string, providerCode string, baseCurrency string, quotedCurrency string, rate float64, rateTime time.Time, providerTime time.Time) *entity.CurrencyRate
BuildEntity builds entity with given rates
func (*BaseProvider) GetRateGenerationTime ¶
func (b *BaseProvider) GetRateGenerationTime(timeStr string) time.Time
GetRateGenerationTime returns time, when provider generates history rates for today and we can fetch it.
func (*BaseProvider) IsRequestValid ¶
func (b *BaseProvider) IsRequestValid(p RatesProvider, ratesRequest model.RatesRequest) (bool, error)
IsRequestValid validates API call to provider.
type RatesProvider ¶
type RatesProvider interface { GetCode() string GetConfig() model.ProviderConfig GetHistoricalRates(ratesRequest model.RatesRequest) (model.RatesResponse, error) GetLatestRates(ratesRequest model.RatesRequest) (model.RatesResponse, error) PreloadRates(date time.Time, save bool) (map[string]float64, map[string]float64, time.Time, error) GetRateGenerationTime() time.Time GetSupportedCurrencies() []string IsRequestValid(ratesRequest model.RatesRequest) (bool, error) GetLocation() *time.Location BuildEntity(endpoint string, baseCurrency string, quotedCurrency string, rate float64, rateDate time.Time, providerDate time.Time) *entity.CurrencyRate }
RatesProvider for all currency rates providers
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry is providers container
func (*Registry) AddProvider ¶
func (r *Registry) AddProvider(provider RatesProvider)
AddProvider add provider instance to Registry
func (*Registry) GetProvider ¶
func (r *Registry) GetProvider(code string) (RatesProvider, error)
GetProvider returns provider's instance from Registry by code
Click to show internal directories.
Click to hide internal directories.