Documentation
¶
Overview ¶
Package budget defines constants and provides functions for working with a budget spreadsheet. This is where knowledge is found about where transactions go in the sheet, as well as any other information needed to update the sheet with data downloaded from the bank.
Package budget defines constants and provides functions for working with a budget spreadsheet. This is where knowledge is found about where transactions go in the sheet, as well as any other information needed to update the sheet with data downloaded from the bank.
Index ¶
Constants ¶
const DataRange = "A2:H"
DataRange gives the location of the transactions
const HeaderRange = "A1:H1"
HeaderRange gives the location of the transaction header
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Spreadsheet ¶
type Spreadsheet struct { index.Record // Location, date range covered, etc. sheets.Service // Adds the Google Sheets API to this struct }
Spreadsheet has the same structure as a Record, and holds high-level information about a spreadsheet.
func (*Spreadsheet) AppendArray ¶
func (spreadsheet *Spreadsheet) AppendArray(transactions []Transaction, worksheet string, category string) error
AppendArray accepts an array of transaction records and appends them to the spreadsheet, sorted by Date and Index. It uses the worksheet whose name exactly matches the account, and it puts the provided category in the first spreadsheet column.
NOTE! This method appends everything it's given. It doesn't filter the records based on date, or anything else. If you call this method directly, you should know what you're doing.
func (*Spreadsheet) AppendFromChannel ¶
func (spreadsheet *Spreadsheet) AppendFromChannel(input <-chan Transaction, wait *sync.WaitGroup, worksheet string, category string)
AppendFromChannel runs a goroutine that listens to a channel for transactions, filters out the ones that don't apply, and appends the rest to the budget spreadsheet for the specified account. It does the append when the channel is closed by the writer.
type Transaction ¶
type Transaction struct { Index int // A counter for sorting transactions on the same Date Date time.Time // The date of the transaction Type string // A type description, such as POS, Check, ATM, etc. Description string // Usually the payor / payee of the transaction DebitPennies int64 // The debit amount, in pennies CreditPennies int64 // The credit amount, in pennies BalancePennies int64 // The balance, in pennies, after the transaction }
A Transaction contains information about a single transaction.