internal

package
v1.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 17, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const RecordTemplate = `` /* 174-byte string literal not displayed */

RecordTemplate is the default template for formatting records

Variables

This section is empty.

Functions

func GetTemplate

func GetTemplate(file string) string

GetTemplate ...

func ProcessCsvFile

func ProcessCsvFile(file io.Reader, config Config, template string)

ProcessCsvFile ...

func SetViperDefaults

func SetViperDefaults(cfgFile string)

SetViperDefaults ...

Types

type Config

type Config struct {
	Csv               CsvConfig
	TransactionsRules TransactionsRulesConfig
}

Config represents the config

func GetConfig

func GetConfig() Config

GetConfig ...

type CsvConfig

type CsvConfig struct {
	AmountIn          int    // The amount in field index
	AmountOut         int    // The amount out field index
	Currency          string // The currency to use
	Date              int    // The date field index
	DateLayoutIn      string // The parsing format
	DateLayoutOut     string // The date output format
	DefaultAccount    string // The default account for transactions if no rule matches
	Description       int    // The description field index
	Fields            int    // Validate no. of fields; -1 is no check, 0 is infer from first row, and > 0 is explicit length
	Payee             int    // The payee field index
	ProcessingAccount string // The account this export/CSV pertains to
	Separator         rune   // The csv file separator
	Skip              int    // The number of csv rows to skip, excluding blank lines
}

CsvConfig is the config for parsing the csv file

type Record

type Record struct {
	AccountIn   string // The account in
	AccountOut  string // The acocunt out
	AmountIn    string // The amount in
	AmountOut   string // The amount out
	Comment     string // The comment, if provided
	Currency    string // The currency
	Date        string // The date
	Description string // The description, if present
	Payee       string // The payee
	Raw         string // The raw csv record
}

Record represents a financial transaction record

type TransactionRule

type TransactionRule struct {
	SetAccount       string
	SetComment       string
	MatchDescription string
	MatchPayee       string
}

TransactionRule is a set of values to match records with and update their values from

type TransactionsRulesConfig

type TransactionsRulesConfig map[string]TransactionRule

TransactionsRulesConfig is a map of TransactionRule objects

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL