datastore

package
v1.2.2 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2020 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const EntryCarrierLocation = "CarrierLocation"
View Source
const EntryCarrierName = "CarrierName"
View Source
const EntryCommanderLocation = "CommanderLocation"
View Source
const EntryJumpPlan = "JumpPlan"

Variables

This section is empty.

Functions

func NewConcurrentUpdateError

func NewConcurrentUpdateError(entry Entry, err error) error

Types

type CarrierLocation

type CarrierLocation struct {
	Name          string `json:"Name"`
	Callsign      string `json:"CallSign"`
	CurrentSystem System `json:"CurrentSystem"`
	// contains filtered or unexported fields
}

func (*CarrierLocation) DataType

func (e *CarrierLocation) DataType() string

func (*CarrierLocation) Id

func (e *CarrierLocation) Id() string

func (*CarrierLocation) IncrementVersion

func (e *CarrierLocation) IncrementVersion()

func (*CarrierLocation) Key

func (e *CarrierLocation) Key() EntryKey

func (*CarrierLocation) Version

func (e *CarrierLocation) Version() int

type CarrierName

type CarrierName struct {
	CarrierName string `json:"CarrierName"`
	CallSign    string `json:"CallSign"`
	// contains filtered or unexported fields
}

func (*CarrierName) DataType

func (e *CarrierName) DataType() string

func (*CarrierName) Id

func (e *CarrierName) Id() string

func (*CarrierName) IncrementVersion

func (e *CarrierName) IncrementVersion()

func (*CarrierName) Key

func (e *CarrierName) Key() EntryKey

func (*CarrierName) Version

func (e *CarrierName) Version() int

type CommanderLocation

type CommanderLocation struct {
	Name           string         `json:"Name"`
	LastBeacon     time.Time      `json:"LastBeacon"`
	CurrentSystem  System         `json:"CurrentSystem"`
	CurrentStation CurrentStation `json:"CurrentStation"`
	// contains filtered or unexported fields
}

func (*CommanderLocation) DataType

func (e *CommanderLocation) DataType() string

func (*CommanderLocation) Id

func (e *CommanderLocation) Id() string

func (*CommanderLocation) IncrementVersion

func (e *CommanderLocation) IncrementVersion()

func (*CommanderLocation) Key

func (e *CommanderLocation) Key() EntryKey

func (*CommanderLocation) Version

func (e *CommanderLocation) Version() int

type ConcurrentUpdateError

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

func (*ConcurrentUpdateError) Error

func (e *ConcurrentUpdateError) Error() string

func (*ConcurrentUpdateError) Unwrap

func (e *ConcurrentUpdateError) Unwrap() error

type CurrentStation

type CurrentStation struct {
	Name           string  `json:"Name"`
	DistFromStarLs float64 `json:"DistFromStarLs"`
}

type Deleter

type Deleter interface {
	// Delete will remove the specified entry from the store if it exists.  Returns nil if the entry does not exist,
	// a ConcurrentUpdateError if the entry exists but is at a different version, or an underlying data store error.
	Delete(entry Entry) error
}

Deleter erases entries from the data store

type Entry

type Entry interface {
	Key() EntryKey
	Id() string
	DataType() string
	Version() int
	IncrementVersion()
}

func NewEntry

func NewEntry(dataType string, id string) (Entry, error)

type EntryKey

type EntryKey struct {
	Id       string `json:"Id"`
	DataType string `json:"Type"`
}

type Getter

type Getter interface {
	// Get retrieves a single Entry with the given name and data type from the store.
	//
	// Returns nil, nil if the entry does not exist, or nil and an error if there was an error in the underlying store.
	Get(id string, dataType string) (Entry, error)

	// All retrieves every entry of a given type from the data store.
	//
	// Returns nil, nil if there are no entries of the given type, or nil and an error if there was an error in the
	// underlying store.
	All(dataType string) ([]Entry, error)
}

Getter retrieves entries from the data store

type JumpByDeparture

type JumpByDeparture struct{ JumpPlans }

func (JumpByDeparture) Less

func (s JumpByDeparture) Less(i, j int) bool

type JumpPlan

type JumpPlan struct {
	CarrierName string    `json:"CarrierName"`
	CallSign    string    `json:"CallSign"`
	FromSystem  System    `json:"FromSystem"`
	ToSystem    System    `json:"ToSystem"`
	DepartingAt time.Time `json:"DepartingAt"`
	// contains filtered or unexported fields
}

func (*JumpPlan) DataType

func (e *JumpPlan) DataType() string

func (*JumpPlan) Id

func (e *JumpPlan) Id() string

func (*JumpPlan) IncrementVersion

func (e *JumpPlan) IncrementVersion()

func (*JumpPlan) Key

func (e *JumpPlan) Key() EntryKey

func (*JumpPlan) Version

func (e *JumpPlan) Version() int

type JumpPlans

type JumpPlans []*JumpPlan

func (JumpPlans) Len

func (s JumpPlans) Len() int

func (JumpPlans) Swap

func (s JumpPlans) Swap(i, j int)

type Putter

type Putter interface {
	// Writes the given Entry into the data store, returning ConcurrentUpdateError if the entity exists and is at
	// a higher version.
	Put(entry Entry) error
}

Putter places new entries in the data store.

All methods return a non-nil error if there was a failure to write to the store.

type Repository

type Repository interface {
	Putter
	Getter
	Deleter
}

Repository wraps the Putter, Getter, and Deleter interfaces into a single interface

type System

type System struct {
	Name string  `json:"Name"`
	X    float64 `json:"X"`
	Y    float64 `json:"Y"`
	Z    float64 `json:"Z"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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