fixer

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2021 License: MIT Imports: 12 Imported by: 0

Documentation

Overview

Package fixer implements fixer.io provider related code

Index

Constants

View Source
const Code = "fixer"

Code fixer provider code

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	provider.BaseProvider
	// contains filtered or unexported fields
}

Provider implements fixer provider structure

func New

func New(db *gorm.DB, config *model.ApplicationConfig) *Provider

New constructor

func (Provider) BuildEntity

func (p Provider) BuildEntity(endpoint string, baseCurrency string, quotedCurrency string, rate float64, rateDate time.Time, providerDate time.Time) *entity.CurrencyRate

BuildEntity builds entity with given rates

func (Provider) GetCode

func (p Provider) GetCode() string

GetCode returns provider code

func (Provider) GetConfig

func (p Provider) GetConfig() model.ProviderConfig

GetConfig returns provider config

func (Provider) GetHistoricalRates

func (p Provider) GetHistoricalRates(serviceRequest model.RatesRequest) (model.RatesResponse, error)

GetHistoricalRates searches for rates in internal DB, fetch from provider API if needed and saves to internal DB

func (Provider) GetLatestRates

func (p Provider) GetLatestRates(serviceRequest model.RatesRequest) (model.RatesResponse, error)

GetLatestRates return actual rates

func (Provider) GetLocation

func (p Provider) GetLocation() *time.Location

GetLocation returns location for current provider

func (Provider) GetRateGenerationTime

func (p Provider) GetRateGenerationTime() time.Time

GetRateGenerationTime returns historical rates generated time on provider side

func (Provider) GetSupportedCurrencies

func (p Provider) GetSupportedCurrencies() []string

GetSupportedCurrencies returns list of currencies, supported by provider

func (Provider) IsRequestValid

func (p Provider) IsRequestValid(ratesRequest model.RatesRequest) (bool, error)

IsRequestValid validates API call to provider.

func (Provider) PreloadRates

func (p Provider) PreloadRates(date time.Time, save bool) (map[string]float64, map[string]float64, time.Time, error)

PreloadRates preload all available rates for given date

Jump to

Keyboard shortcuts

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