history

package
v0.0.0-...-2bccc3c Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BoltRepository

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

func (*BoltRepository) Get

func (r *BoltRepository) Get(typeId, days, region int) (MarketHistories, error)

func (*BoltRepository) Upsert

func (r *BoltRepository) Upsert(typeId int, marketHistory MarketHistories) error

type CacheFirstRepository

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

func (*CacheFirstRepository) Get

func (c *CacheFirstRepository) Get(typeId, days, region int) (MarketHistories, error)

Check the cache first If the cache doesn't have the data, check ESI If ESI has the data, update the cache

func (*CacheFirstRepository) Upsert

func (c *CacheFirstRepository) Upsert(typeId int, marketHistories MarketHistories) error

type ESIRepository

type ESIRepository struct {
	ESI *esi.Client
}

func (*ESIRepository) Get

func (e *ESIRepository) Get(typeId, days, region int) (MarketHistories, error)

func (*ESIRepository) Upsert

func (e *ESIRepository) Upsert(typeId int, marketHistory MarketHistories) error

type MarketHistories

type MarketHistories []*MarketHistory

func (MarketHistories) ExpectedDates

func (m MarketHistories) ExpectedDates(days int) []string

func (MarketHistories) TrimDays

func (m MarketHistories) TrimDays(days int) MarketHistories

type MarketHistory

type MarketHistory struct {
	Average    float64
	Date       string
	High       float64
	Low        float64
	OrderCount int64
	Volume     int64
}

MarketHistory for an item

type Repository

type Repository interface {
	Get(typeId, days, region int) (MarketHistories, error)
	Upsert(typeId int, marketHistory MarketHistories) error
}

func NewBoltRepository

func NewBoltRepository(db *bolt.DB, logger hclog.Logger) (Repository, error)

func NewCacheFirstRepository

func NewCacheFirstRepository(cacheRepository, esiRepository Repository) Repository

func NewESIRepository

func NewESIRepository(esi *esi.Client) Repository

type Service

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

func NewService

func NewService(logger hclog.Logger, repo Repository) *Service

func (*Service) Get

func (s *Service) Get(typeId, regionId, days int) (MarketHistories, error)

Jump to

Keyboard shortcuts

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