app

package
v0.0.0-...-7c5e630 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Sections []*SectionConfig
	Template string
	// contains filtered or unexported fields
}

func LoadConfig

func LoadConfig(path string) (*Config, error)

func (*Config) FindSection

func (self *Config) FindSection(rec Record) (string, string, error)

func (*Config) SkipFromSum

func (self *Config) SkipFromSum(sectName string) bool

func (*Config) SkipPerMonth

func (self *Config) SkipPerMonth(sectName string) bool

type Parser

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

func NewParser

func NewParser(file io.Reader) (*Parser, error)

func (*Parser) Next

func (self *Parser) Next() (rec Record, err error)

type Record

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

func (*Record) AccountId

func (self *Record) AccountId() string

func (*Record) Between

func (self *Record) Between(d1 time.Time, d2 time.Time) bool

func (*Record) Date

func (self *Record) Date() time.Time

func (*Record) Line

func (self *Record) Line() int

func (*Record) Money

func (self *Record) Money() float32

func (*Record) Note

func (self *Record) Note() string

func (*Record) Out

func (self *Record) Out() bool

func (*Record) Parse

func (self *Record) Parse(fields map[string]string, line int) error

func (*Record) Valid

func (self *Record) Valid() bool

func (*Record) Vs

func (self *Record) Vs() string

type Report

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

func NewReport

func NewReport(cfg *Config) *Report

func (*Report) Data

func (self *Report) Data() *ReportData

func (*Report) Parse

func (self *Report) Parse(file io.Reader) error

func (*Report) Print

func (self *Report) Print() error

func (*Report) WithFromDate

func (self *Report) WithFromDate(t time.Time) *Report

func (*Report) WithToDate

func (self *Report) WithToDate(t time.Time) *Report

type ReportData

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

func NewReportData

func NewReportData(cfg *Config) *ReportData

func (*ReportData) BeginDateString

func (self *ReportData) BeginDateString() string

func (*ReportData) Count

func (self *ReportData) Count() int

func (*ReportData) EndDateString

func (self *ReportData) EndDateString() string

func (*ReportData) Money

func (self *ReportData) Money() float32

func (*ReportData) MonthsBetween

func (self *ReportData) MonthsBetween() int

func (*ReportData) PerMonthString

func (self *ReportData) PerMonthString(format string) string

func (*ReportData) SortedSections

func (self *ReportData) SortedSections() []*Section

type Section

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

func (*Section) Add

func (self *Section) Add(money float32)

func (*Section) Count

func (self *Section) Count() int

func (*Section) Money

func (self *Section) Money() float32

func (*Section) MonthsBetween

func (self *Section) MonthsBetween() int

func (*Section) Name

func (self *Section) Name() string

func (*Section) PerMonthString

func (self *Section) PerMonthString(format string) string

func (*Section) SortedItems

func (self *Section) SortedItems() []*SectionItem

type SectionConfig

type SectionConfig struct {
	Name         string
	Rules        []*SectionRule
	Order        int
	Skip         bool
	SkipPerMonth bool `yaml:"skipPerMonth"`
}

type SectionItem

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

func (*SectionItem) Add

func (self *SectionItem) Add(money float32)

func (*SectionItem) Count

func (self *SectionItem) Count() int

func (*SectionItem) Money

func (self *SectionItem) Money() float32

func (*SectionItem) MonthsBetween

func (self *SectionItem) MonthsBetween() int

func (*SectionItem) Name

func (self *SectionItem) Name() string

func (*SectionItem) PerMonthString

func (self *SectionItem) PerMonthString(format string) string

type SectionRule

type SectionRule struct {
	Key     string
	Re      string
	Account string
	Vs      string
	If      string
	// contains filtered or unexported fields
}

func (*SectionRule) ExtractKey

func (self *SectionRule) ExtractKey(rec Record) (string, error)

Jump to

Keyboard shortcuts

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