model

package
v0.8.4 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Uncategorized is used as the default account2 on an imported transaction
	Uncategorized = "uncategorized"

	// Ledger account types
	AssetAccount     = "assets"
	LiabilityAccount = "liabilities"
	ExpenseAccount   = "expenses"
	RevenueAccount   = "revenues"

	// RedactSuffixLength the number of characters that remain unredacted at the end of a redacted string
	RedactSuffixLength = 4
	// RedactPrefixLength the number of stars at the end beginning of a redacted string
	RedactPrefixLength = 4
)

Variables

This section is empty.

Functions

func LedgerAccountName

func LedgerAccountName(a Account) string

LedgerAccountName returns a suitable account name for a ledger file

func ValidateAccount

func ValidateAccount(account Account) error

func ValidateInstitution

func ValidateInstitution(inst Institution) error

func ValidatePartialAccount

func ValidatePartialAccount(account interface {
	ID() string
	Description() string
}) error

Types

type Account

type Account interface {
	Description() string
	ID() string
	Institution() Institution
	Type() string
}

Account identifies an account at a financial institution

type BasicAccount

type BasicAccount struct {
	AccountDescription string
	AccountID          string
	AccountType        string
	BasicInstitution   BasicInstitution
}

func (*BasicAccount) Description

func (b *BasicAccount) Description() string

func (*BasicAccount) ID

func (b *BasicAccount) ID() string

func (*BasicAccount) Institution

func (b *BasicAccount) Institution() Institution

func (*BasicAccount) Type

func (b *BasicAccount) Type() string

Type returns the ledger account type, such as 'assets' or 'liabilities'

type BasicInstitution

type BasicInstitution struct {
	InstDescription string
	InstFID         string
	InstOrg         string
}

BasicInstitution includes the bare minimum information to implement an institution Typically used for adding accounts via OFX imports

func (BasicInstitution) Description

func (i BasicInstitution) Description() string

Description implements Institution

func (BasicInstitution) FID

func (i BasicInstitution) FID() string

FID implements Institution

func (BasicInstitution) Org

func (i BasicInstitution) Org() string

Org implements Institution

type Institution

type Institution interface {
	Description() string
	FID() string
	Org() string
}

Institution represents the connection and identification details for a financial institution

type LedgerAccountFormat

type LedgerAccountFormat struct {
	AccountType string
	Institution string
	AccountID   string
	Remaining   string
}

LedgerAccountFormat represents an account's structured name for a ledger account format

func LedgerFormat

func LedgerFormat(a Account) *LedgerAccountFormat

LedgerFormat parses the account and returns a ledger account format

func ParseLedgerFormat

func ParseLedgerFormat(account string) (*LedgerAccountFormat, error)

ParseLedgerFormat parses the given account string as a ledger account

func (*LedgerAccountFormat) String

func (l *LedgerAccountFormat) String() string

type TransactionParser

type TransactionParser func(*ofxgo.Response) ([]Account, []ledger.Transaction, error)

Jump to

Keyboard shortcuts

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