Documentation
¶
Overview ¶
Package importer turns files from other tools into Exhale import items: a Wallos database or export, a spreadsheet saved as CSV, or Exhale's own export. It only reads; the app decides what to create (the user reviews the list first).
Index ¶
Constants ¶
const MaxFileSize = 20 << 20
MaxFileSize bounds an uploaded file.
const MaxPDFPages = 60
MaxPDFPages bounds how much of a PDF is read.
const MaxTransactions = 50_000
MaxTransactions bounds a bank export.
Variables ¶
var ErrNoText = errors.New("this PDF has no text (it is probably a scan)")
ErrNoText is returned for a PDF without text, such as a scan.
var ErrUnknownFormat = errors.New("this file is not a Wallos database, a Wallos export, an Exhale export or a CSV with a name and a price column")
ErrUnknownFormat is returned when a file is none of the supported kinds.
Functions ¶
func AnyDate ¶
AnyDate reads the date formats spreadsheets produce; ambiguous numeric dates are read day first (31/12/2026), the more common order worldwide.
func PDFText ¶
PDFText returns the text of a PDF, one line per line of the page. It fails for a damaged or password-protected file and returns ErrNoText for a PDF without text.
func SplitPrice ¶
SplitPrice separates "€12.99", "12,99 EUR" or "$5" into amount and currency.
Types ¶
type FileKind ¶
type FileKind int
FileKind is what an upload looks like from its first bytes.
Kinds of upload.
type Result ¶
type Result struct {
Source string `` /* 156-byte string literal not displayed */
Items []app.ImportItem `json:"items"`
Notes []string `json:"notes" jsonschema:"things the reviewer should know about the file as a whole"`
// Model is the model that proposed or tidied the items, when one did.
Model string `json:"model,omitempty" jsonschema:"the model that read the file or tidied the names; empty when Exhale read it by itself"`
// Transactions are the outgoing payments of a statement, for matching
// with the expected charges. They stay on the server.
Transactions []app.StatementLine `json:"-"`
// Match says which expected charges the statement confirms, when it
// listed transactions.
Match *app.StatementMatch `json:"match,omitempty"`
}
Result is what a file contained.
func Parse ¶
Parse detects the format of data and returns its subscriptions. defaultCurrency fills items whose currency the file does not say.
func TextTransactions ¶
func TextTransactions(text, defaultCurrency string, today engine.Date, source string) (res Result, shaped bool)
TextTransactions reads the transactions of a statement written as text, one per line. shaped is false when fewer than three lines look like a transaction.
func Transactions ¶
Transactions reads a bank or card export and returns the charges that recur, and every outgoing payment for matching with the expected charges. shaped is false when data is not a list of transactions at all; when it is, the result may still have no items (nothing recurs).