budget

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: GPL-3.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 Accounts

type Accounts map[string]decimal.Decimal

Accounts is a mapping from account names to budget amounts

func (Accounts) Get

func (a Accounts) Get(account string) decimal.Decimal

type Budget

type Budget interface {
	Year() int
	NextYear() Budget

	Month(month time.Month) Accounts
	SetMonth(month time.Month, account string, budget decimal.Decimal) error
	RemoveMonth(month time.Month, account string) error
}

Budget is a monthly budget tracker for a particular year

func New

func New(year int) Budget

New returns a budget that's bound to a given year. Every year can have monthly budgets for various accounts. Each new month copies the previous month of budgets automatically.

type Store

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

Store manages budgets

func NewStore

func NewStore(db plaindb.DB) (*Store, error)

NewStore returns the budgets bucket

func (*Store) Month

func (s *Store) Month(year int, month time.Month) (Accounts, error)

func (*Store) RemoveMonth

func (s *Store) RemoveMonth(year int, month time.Month, account string) error

func (*Store) SetMonth

func (s *Store) SetMonth(year int, month time.Month, account string, budget decimal.Decimal) error

Jump to

Keyboard shortcuts

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