bnm

package module
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2018 License: MIT Imports: 5 Imported by: 0

README

bnm-go

Go library used to get official exchange rates of National bank of Moldova

Build Status Latest Stable Version [![license](https://img.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Inst

type Inst struct{}

Main Inst instance

func NewBnm

func NewBnm() Inst

Create new Inst instance

func (Inst) Request

func (bnm Inst) Request(q Query) (Result, error)

Request BNM rates by using Query

type Query

type Query struct {
	Locale string
	Date   time.Time
}

Query struct used to describe request query

func NewQuery

func NewQuery(locale string, date time.Time) Query

Create new Query instance

func (Query) DateToString

func (q Query) DateToString() string

Convert date to string

func (Query) GenerateUri

func (q Query) GenerateUri() string

Use query to generate URI used for GET request

func (Query) GetId

func (q Query) GetId() string

Get id

type Rate

type Rate struct {
	Code  string  `xml:"CharCode" json:"code"`
	Name  string  `json:"name"`
	Value float32 `json:"value"`
}

Rate model

type Result

type Result struct {
	Rates []Rate `xml:"Valute",json:"rates"`
}

Parsed XML

func (Result) FindByCode

func (r Result) FindByCode(code string) (Rate, bool)

Find one rate by code

Jump to

Keyboard shortcuts

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