model

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Assertion

type Assertion struct {
	Directive
	Account   *accounts.Account
	Amount    decimal.Decimal
	Commodity *commodities.Commodity
}

Assertion represents a balance assertion.

func (Assertion) WriteTo

func (a Assertion) WriteTo(w io.Writer) (int64, error)

WriteTo pretty-prints an assertion directive.

type Close

type Close struct {
	Directive
	Account *accounts.Account
}

Close represents a close command.

func (Close) WriteTo

func (c Close) WriteTo(b io.Writer) (int64, error)

WriteTo pretty-prints a close directive.

type CommodityAccount

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

CommodityAccount represents a position.

func NewCommodityAccount

func NewCommodityAccount(a *accounts.Account, c *commodities.Commodity) CommodityAccount

NewCommodityAccount creates a new position

func (CommodityAccount) Account

func (p CommodityAccount) Account() *accounts.Account

Account returns the account.

func (CommodityAccount) Commodity

func (p CommodityAccount) Commodity() *commodities.Commodity

Commodity returns the commodity.

func (CommodityAccount) Less

Less establishes a partial ordering of commodity accounts.

type Directive

type Directive struct {
	Pos Range
	// contains filtered or unexported fields
}

Directive is a directive in a journal.

func NewDirective

func NewDirective(pos Range, date time.Time) Directive

NewDirective returns a new directive.

func (Directive) Date

func (d Directive) Date() time.Time

Date returns the date.

func (Directive) Position

func (d Directive) Position() Range

Position returns the position.

type FilePosition added in v0.0.6

type FilePosition struct {
	Path                           string
	BytePos, RunePos, Line, Column int
}

FilePosition is a position of a character in a text file.

func (FilePosition) String added in v0.0.6

func (p FilePosition) String() string

type Include

type Include struct {
	Directive
	Path string
}

Include represents an include directive.

func (Include) WriteTo

func (i Include) WriteTo(w io.Writer) (int64, error)

WriteTo pretty-prints an include directive

type Lot

type Lot struct {
	Date      time.Time
	Label     string
	Price     float64
	Commodity *commodities.Commodity
}

Lot represents a lot.

func (Lot) WriteTo

func (l Lot) WriteTo(b io.Writer) (int64, error)

WriteTo pretty-prints a posting.

type Open

type Open struct {
	Directive
	Account *accounts.Account
}

Open represents an open command.

func (Open) WriteTo

func (o Open) WriteTo(b io.Writer) (int64, error)

WriteTo pretty-prints an open directive.

type Position

type Position struct {
	CommodityAccount
	Amounts amount.Vec
}

Position is a position.

type Posting

type Posting struct {
	Amount        amount.Amount
	Credit, Debit *accounts.Account
	Commodity     *commodities.Commodity
	Lot           *Lot
	Tag           *Tag
}

Posting represents a posting.

func NewPosting

func NewPosting(crAccount, drAccount *accounts.Account, commodity *commodities.Commodity, amt decimal.Decimal, tag *Tag) *Posting

NewPosting creates a new posting from the given parameters. If amount is negative, it will be inverted and the accounts reversed.

func (Posting) WriteTo

func (t Posting) WriteTo(b io.Writer) (int64, error)

WriteTo pretty-prints a posting.

type Price

type Price struct {
	Directive
	Commodity *commodities.Commodity
	Target    *commodities.Commodity
	Price     float64
}

Price represents a price command.

func (Price) WriteTo

func (p Price) WriteTo(w io.Writer) (int64, error)

WriteTo pretty-prints a Price directive.

type Range

type Range struct {
	Start, End FilePosition
}

Range describes a range in the source code.

type Tag

type Tag string

Tag represents a tag for a transaction or booking.

func (Tag) String

func (t Tag) String() string

String pretty-prints a tag.

type Transaction

type Transaction struct {
	Directive
	Description string
	Tags        []Tag
	Postings    []*Posting
}

Transaction represents a transaction.

func (Transaction) WriteTo

func (t Transaction) WriteTo(b io.Writer) (int64, error)

WriteTo pretty-prints a transaction.

type Value

type Value struct {
	Directive
	Account   *accounts.Account
	Amount    decimal.Decimal
	Commodity *commodities.Commodity
}

Value represents a value directive.

func (Value) WriteTo

func (a Value) WriteTo(w io.Writer) (int64, error)

WriteTo pretty-prints an assertion directive.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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