ledger

package
v0.0.0-...-5a71971 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	IDIndex int = iota
	DateIndex
	SourceNameIndex
	SourceTypeIndex
	PersonIndex
	MemoIndex
	ValueIndex
	TypeIndex
	BalanceIndex
	LabelIndex
	NotesIndex
	FieldCount
	SwapTableStart
)

Variables

View Source
var (
	Columns = new([FieldCount]string)
)

Functions

func FindLabel

func FindLabel(memo string) string

func RemoveLabel

func RemoveLabel(labelName string) error

Types

type Entry

type Entry struct {
	ID         string
	Date       time.Time
	SourceName string
	SourceType string
	Person     string
	Memo       string
	Value      float64
	Type       string
	Balance    float64
	Label      string
	Notes      string
}

type FileSource

type FileSource interface {
}

type Label

type Label struct {
	Name     string
	Keywords []string
	// contains filtered or unexported fields
}

func AddLabelKeywords

func AddLabelKeywords(labelName string, toAdd []string) (l Label, created bool, err error)

func AllLabels

func AllLabels() []Label

func RemoveLabelKeywords

func RemoveLabelKeywords(labelName string, toRemove []string) (l Label, err error)

RemoveLabelKeywords removes the given keywords from the label with name labelName and saves the change to file

func (*Label) RegExp

func (l *Label) RegExp() (*regexp.Regexp, error)

type Ledger

type Ledger struct {
	Year int
	// contains filtered or unexported fields
}

func (*Ledger) Entries

func (l *Ledger) Entries() []Entry

func (*Ledger) EntriesWithPattern

func (l *Ledger) EntriesWithPattern(re *regexp.Regexp) []*Entry

func (*Ledger) InsertEntries

func (l *Ledger) InsertEntries(entries []Entry)

func (Ledger) Len

func (l Ledger) Len() int

func (Ledger) Less

func (l Ledger) Less(i, j int) bool

func (Ledger) Swap

func (l Ledger) Swap(i, j int)

func (*Ledger) TrackPattern

func (l *Ledger) TrackPattern(re *regexp.Regexp)

func (*Ledger) UpdateFromSources

func (l *Ledger) UpdateFromSources(allSources []Source) error

type Source

type Source interface {
	Name() string
	Type() SourceType
	GetLedgerEntries(year int) ([]Entry, error)
}

func AllSources

func AllSources() []Source

type SourceType

type SourceType string
const (
	VenmoSourceType SourceType = "VENMO"
	ChaseSourceType SourceType = "CHASE"
)

Jump to

Keyboard shortcuts

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