bankiru

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: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Debug mode. Default: false.
	Debug bool
)

Functions

func SetLogger

func SetLogger(logger Logger) error

SetLogger specifies the logger that the package should use.

Types

type Branch

type Branch struct {
	Bank     string    `json:"bank"`
	Subway   string    `json:"subway"`
	Currency string    `json:"currency"`
	Buy      float64   `json:"buy"`
	Sell     float64   `json:"sell"`
	Updated  time.Time `json:"updated"`
}

Bank or branch.

type Branches

type Branches struct {
	Currency Currency `json:"currency"`
	City     City     `json:"city"`
	Items    []Branch `json:"items"`
}

Banks or branches.

func (*Branches) String

func (r *Branches) String() string

String representation of cash currency exchange rates.

type ByBuySorter

type ByBuySorter []Branch

ByBuySorter implements sort.Interface based on the Buy field.

func (ByBuySorter) Len

func (b ByBuySorter) Len() int

Len, Swap and Less implement sort.Interface for ByBuySorter.

func (ByBuySorter) Less

func (b ByBuySorter) Less(i, j int) bool

func (ByBuySorter) Swap

func (b ByBuySorter) Swap(i, j int)

type BySellSorter

type BySellSorter []Branch

BySellSorter implements sort.Interface based on the Sell field.

func (BySellSorter) Len

func (s BySellSorter) Len() int

Len, Swap and Less implement sort.Interface for BySellSorter.

func (BySellSorter) Less

func (s BySellSorter) Less(i, j int) bool

func (BySellSorter) Swap

func (s BySellSorter) Swap(i, j int)

type City

type City string

City type.

const (

	// City.
	Barnaul         City = "barnaul"
	Voronezh        City = "voronezh"
	Volgograd       City = "volgograd"
	Vladivostok     City = "vladivostok"
	Ekaterinburg    City = "ekaterinburg"
	Irkutsk         City = "irkutsk"
	Izhevsk         City = "izhevsk"
	Kazan           City = "kazan~"
	Krasnodar       City = "krasnodar"
	Krasnoyarsk     City = "krasnoyarsk"
	Kaliningrad     City = "kaliningrad"
	Kirov           City = "kirov"
	Kemerovo        City = "kemerovo"
	Moscow          City = "moskva"
	Novosibirsk     City = "novosibirsk"
	NizhnyNovgorod  City = "nizhniy_novgorod"
	Omsk            City = "omsk"
	Orenburg        City = "orenburg"
	Perm            City = "perm~"
	RostovOnDon     City = "rostov-na-donu"
	SaintPetersburg City = "sankt-peterburg"
	Samara          City = "samara"
	Saratov         City = "saratov"
	Sochi           City = "krasnodarskiy_kray/sochi"
	Tyumen          City = "tyumen~"
	Tolyatti        City = "samarskaya_oblast~/tol~yatti"
	Tomsk           City = "tomsk"
	Ufa             City = "ufa"
	Khabarovsk      City = "habarovsk"
	Chelyabinsk     City = "chelyabinsk"
)

type Client

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

Client.

func NewClient

func NewClient() *Client

NewClient creates a new client.

func (*Client) Rates

func (c *Client) Rates(ct City) (*Branches, error)

Rates USDRUB by and city (Moscow, if empty).

type Currency

type Currency string

Currency type.

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.

Jump to

Keyboard shortcuts

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