financialimporter

package
v0.0.0-...-6f08b94 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2026 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CurrencyConversionEndpoint = "http://api.exchangeratesapi.io"

Variables

This section is empty.

Functions

func Round

func Round(x, unit float64) float64

Types

type CurrencyConversion

type CurrencyConversion map[string]float64

type CurrencyConversionResponse

type CurrencyConversionResponse struct {
	Date      string
	Timestamp int
	Base      string
	Rates     map[string]float64
}

{"rates":{"CAD":1.3259376651},"date":"2019-03-19","base":"USD"}

type CurrencyConverter

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

func NewCurrencyConverter

func NewCurrencyConverter(accessKey string) *CurrencyConverter

func (*CurrencyConverter) ConversionRate

func (c *CurrencyConverter) ConversionRate(from, to string) (float64, error)

type FinancialImporter

type FinancialImporter interface {
	Migrate() error
	Import() (int, error)
}

func NewTransactionImporter

func NewTransactionImporter(db *bun.DB, currencyConverter *CurrencyConverter, transactions []Transaction, calculatedFields []config.CalculatedField, transactionCurrency string, currencies []string, importAfterDate time.Time, sqlTable string) FinancialImporter

type SQLTransaction

type SQLTransaction struct {
	bun.BaseModel    `bun:"table:transactions"`
	ID               int64  `bun:",pk,autoincrement"`
	Key              string `bun:",pk,unique"`
	TransactionDate  time.Time
	TransactionMonth time.Time
	Category         string
	CategoryGroup    string
	Payee            string
	Account          string
	Memo             string `bun:"type:text"`
	Currency         string
	Amount           float64
	USD              float64
	CAD              float64
	TransactionType  string
	Tags             []string               `bun:",array"`
	Fields           map[string]interface{} `bun:"type:jsonb"`
	UpdatedAt        time.Time
}

type Transaction

type Transaction interface {
	Date() string
	Payee() string
	Category() string
	CategoryGroup() string
	Memo() string

	// Currency() string
	Amount() float64
	TransactionType() TransactionType

	Tags() []string
	HasSubTransactions() bool
	SubTransactions() []Transaction

	Account() string

	IndexKey() string
}

type TransactionImporter

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

func (*TransactionImporter) Import

func (importer *TransactionImporter) Import() (int, error)

func (*TransactionImporter) Migrate

func (importer *TransactionImporter) Migrate() error

type TransactionType

type TransactionType int
const (
	Expense TransactionType = iota
	Income
	Transfer
)

func (TransactionType) String

func (t TransactionType) String() string

Jump to

Keyboard shortcuts

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