pfin: git.sr.ht/~mendelmaleh/pfin Index | Files | Directories

package pfin

import "git.sr.ht/~mendelmaleh/pfin"

Index

Package Files

parser.go transaction.go types.go

func Filetype

func Filetype(parser string) (string, error)

func Register

func Register(name string, parser Parser)

type Account

type Account struct {
    Name string

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

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

    // map of users to card identifier
    Users map[string]string
    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
    }

    Account map[string]Account
}

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

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
    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

PathSynopsis
cmd
cmd/csvsum
cmd/main
cmd/status
cmd/unpaid
parser
parser/all
parser/amex
parser/bofa
parser/capitalone
parser/personal
parser/util
util
Version
v0.0.0-20220505005644-17a9968b8525 (latest)
Published
May 5, 2022
Platform
linux/amd64
Imports
5 packages (graph)
Last checked
3 weeks ago

Tools for package owners.