cbr

package
v0.0.0-...-87c4436 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Debug = false

Debug mode. If this variable is set to true, debug mode activated for the package.

Functions

func SetLogger

func SetLogger(logger Logger) error

SetLogger specifies the logger that the package should use.

Types

type Client

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

Client is a rates service client.

func NewClient

func NewClient() *Client

NewClient creates a new rates service instance.

func (*Client) GetRate

func (s *Client) GetRate(currency string, t time.Time) (float64, error)

GetRate returns a currency rate for a given currency and date.

type Currency

type Currency struct {
	ID       string `xml:"ID,attr"`
	NumCode  uint   `xml:"NumCode"`
	CharCode string `xml:"CharCode"`
	Nom      uint   `xml:"Nominal"`
	Name     string `xml:"Name"`
	Value    string `xml:"Value"`
}

Currency is a currency item.

type Logger

type Logger interface {
	Println(v ...interface{})
	Printf(format string, v ...interface{})
}

Logger is an interface that represents the required methods to log data.

type Result

type Result struct {
	XMLName    xml.Name   `xml:"ValCurs"`
	Date       string     `xml:"Date,attr"`
	Currencies []Currency `xml:"Valute"`
}

Result is a result representation.

Jump to

Keyboard shortcuts

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