package model import "time" type Transaction struct { ID int `json:"id"` Date string `json:"date"` // YYYY-MM-DD Amount float64 `json:"amount"` Description string `json:"description"` Type string `json:"type"` // income | expense Source string `json:"source"` // manual | import CategoryID *int `json:"category_id"` AccountID *int `json:"account_id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` } // ImportRow is a parsed-but-not-yet-saved transaction from a file. type ImportRow struct { Date string `json:"date"` Amount float64 `json:"amount"` Description string `json:"description"` Type string `json:"type"` ExternalID string `json:"external_id,omitempty"` // FITID from OFX IsDuplicate bool `json:"is_duplicate"` } // ImportResult is the response after confirming an import. type ImportResult struct { Imported int `json:"imported"` Duplicates int `json:"duplicates"` Errors int `json:"errors"` } // CSVMapping tells the parser which CSV column index holds each field. type CSVMapping struct { DateColumn int `json:"date_column"` AmountColumn int `json:"amount_column"` DescriptionColumn int `json:"description_column"` DateFormat string `json:"date_format"` // Go time format, e.g. "02/01/2006" HasHeader bool `json:"has_header"` DecimalSeparator string `json:"decimal_separator"` // "." or "," FieldSeparator string `json:"field_separator"` // "," or ";" SkipNegative bool `json:"skip_negative"` // skip rows with negative amount (e.g. credit card bill payments) AllExpenses bool `json:"all_expenses"` // treat all rows as expense (credit card statements) }