commodity

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compare

func Compare(c1, c2 *Commodity) compare.Order

func IdentityIf

func IdentityIf(t bool) func(*Commodity) *Commodity

Types

type Commodity

type Commodity struct {
	IsCurrency bool
	// contains filtered or unexported fields
}

Commodity represents a currency or security.

func (Commodity) Name

func (c Commodity) Name() string

func (Commodity) String

func (c Commodity) String() string

type Registry

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

Registry is a thread-safe collection of commodities.

func NewCommodities

func NewCommodities() *Registry

NewCommodities creates a new thread-safe collection of commodities.

func (*Registry) Create

func (as *Registry) Create(a syntax.Commodity) (*Commodity, error)

func (*Registry) Get

func (cs *Registry) Get(name string) (*Commodity, error)

Get creates a new commodity.

func (*Registry) MustGet

func (cs *Registry) MustGet(name string) *Commodity

func (*Registry) TagCurrency

func (cs *Registry) TagCurrency(name string) error

TagCurrency tags the commodity as a currency.

Jump to

Keyboard shortcuts

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