Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseLedgerAsync ¶
func ParseLedgerAsync(ledgerReader io.Reader) (c chan *Transaction, e chan error)
ParseLedgerAsync parses a ledger file and returns a Transaction and error channels .
Types ¶
type Account ¶
Account holds the name and balance
func GetBalances ¶
func GetBalances(generalLedger []*Transaction, filterArr []string) []*Account
GetBalances provided a list of transactions and filter strings, returns account balances of all accounts that have any filter as a substring of the account name. Also returns balances for each account level depth as a separate record.
Accounts are sorted by name.
type RangeBalance ¶
RangeBalance contains the account balances and the start and end time of the date range
func BalancesByPeriod ¶
func BalancesByPeriod(trans []*Transaction, per Period, rType RangeType) []*RangeBalance
BalancesByPeriod will return the account balances for each period.
type RangeTransactions ¶
type RangeTransactions struct {
Start, End time.Time
Transactions []*Transaction
}
RangeTransactions contains the transactions and the start and end time of the date range
func TransactionsByPeriod ¶
func TransactionsByPeriod(trans []*Transaction, per Period) []*RangeTransactions
TransactionsByPeriod will return the transactions for each period.
type RangeType ¶
type RangeType string
RangeType is used to specify how the data is "split" into sections
type Transaction ¶
Transaction is the basis of a ledger. The ledger holds a list of transactions. A Transaction has a Payee, Date (with no time, or to put another way, with hours,minutes,seconds values that probably doesn't make sense), and a list of Account values that hold the value of the transaction for each account.
func ParseLedger ¶
func ParseLedger(ledgerReader io.Reader) (generalLedger []*Transaction, err error)
ParseLedger parses a ledger file and returns a list of Transactions.
Transactions are sorted by date.
func TransactionsInDateRange ¶
func TransactionsInDateRange(trans []*Transaction, start, end time.Time) []*Transaction
TransactionsInDateRange returns a new array of transactions that are in the date range specified by start and end. The returned list contains transactions on the same day as start but does not include any transactions on the day of end.