provider

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

You can add custom sources. Please make them as simple as possible There is no need to use caching or repeated requests The exchanger will regulate the number of repeated requests.

Package provider is a generated GoMock package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExchangeRate

type ExchangeRate interface {
	// Time - date on which the exchange rate was issued
	Time() time.Time
	// From USD to EUR => 1USD ~ 1.17EUR
	From() label.Currency
	To() label.Currency
	Rate() float64
}

ExchangeRate represents the exchange rate of a particular currency pair

type MockExchangeRate

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

MockExchangeRate is a mock of ExchangeRate interface.

func NewMockExchangeRate

func NewMockExchangeRate(ctrl *gomock.Controller) *MockExchangeRate

NewMockExchangeRate creates a new mock instance.

func (*MockExchangeRate) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockExchangeRate) From

func (m *MockExchangeRate) From() label.Currency

From mocks base method.

func (*MockExchangeRate) Rate

func (m *MockExchangeRate) Rate() float64

Rate mocks base method.

func (*MockExchangeRate) Time

func (m *MockExchangeRate) Time() time.Time

Time mocks base method.

func (*MockExchangeRate) To

To mocks base method.

type MockExchangeRateMockRecorder

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

MockExchangeRateMockRecorder is the mock recorder for MockExchangeRate.

func (*MockExchangeRateMockRecorder) From

From indicates an expected call of From.

func (*MockExchangeRateMockRecorder) Rate

Rate indicates an expected call of Rate.

func (*MockExchangeRateMockRecorder) Time

Time indicates an expected call of Time.

func (*MockExchangeRateMockRecorder) To

To indicates an expected call of To.

type MockSource

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

MockSource is a mock of Source interface.

func NewMockSource

func NewMockSource(ctrl *gomock.Controller) *MockSource

NewMockSource creates a new mock instance.

func (*MockSource) EXPECT

func (m *MockSource) EXPECT() *MockSourceMockRecorder

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockSource) FetchLatest

func (m *MockSource) FetchLatest(ctx context.Context) ([]ExchangeRate, error)

FetchLatest mocks base method.

func (*MockSource) GetExchangeable

func (m *MockSource) GetExchangeable() []label.Symbol

GetExchangeable mocks base method.

type MockSourceMockRecorder

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

MockSourceMockRecorder is the mock recorder for MockSource.

func (*MockSourceMockRecorder) FetchLatest

func (mr *MockSourceMockRecorder) FetchLatest(ctx interface{}) *gomock.Call

FetchLatest indicates an expected call of FetchLatest.

func (*MockSourceMockRecorder) GetExchangeable

func (mr *MockSourceMockRecorder) GetExchangeable() *gomock.Call

GetExchangeable indicates an expected call of GetExchangeable.

type Source

type Source interface {
	// FetchLatest  of obtaining the latest exchange rate data
	FetchLatest(ctx context.Context) ([]ExchangeRate, error)

	// GetExchangeable declares to give a list of exchangeable currencies
	GetExchangeable() []label.Symbol
}

Source is an interface for getting data from external sources. Source takes care of receiving data, working with proxies and giving back exchange rates

Directories

Path Synopsis
This is the source of exchange rates from the Central European Bank.
This is the source of exchange rates from the Central European Bank.

Jump to

Keyboard shortcuts

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