models

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2021 License: GPL-3.0 Imports: 1 Imported by: 2 modules, 2 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

This package provides marshal-able models for all data objects in the API.

Index

Constants

View Source
const (
	LOAN_STARTUP = "STARTUP"

	LOC_PLANET    = "PLANET"
	LOC_MOON      = "MOON"
	LOC_GAS_GIANT = "GAS_GIANT"
	LOC_ASTEROID  = "ASTEROID"

	GOOD_MACHINERY = "MACHINERY"
	GOOD_RESEARCH  = "RESEARCH"
	GOOD_CHEMICALS = "CHEMICALS"
	GOOD_FOOD      = "FOOD"
	GOOD_FUEL      = "FUEL"
	GOOD_WORKERS   = "WORKERS"

	SHIP_CLASS_I   = "MK-I"
	SHIP_CLASS_II  = "MK-II"
	SHIP_CLASS_III = "MK-III"
)

Provides useful constants ('enums') for the project. Const structure OBJECT_ENUM, e.g.: LOAN_STARTUP

Variables

View Source
var (
	NilAccount          = Account{}
	NilCargo            = Cargo{}
	NilFlightPlan       = FlightPlan{}
	NilLoan             = Loan{}
	NilPurchaseLocation = PurchaseLocation{}
	NilLocation         = Location{}
	NilMarketLocation   = MarketLocation{}
	NilGood             = Good{}
	NilMarket           = Market{}
	NilOrder            = Order{}
	NilShipOrder        = ShipOrder{}
	NilShip             = Ship{}
	NilSystem           = System{}
)

vars for providing 'nil' struct definitions

Functions

This section is empty.

Types

type Account

type Account struct {
	Credits  int    `json:"credits"`
	Loans    []Loan `json:"loans"`
	Ships    []Ship `json:"ships"`
	Username string `json:"username"`
}

Models the Account object.

type Cargo

type Cargo struct {
	Good        string `json:"good"`
	Quantity    int    `json:"quantity"`
	TotalVolume int    `json:"totalVolume"`
}

Models the Cargo object.

type CommonFlightPlan added in v0.1.1

type CommonFlightPlan struct {
	ArrivesAt time.Time `json:"arrivesAt"`
	CreatedAt time.Time `json:"createdAt"`
	From      string    `json:"from"`
	To        string    `json:"to"`
	Username  string    `json:"username"`
	ID        string    `json:"id"`
	ShipType  string    `json:"shipType"`
	ShipID    string    `json:"shipId"`
}

type Currency

type Currency float64

Currency is another name for float64.

Intended for representing currency.

type DockedShip added in v0.1.3

type DockedShip struct {
	ID       string `json:"shipId"`
	Username string `json:"username"`
	Type     string `json:"shipType"`
}

Models the DockedShip object returned from a Location

type FlightPlan

type FlightPlan struct {
	ArrivesAt              time.Time `json:"arrivesAt"`
	Destination            string    `json:"destination"`
	FuelConsumed           int       `json:"fuelConsumed"`
	FuelRemaining          int       `json:"fuelRemaining"`
	ID                     string    `json:"id"`
	ShipID                 string    `json:"ship"`
	TerminatedAt           time.Time `json:"terminatedAt"`
	TimeRemainingInSeconds int       `json:"timeRemainingInSeconds"`
	Departure              string    `json:"departure"`
	Distance               int       `json:"distance"`
}

Models the FlightPlan object.

type Good added in v0.0.6

type Good struct {
	QuantityAvailable int      `json:"quantityAvailable"`
	VolumePerUnit     int      `json:"volumePerUnit"`
	PricePerUnit      Currency `json:"pricePerUnit"`
	Symbol            string   `json:"symbol"`
}

models a sellable good.

type Loan

type Loan struct {
	Type               string    `json:"type"`
	Amount             Currency  `json:"amount"`
	CollateralRequired bool      `json:"collateralRequired"`
	Rate               Currency  `json:"rate"`
	TermInDays         int       `json:"termInDays"`
	Due                time.Time `json:"due"`
	ID                 string    `json:"id"`
	RepaymentAmount    Currency  `json:"repaymentAmount"`
	Status             string    `json:"status"`
}

Models the Loan object.

type Location

type Location struct {
	Name            string       `json:"name"`
	Symbol          string       `json:"symbol"`
	Type            string       `json:"type"`
	X               int          `json:"x"`
	Y               int          `json:"y"`
	Anomaly         string       `json:"anomaly"`
	AnsibleProgress int          `json:"ansibleProgress"`
	Ships           []DockedShip `json:"ships"`
	DockedShips     int          `json:"dockedShips"`
}

Models the Location object.

type Market added in v0.0.6

type Market struct {
	Goods []Good `json:"marketplace"`
}

models a market.

type MarketLocation added in v0.0.6

type MarketLocation struct {
	Market
	Location
}

Models a Location object that has a Market.

type Modifier

type Modifier float64

Modifier is another name for float64.

Intended for representing modifiers.

type Order

type Order struct {
	Good         string   `json:"good"`
	PricePerUnit Currency `json:"pricePerUnit"`
	Quantity     int      `json:"quantity"`
	TotalPrice   Currency `json:"total"`
}

Models the Order object.

type PurchaseLocation

type PurchaseLocation struct {
	Location string   `json:"location"`
	Price    Currency `json:"price"`
}

Models the PurchaseLocation object.

type Ship

type Ship struct {
	Class             string             `json:"class"`
	DockingEfficiency Modifier           `json:"dockingEfficiency"`
	FuelEfficiency    Modifier           `json:"fuelEfficiency"`
	Maintenance       Modifier           `json:"maintenance"`
	Manufacturer      string             `json:"manufacturer"`
	MaxCargo          int                `json:"maxCargo"`
	Plating           int                `json:"plating"`
	Speed             Modifier           `json:"speed"`
	Type              string             `json:"type"`
	Weapons           int                `json:"weapons"`
	PurchaseLocation  []PurchaseLocation `json:"purchaseLocations"`
	Cargo             []Cargo            `json:"cargo"`
	ID                string             `json:"id"`
	Location          string             `json:"location"`
	SpaceAvailable    int                `json:"spaceAvailable"`
	X                 int                `json:"x"`
	Y                 int                `json:"y"`
}

Models the Ship object.

type ShipOrder

type ShipOrder struct {
	Credits Currency `json:"credits"`
	Orders  []Order  `json:"order"`
	Ship    Ship     `json:"ship"`
}

Models an order that has been purchased or sold by a ship.

type System added in v0.0.6

type System struct {
	Symbol    string     `json:"symbol"`
	Name      string     `json:"name"`
	Locations []Location `json:"locations"`
}

models a system

Jump to

Keyboard shortcuts

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