Documentation ¶
Index ¶
- Variables
- type Account
- func (a Account) Children() []*Account
- func (a Account) Descendents() []*Account
- func (a Account) IsAL() bool
- func (a Account) Level() int
- func (a *Account) Map(m Mapping) *Account
- func (a Account) Name() string
- func (a Account) Parent() *Account
- func (a Account) Segment() string
- func (a *Account) Split() []string
- func (a Account) String() string
- func (a Account) Type() AccountType
- func (a Account) WriteTo(w io.Writer) (int64, error)
- type AccountType
- type Accounts
- type Commodities
- type Commodity
- type Context
- func (ctx Context) Account(name string) *Account
- func (ctx Context) Accounts() *Accounts
- func (ctx Context) Commodities() *Commodities
- func (ctx Context) Commodity(name string) *Commodity
- func (ctx Context) GetAccount(name string) (*Account, error)
- func (ctx Context) GetCommodity(name string) (*Commodity, error)
- func (ctx Context) TBDAccount() *Account
- func (ctx Context) ValuationAccount() *Account
- func (ctx Context) ValuationAccountFor(a *Account) *Account
- type Filter
- type Mapping
- type NormalizedPrices
- type Prices
- type Rule
Constants ¶
This section is empty.
Variables ¶
var AccountTypes = []AccountType{ASSETS, LIABILITIES, EQUITY, INCOME, EXPENSES}
AccountTypes is an array with the ordered accont types.
Functions ¶
This section is empty.
Types ¶
type Account ¶ added in v0.0.14
type Account struct {
// contains filtered or unexported fields
}
Account represents an account which can be used in bookings.
func (Account) Descendents ¶ added in v0.0.14
Descendents returns all the descendents of this account, not including the account itself.
func (Account) IsAL ¶ added in v0.0.14
IsAL returns whether this account is an asset or liability account.
func (Account) Type ¶ added in v0.0.14
func (a Account) Type() AccountType
Type returns the account type.
type AccountType ¶ added in v0.0.14
type AccountType int
AccountType is the type of an account.
const ( // ASSETS represents an asset account. ASSETS AccountType = iota // LIABILITIES represents a liability account. LIABILITIES // EQUITY represents an equity account. EQUITY // INCOME represents an income account. INCOME // EXPENSES represents an expenses account. EXPENSES )
func (AccountType) String ¶ added in v0.0.14
func (t AccountType) String() string
type Accounts ¶ added in v0.0.14
type Accounts struct {
// contains filtered or unexported fields
}
Accounts is a thread-safe collection of accounts.
func NewAccounts ¶ added in v0.0.14
func NewAccounts() *Accounts
NewAccounts creates a new thread-safe collection of accounts.
type Commodities ¶ added in v0.0.14
type Commodities struct {
// contains filtered or unexported fields
}
Commodities is a thread-safe collection of commodities.
func NewCommodities ¶ added in v0.0.14
func NewCommodities() *Commodities
NewCommodities creates a new thread-safe collection of commodities.
func (*Commodities) Enumerate ¶ added in v0.0.14
func (cs *Commodities) Enumerate() <-chan *Commodity
Enumerate enumerates the commodities.
func (*Commodities) Get ¶ added in v0.0.14
func (cs *Commodities) Get(name string) (*Commodity, error)
Get creates a new commodity.
func (*Commodities) TagCurrency ¶ added in v0.0.14
func (cs *Commodities) TagCurrency(name string) error
TagCurrency tags the commodity as a currency.
type Commodity ¶ added in v0.0.14
type Commodity struct { IsCurrency bool // contains filtered or unexported fields }
Commodity represents a currency or security.
func (Commodity) MarshalJSON ¶ added in v0.0.14
MarshalJSON marshals a commodity to JSON.
type Context ¶ added in v0.0.14
type Context struct {
// contains filtered or unexported fields
}
Context has context for this ledger, namely a collection of referenced accounts and
func NewContext ¶ added in v0.0.14
func NewContext() Context
NewContext creates a new, empty context.
func (Context) Commodities ¶ added in v0.0.14
func (ctx Context) Commodities() *Commodities
Commodities returns the commodities.
func (Context) GetAccount ¶ added in v0.0.14
GetAccount returns an account.
func (Context) GetCommodity ¶ added in v0.0.14
GetCommodity returns a commodity.
func (Context) TBDAccount ¶ added in v0.0.14
TBDAccount returns the TBD account.
func (Context) ValuationAccount ¶ added in v0.0.14
ValuationAccount returns the account for automatic valuation bookings.
func (Context) ValuationAccountFor ¶ added in v0.0.14
ValuationAccountFor returns the valuation account which corresponds to the given Asset or Liability account.
type Filter ¶ added in v0.0.14
Filter represents a filter for commodities and accounts.
func (Filter) MatchAccount ¶ added in v0.0.14
MatchAccount returns whether this filter matches the given account.
func (Filter) MatchCommodity ¶ added in v0.0.14
MatchCommodity returns whether this filter matches the given commodity.
type NormalizedPrices ¶ added in v0.0.14
NormalizedPrices is a map representing the price of commodities in some base commodity.
type Prices ¶ added in v0.0.14
Prices stores the price for a commodity to a target commodity Outer map: target commodity Inner map: commodity value: price in (target commodity / commodity)
func (Prices) Normalize ¶ added in v0.0.14
func (p Prices) Normalize(c *Commodity) NormalizedPrices
Normalize creates a normalized price map for the given commodity.