ledger

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

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

Builder maps dates to steps

func NewBuilder

func NewBuilder(options Options) *Builder

NewBuilder creates a new builder.

func (*Builder) AddAssertion

func (b *Builder) AddAssertion(a *model.Assertion) error

AddAssertion adds an assertion directive.

func (*Builder) AddClosing

func (b *Builder) AddClosing(close *model.Close)

AddClosing adds a close directive.

func (*Builder) AddOpening

func (b *Builder) AddOpening(o *model.Open)

AddOpening adds an open directive.

func (*Builder) AddPrice

func (b *Builder) AddPrice(p *model.Price)

AddPrice adds a price directive.

func (*Builder) AddTransaction

func (b *Builder) AddTransaction(t *model.Transaction) error

AddTransaction adds a transaction directive.

func (*Builder) AddValue

func (b *Builder) AddValue(a *model.Value) error

AddValue adds an value directive.

func (*Builder) Build

func (b *Builder) Build() Ledger

Build creates a new ledger.

func (*Builder) Process

func (b *Builder) Process(results <-chan interface{}) error

Process creates a new ledger from the results channel.

type Ledger

type Ledger []*Step

Ledger is a ledger.

func (Ledger) MaxDate

func (l Ledger) MaxDate() (time.Time, bool)

MaxDate returns the maximum date for the given ledger.

func (Ledger) MinDate

func (l Ledger) MinDate() (time.Time, bool)

MinDate returns the minimum date for this ledger, as the first date on which an account is opened (ignoring prices, for example).

func (Ledger) WriteTo

func (l Ledger) WriteTo(w io.Writer) (int64, error)

WriteTo pretty-prints the ledger to the given writer.

type Options

type Options struct {
	AccountsFilter    string
	CommoditiesFilter string
}

Options represents configuration options for creating a ledger.

type Step

type Step struct {
	Date         time.Time
	Prices       []*model.Price
	Assertions   []*model.Assertion
	Values       []*model.Value
	Openings     []*model.Open
	Transactions []*model.Transaction
	Closings     []*model.Close
}

Step groups all commands for a given date.

Jump to

Keyboard shortcuts

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