Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccountFilter ¶ added in v0.0.11
AccountFilter filters accounts.
type Accrual ¶ added in v0.0.7
type Accrual struct {
Pos model.Range
Period date.Period
T0, T1 time.Time
Account *accounts.Account
Transaction *Transaction
}
Accrual represents an accrual.
func (*Accrual) Expand ¶ added in v0.0.7
func (a *Accrual) Expand() ([]*Transaction, error)
Expand expands an accrual transaction.
type Assertion ¶ added in v0.0.7
type Assertion struct {
Pos model.Range
Date time.Time
Account *accounts.Account
Amount decimal.Decimal
Commodity *commodities.Commodity
}
Assertion represents a balance assertion.
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder maps dates to days
func NewBuilder ¶
func NewBuilder(af *AccountFilter, cf *CommodityFilter) *Builder
NewBuilder creates a new builder.
func (*Builder) AddAssertion ¶
AddAssertion adds an assertion directive.
func (*Builder) AddClosing ¶
AddClosing adds a close directive.
func (*Builder) AddOpening ¶
AddOpening adds an open directive.
func (*Builder) AddTransaction ¶
func (b *Builder) AddTransaction(t *Transaction)
AddTransaction adds a transaction directive.
type CommodityFilter ¶ added in v0.0.11
CommodityFilter filters commodities.
type Day ¶ added in v0.0.7
type Day struct {
Date time.Time
Prices []*Price
Assertions []*Assertion
Values []*Value
Openings []*Open
Transactions []*Transaction
Closings []*Close
}
Day groups all commands for a given date.
type Filter ¶ added in v0.0.8
Filter represents a filter creating a ledger.
func (Filter) MatchAccount ¶ added in v0.0.11
MatchAccount returns whether this filter matches the given Account.
func (Filter) MatchCommodity ¶ added in v0.0.11
func (b Filter) MatchCommodity(c *commodities.Commodity) bool
MatchCommodity returns whether this filter matches the given Commodity.
type Ledger ¶
type Ledger []*Day
Ledger is a ledger.
func FromDirectives ¶ added in v0.0.8
func FromDirectives(accountFilter *AccountFilter, commodityFilter *CommodityFilter, results <-chan interface{}) (Ledger, error)
FromDirectives reads directives from the given channel and builds a Ledger if successful.
type Posting ¶ added in v0.0.7
type Posting struct {
Amount, Value decimal.Decimal
Credit, Debit *accounts.Account
Commodity, Target *commodities.Commodity
Lot *Lot
}
Posting represents a posting.
func NewPosting ¶ added in v0.0.7
func NewPosting(crAccount, drAccount *accounts.Account, commodity *commodities.Commodity, amt decimal.Decimal) *Posting
NewPosting creates a new posting from the given parameters. If amount is negative, it will be inverted and the accounts reversed.
type Price ¶ added in v0.0.7
type Price struct {
Pos model.Range
Date time.Time
Commodity *commodities.Commodity
Target *commodities.Commodity
Price decimal.Decimal
}
Price represents a price command.
type Transaction ¶ added in v0.0.7
type Transaction struct {
Pos model.Range
Date time.Time
Description string
Tags []Tag
Postings []*Posting
}
Transaction represents a transaction.
func (Transaction) Position ¶ added in v0.0.7
func (t Transaction) Position() model.Range
Position returns the Position.