balance

package
v0.0.13 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountCloser added in v0.0.13

type AccountCloser struct {
	Balance *Balance
}

AccountCloser closes accounts.

func (AccountCloser) Process added in v0.0.13

func (vtc AccountCloser) Process(d *ledger.Day) error

Process implements Processor.

type AccountOpener added in v0.0.13

type AccountOpener struct {
	Balance *Balance
}

AccountOpener keeps track of open accounts.

func (AccountOpener) Process added in v0.0.13

func (a AccountOpener) Process(d *ledger.Day) error

Process implements Processor.

type Accounts added in v0.0.13

type Accounts map[*ledger.Account]bool

Accounts keeps track of open accounts.

func (Accounts) Close added in v0.0.13

func (oa Accounts) Close(a *ledger.Account) error

Close closes an account.

func (Accounts) Copy added in v0.0.13

func (oa Accounts) Copy() Accounts

Copy copies accounts.

func (Accounts) IsOpen added in v0.0.13

func (oa Accounts) IsOpen(a *ledger.Account) bool

IsOpen returns whether an account is open.

func (Accounts) Open added in v0.0.13

func (oa Accounts) Open(a *ledger.Account) error

Open opens an account.

type Asserter added in v0.0.13

type Asserter struct {
	Balance *Balance
}

Asserter keeps track of open accounts.

func (Asserter) Process added in v0.0.13

func (as Asserter) Process(d *ledger.Day) error

Process implements Processor.

type Balance

type Balance struct {
	Date             time.Time
	Amounts, Values  map[CommodityAccount]decimal.Decimal
	Accounts         Accounts
	Context          ledger.Context
	Valuation        *ledger.Commodity
	NormalizedPrices prices.NormalizedPrices
}

Balance represents a balance for accounts at the given date.

func Diffs

func Diffs(bals []*Balance) []*Balance

Diffs creates the difference balances for the given slice of balances. The returned slice is one element smaller than the input slice. The balances are mutated.

func New

func New(ctx ledger.Context, valuation *ledger.Commodity) *Balance

New creates a new balance.

func (*Balance) Copy

func (b *Balance) Copy() *Balance

Copy deeply copies the balance

func (*Balance) Minus

func (b *Balance) Minus(bo *Balance)

Minus mutably subtracts the given balance from the receiver.

type Builder added in v0.0.8

type Builder struct {
	From, To    *time.Time
	Period      date.Period
	Last        int
	Valuation   *ledger.Commodity
	Close, Diff bool
}

Builder builds a sequence of balances.

func (Builder) Build added in v0.0.8

func (b Builder) Build(l ledger.Ledger) ([]*Balance, error)

Build builds a sequence of balances.

type CommodityAccount added in v0.0.7

type CommodityAccount struct {
	Account   *ledger.Account
	Commodity *ledger.Commodity
}

CommodityAccount represents a position.

func (CommodityAccount) Less added in v0.0.7

Less establishes a partial ordering of commodity accounts.

type DateUpdater added in v0.0.13

type DateUpdater struct {
	Balance *Balance
}

DateUpdater keeps track of open accounts.

func (DateUpdater) Process added in v0.0.13

func (a DateUpdater) Process(d *ledger.Day) error

Process implements Processor.

type Error added in v0.0.6

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

Error is an error.

func (Error) Error added in v0.0.6

func (be Error) Error() string

type PeriodCloser added in v0.0.13

type PeriodCloser struct {
	Balance *Balance
}

PeriodCloser closes the accounting period.

func (PeriodCloser) Process added in v0.0.13

func (as PeriodCloser) Process(d *ledger.Day) error

Process implements Processor.

type PriceUpdater added in v0.0.13

type PriceUpdater struct {
	Balance *Balance
	// contains filtered or unexported fields
}

PriceUpdater keeps track of prices.

func (*PriceUpdater) Initialize added in v0.0.13

func (a *PriceUpdater) Initialize(_ ledger.Ledger) error

Initialize implements Initializer.

func (*PriceUpdater) Process added in v0.0.13

func (a *PriceUpdater) Process(d *ledger.Day) error

Process implements Processor.

type Snapshotter added in v0.0.13

type Snapshotter struct {
	Balance  *Balance
	From, To *time.Time
	Last     int
	Diff     bool
	Period   date.Period
	Result   *[]*Balance
	// contains filtered or unexported fields
}

Snapshotter keeps track of open accounts.

func (*Snapshotter) Finalize added in v0.0.13

func (a *Snapshotter) Finalize() error

Finalize implements Finalizer.

func (*Snapshotter) Initialize added in v0.0.13

func (a *Snapshotter) Initialize(l ledger.Ledger) error

Initialize implements Initializer.

func (*Snapshotter) Process added in v0.0.13

func (a *Snapshotter) Process(d *ledger.Day) error

Process implements Processor.

type TransactionBooker added in v0.0.13

type TransactionBooker struct {
	Balance *Balance
}

TransactionBooker books transaction amounts.

func (TransactionBooker) Process added in v0.0.13

func (tb TransactionBooker) Process(d *ledger.Day) error

Process implements Processor.

type TransactionValuator added in v0.0.13

type TransactionValuator struct {
	Balance *Balance
}

TransactionValuator valuates transactions.

func (TransactionValuator) Process added in v0.0.13

func (as TransactionValuator) Process(d *ledger.Day) error

Process implements Processor.

type ValuationTransactionComputer added in v0.0.13

type ValuationTransactionComputer struct {
	Balance *Balance
}

ValuationTransactionComputer valuates transactions.

func (ValuationTransactionComputer) Process added in v0.0.13

func (vtc ValuationTransactionComputer) Process(d *ledger.Day) error

Process implements Processor.

type ValueBooker added in v0.0.13

type ValueBooker struct {
	Balance *Balance
}

ValueBooker books amounts for value directives.

func (ValueBooker) Process added in v0.0.13

func (tb ValueBooker) Process(d *ledger.Day) error

Process implements Processor.

Jump to

Keyboard shortcuts

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