order

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, region int) (Orders, error)

func (*BoltRepository) Upsert

func (r *BoltRepository) Upsert(typeId int, orders Orders) error

type CacheFirstRepository

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

func (*CacheFirstRepository) Get

func (c *CacheFirstRepository) Get(typeId, region int) (Orders, 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, orders Orders) error

type ESIRepository

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

func (*ESIRepository) Get

func (r *ESIRepository) Get(typeId, regionId int) (Orders, error)

func (*ESIRepository) Upsert

func (r *ESIRepository) Upsert(typeId int, orders Orders) error

type Order

type Order struct {
	FetchDate time.Time

	Duration     int32     `json:"duration"`
	IsBuyOrder   bool      `json:"is_buy_order"`
	Issued       time.Time `json:"issued"`
	LocationId   int64     `json:"location_id"`
	MinVolume    int32     `json:"min_volume"`
	OrderId      int64     `json:"order_id"`
	Price        float64   `json:"price"`
	Range        string    `json:"range"`
	SystemId     int32     `json:"system_id"`
	TypeId       int32     `json:"type_id"`
	VolumeRemain int32     `json:"volume_remain"`
	VolumeTotal  int32     `json:"volume_total"`
}

type Orders

type Orders []*Order

func (Orders) Flippers

func (o Orders) Flippers() int

Flippers returns the number of orders that have been updated in the last 24 hours

func (Orders) Today

func (o Orders) Today() Orders

Orders from today

type Repository

type Repository interface {
	Get(typeId, regionId int) (Orders, error)
	Upsert(typeId int, orders Orders) 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(client *esi.Client) Repository

type Service

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

func NewService

func NewService(repo Repository) *Service

func (*Service) Get

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

Jump to

Keyboard shortcuts

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