coin

package
v0.0.0-...-c74069a Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

Types

type Coins

type Coins struct {
	Symbol string `json:"symbol"`
	Price  string `json:"price"`
}

type CoinsPageableResponse

type CoinsPageableResponse struct {
	Coins []Coins `json:"coins"`
	Page  Page    `json:"page"`
}

type Handler

type Handler struct {
	Service Service
}

func NewHandler

func NewHandler(service Service) Handler

func (*Handler) GetAllCoinHandler

func (h *Handler) GetAllCoinHandler(c *fiber.Ctx) error

func (*Handler) GetAllSpotsHandler

func (h *Handler) GetAllSpotsHandler(c *fiber.Ctx) error

func (*Handler) SetupApp

func (h *Handler) SetupApp(app *fiber.App)

type Page

type Page struct {
	Number        int `json:"number"`
	Size          int `json:"size",omitempty`
	TotalElements int `json:"totalElements",omitempty"`
	TotalPages    int `json:"totalPages",omitempty"`
}

type Repository

type Repository struct {
	MongoClient *mongo.Client
}

func NewRepository

func NewRepository(uri string) Repository

func (*Repository) AddCoin

func (r *Repository) AddCoin(coin coin_gecko.CoinGeckoResponse) (map[string]interface{}, error)

func (*Repository) GetAllCoins

func (r *Repository) GetAllCoins() ([]coin_gecko.CoinGeckoResponse, error)

func (*Repository) GetSpotsByIDList

func (r *Repository) GetSpotsByIDList(idList []string) ([]coin_gecko.CoinGeckoResponse, error)

func (*Repository) UpdateGeckoPrice

func (r *Repository) UpdateGeckoPrice(lowerSymbol string, price string) (*coin_gecko.CoinGeckoResponse, error)

type Service

type Service struct {
	Repository Repository
}

func NewService

func NewService(repository Repository) Service

func (*Service) GetAllCoins

func (s *Service) GetAllCoins() ([]coin_gecko.CoinGeckoResponse, error)

func (*Service) GetAllSpots

func (s *Service) GetAllSpots() ([]Coins, error)

Jump to

Keyboard shortcuts

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