Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct { ID string `json:"id"` Name string `json:"name"` Type string `json:"type"` Parent *Account `json:"-"` Children []*Account `json:"-"` Transactions []*Transaction `json:"-"` }
Account is a node of the accounts hierarchy. Each account has its own list of transactions
func (*Account) Descendants ¶
func (a *Account) Descendants(filter AccountFilter) []*Account
Descendants returns a list of sub-accounts matching the filter, using account a as the starting point of the search
func (*Account) WalkBFS ¶
func (a *Account) WalkBFS(walkFunc WalkAccountFunc) []*Account
WalkBFS traverses the tree of accounts using Breadth-first search algorithm. Starting at node a, returns the list of accounts for which walkFunc is true.
type AccountFilter ¶
AccountFilter is the type to express filter condition for Descendants method. Note that it is not possible to filter accounts with Name empty
type DBStatistics ¶
type Database ¶
type Database struct { RootAccount *Account Statistics DBStatistics Warnings []error // contains filtered or unexported fields }
type Transaction ¶
type Transaction struct { Num string `json:"-"` Date string `json:"-"` // YYYY-MM-DD Value float64 `json:"-"` }
Transaction keeps data for a transaction
type WalkAccountFunc ¶
WalkAccountFunc is the type of the function called for each account visited by WalkBFS