repository

package
v1.1.10 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = errors.New("doctrine not found")

Functions

This section is empty.

Types

type BBoltRepository added in v1.1.0

type BBoltRepository interface {
	Repository
	PriceHistory
	io.Closer
}

func NewBBoltRepository added in v1.1.0

func NewBBoltRepository(databaseFile string) (BBoltRepository, error)

type ContractedOn

type ContractedOn string
const (
	Alliance    ContractedOn = "alliance"
	Corporation ContractedOn = "corporation"
)

type Doctrine

type Doctrine struct {
	Name         string        `json:"name"`           // Name of the doctrine.
	RequireStock int           `json:"require_stock"`  // How many to have on contract.
	ContractedOn ContractedOn  `json:"contracted_on"`  // Alliance/Corporation contract.
	Price        DoctrinePrice `json:"doctrine_price"` // Price details.
}

type DoctrinePrice added in v1.1.0

type DoctrinePrice struct {
	Buy       uint64    `json:"buy"`       // How much was this ship bought for.
	Timestamp time.Time `json:"timestamp"` // When.
}

type PriceData added in v1.1.0

type PriceData struct {
	Timestamp    time.Time `json:"timestamp"`
	DoctrineName string    `json:"doctrine_name"`
	ContractID   int32     `json:"contract_id"`
	IssuerID     int32     `json:"issuer_id"`
	Price        uint64    `json:"price"`
}

type PriceHistory added in v1.1.0

type PriceHistory interface {
	RecordPrice(PriceData) error
	SeekPrices(start time.Time, end time.Time) ([]PriceData, error)
	Prices() ([]PriceData, error)
	NPricesForDoctrine(doctrineName string, n int) ([]PriceData, error)
	WriteAllPrices([]PriceData) error
}

type Repository

type Repository interface {
	ReadAll() ([]Doctrine, error)
	WriteAll([]Doctrine) error
	Get(string) (Doctrine, error)
	Set(string, Doctrine) error
}

func NewJSONRepository

func NewJSONRepository(filename string) (Repository, error)

Jump to

Keyboard shortcuts

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