controllers

package
v0.0.0-...-4467631 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrLoad = "can't pull currency prices from site: %v"
	ErrXML  = "can't extract xml data"
)
View Source
const (
	ErrID = "must be id in query"
)

Variables

This section is empty.

Functions

func XMLExtract

func XMLExtract(rc io.ReadCloser) ([]*entity.Currency, error)

func XMLValutesToCurrencies

func XMLValutesToCurrencies(vls []Valute) ([]*entity.Currency, error)

Types

type HTTPClient

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

func NewHTTPClient

func NewHTTPClient(url string, timeout time.Duration) *HTTPClient

func (*HTTPClient) Load

func (hc *HTTPClient) Load(ctx context.Context) ([]*entity.Currency, error)

type HTTPServer

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

func NewHttpServer

func NewHttpServer(addr string, logger usecase.Logger, currencier usecase.Currencier) *HTTPServer

func (*HTTPServer) Serve

func (s *HTTPServer) Serve() error

func (*HTTPServer) StopServe

func (s *HTTPServer) StopServe()

type ValCurs

type ValCurs struct {
	Valute []Valute `xml:"Valute"`
}

type Valute

type Valute struct {
	ID       string `xml:"ID,attr"`
	NumCode  int    `xml:"NumCode"`
	CharCode string `xml:"CharCode"`
	Nominal  int    `xml:"Nominal"`
	Name     string `xml:"Name"`
	Value    string `xml:"Value"`
}

Jump to

Keyboard shortcuts

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