pfin

package module
v0.0.0-...-9cff30b Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: BSD-3-Clause Imports: 6 Imported by: 0

README

pfin: personal finance tools

Collection of tools for parsing bank statements and csvs.

Go Documentation

structure

  • pfin: base library, defines transaction and parser interfaces, parser loading utility like database/sql

  • pfin/util: Utils for directory parsing, filter flags, and formatting functions

  • pfin/parser: parser implementations

  • pfin/parser/util: common code for parsers

  • pfin/parser/all: metapackage to load all parser implementations

  • cmd/main: prints out all transactions, can filter by account/user and sums by user

  • cmd/unpaid: get a list of unpaid transactions for a user

  • cmd/status: wip, get an overview of the statements tree

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Filetype

func Filetype(parser string) (string, error)

func Register

func Register(name string, parser Parser)

Types

type Account

type Account struct {
	Name string

	// parser type, inherited from account name if unset
	Type string

	// folder path from root, inherited from account name if unset
	Path string

	// default user, inherited from config.Pfin.User if unset
	DefaultUser string `toml:"user"`

	// map of users to card identifier
	Users map[string][]string

	// generated
	Cards map[string]string
}

func (Account) User

func (a Account) User(card string) string

type Config

type Config struct {
	Pfin struct {
		User string
		Root string
	}

	// the map is nice in the toml config, but not that nice for usability
	Account  map[string]Account
	Accounts []string
}

func ParseConfig

func ParseConfig(path string) (config Config, err error)

ParseConfig will use default config location if path is empty

type ErrUnregisteredParser

type ErrUnregisteredParser struct {
	// contains filtered or unexported fields
}

func (ErrUnregisteredParser) Error

func (e ErrUnregisteredParser) Error() string

type Parser

type Parser interface {
	Parse(acc Account, filename string, data []byte) ([]Transaction, error)
	Filetype() string
}

type Transaction

type Transaction interface {
	Date() time.Time
	Amount() float64 // positive for debit, negative for credit
	Name() string

	Category() string

	Card() string // may be empty
	User() string
	Account() string

	// should be util.FormatTx
	String() string
}

func Parse

func Parse(acc Account, filename string, data []byte) ([]Transaction, error)

Directories

Path Synopsis
cmd
parser
all

Jump to

Keyboard shortcuts

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