Improve documentation for YNAB Import
This commit is contained in:
parent
8116238d48
commit
defbbd1884
@ -55,6 +55,11 @@ func NewYNABImport(context context.Context, q *Queries, budgetID uuid.UUID) (*YN
|
||||
|
||||
}
|
||||
|
||||
// ImportAssignments expects a TSV-file as exported by YNAB in the following format:
|
||||
//"Month" "Category Group/Category" "Category Group" "Category" "Budgeted" "Activity" "Available"
|
||||
//"Apr 2019" "Income: Next Month" "Income" "Next Month" 0,00€ 0,00€ 0,00€
|
||||
//
|
||||
// Activity and Available are not imported, since they are determined by the transactions and historic assignments
|
||||
func (ynab *YNABImport) ImportAssignments(r io.Reader) error {
|
||||
csv := csv.NewReader(r)
|
||||
csv.Comma = '\t'
|
||||
@ -67,8 +72,7 @@ func (ynab *YNABImport) ImportAssignments(r io.Reader) error {
|
||||
|
||||
count := 0
|
||||
for _, record := range csvData[1:] {
|
||||
//"Month" "Category Group/Category" "Category Group" "Category" "Budgeted" "Activity" "Available"
|
||||
//"Apr 2019" "Income: Next Month" "Income" "Next Month" 0,00€ 0,00€ 0,00€
|
||||
|
||||
dateString := record[0]
|
||||
date, err := time.Parse("Jan 2006", dateString)
|
||||
if err != nil {
|
||||
@ -109,6 +113,8 @@ func (ynab *YNABImport) ImportAssignments(r io.Reader) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// ImportTransactions expects a TSV-file as exported by YNAB in the following format:
|
||||
|
||||
func (ynab *YNABImport) ImportTransactions(r io.Reader) error {
|
||||
csv := csv.NewReader(r)
|
||||
csv.Comma = '\t'
|
||||
@ -156,7 +162,7 @@ func (ynab *YNABImport) ImportTransactions(r io.Reader) error {
|
||||
return fmt.Errorf("could not parse amount from (%s/%s): %w", inflow, outflow, err)
|
||||
}
|
||||
|
||||
//cleared := record[10]
|
||||
//status := record[10]
|
||||
|
||||
transaction := CreateTransactionParams{
|
||||
Date: date,
|
||||
|
Loading…
x
Reference in New Issue
Block a user