services

package
v0.0.0-...-f6d0692 Latest Latest
Warning

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

Go to latest
Published: May 16, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigService

type ConfigService struct {
	AppName string             `toml:"app_name"`
	Version string             `toml:"version"`
	FeedURL string             `toml:"feed_url"`
	MySQL   mysqlConfig        `toml:"mysql"`
	HTTP    httpEndpointConfig `toml:"http"`
}

func (*ConfigService) Load

func (c *ConfigService) Load(file string) error

type Currency

type Currency struct {
	Symbol string         `db:"symbol" json:"symbol"`
	Value  int64          `db:"value" json:"value"`
	Date   mysql.NullTime `db:"date" json:"date,omitempty"`
}

type CurrencyFeedService

type CurrencyFeedService struct {
	Feed utils.CurrencyFeed
	// contains filtered or unexported fields
}

func NewCurrencyFeedService

func NewCurrencyFeedService(mysql *MySQLService, url string) *CurrencyFeedService

NewCurrencyFeedService creates new CurrencyFeedService

func (*CurrencyFeedService) Check

func (s *CurrencyFeedService) Check() (bool, error)

Check if feed needs to persited in database

func (*CurrencyFeedService) Fetch

func (s *CurrencyFeedService) Fetch() error

Fetch latest currency RSS2 feed and store it locally

func (*CurrencyFeedService) Persist

func (s *CurrencyFeedService) Persist() error

Persist feed data into database

type CurrencyService

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

func NewCurrencyService

func NewCurrencyService(mysql *MySQLService) *CurrencyService

NewCurrencyService creates new CurrencyService

func (*CurrencyService) BySymbol

func (s *CurrencyService) BySymbol(symbol string, limit int) ([]Currency, error)

BySymbol returns historical values by symbol

func (*CurrencyService) Latest

func (s *CurrencyService) Latest() ([]Currency, error)

Latest currencies

type MySQLService

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

func NewMySQLService

func NewMySQLService(user string, password string, address string, database string) (*MySQLService, error)

NewMySQLService creates new MySQLService

func (*MySQLService) Close

func (s *MySQLService) Close()

Close current database session

func (*MySQLService) Session

func (s *MySQLService) Session() *sqlx.DB

Session returns current database session

func (*MySQLService) Setup

func (s *MySQLService) Setup() error

Setup creates database tables if needed

Jump to

Keyboard shortcuts

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