service

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2022 License: MIT Imports: 10 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

ErrorResponse is used when something went wrong.

type PriceResponse

type PriceResponse struct {
	Source            string  `json:"source"`
	Base              string  `json:"base"`
	BaseReal          string  `json:"base_real"`
	Quote             string  `json:"quote"`
	QuoteReal         string  `json:"quote_real"`
	Price             float64 `json:"price"`
	LastUpdatedReal   string  `json:"lastUpdatedReal"`
	LastUpdatedWander string  `json:"lastUpdatedWander"`
}

PriceResponse gives the detail on one price.

type PricesResponse

type PricesResponse struct {
	Prices []*PriceResponse `json:"prices"`
}

PricesResponse gives details on multiple prices.

type Service

type Service struct {
	*httprouter.Router
	// contains filtered or unexported fields
}

Service is the HTTP service.

func NewService

func NewService(config config.Config) (*Service, error)

NewService creates a new service instance (with optional mocks for test purposes).

func (*Service) PricesGet

func (s *Service) PricesGet(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

PricesGet gets information on all prices.

func (*Service) SourceGet

func (s *Service) SourceGet(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

SourceGet gets information on one price.

func (*Service) SourcesGet

func (s *Service) SourcesGet(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

SourcesGet gets information on all prices.

func (*Service) Start

func (s *Service) Start() error

Start starts the HTTP server, and returns the server's exit error (if any).

func (*Service) StatusGet

func (s *Service) StatusGet(w http.ResponseWriter, r *http.Request, ps httprouter.Params)

StatusGet says all is well.

func (*Service) Stop

func (s *Service) Stop()

Stop stops the HTTP service.

Jump to

Keyboard shortcuts

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