db

package
v0.0.0-...-c907a8e Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TransactionCreditLabelMap = map[string]TransactionCategory{
	"income":      Income,
	"loan Return": LoansReturn,
}
View Source
var TransactionDebitLabelMap = map[string]TransactionCategory{
	"Unknown": Unknown,
	"Split between company and personal accounts":                Personal,
	"Legal (accountancy, advertising)":                           Legal,
	"Travel expenses":                                            Travel,
	"Office expenses":                                            Office,
	"Equipment expenses":                                         EquipmentExpenses,
	"Premises (heat, water, electricity)":                        Premises,
	"Cost of Sales (goods purchased for resale, subcontractors)": CostOfSales,
	"Wage payments, non-director salaries":                       WagesPayment,
	"Penalties and fines":                                        Penalties,
	"Bank charges":                                               BankCharges,
	"Pension":                                                    Pension,
	"HMRC (VAT payment, Corp Tax etc)":                           HMRC,
	"Fixed assets purchase":                                      FixedAssetPurchase,
	"Loan":                                                       Loan,
}

Functions

This section is empty.

Types

type Database

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

func Init

func Init(dbPathFile string) *Database

func (Database) AllocateTransactions

func (d Database) AllocateTransactions(cats map[int]TransactionCategory) error

func (Database) Close

func (d Database) Close()

func (Database) GetAll

func (d Database) GetAll(limit, page int) ([]Transaction, error)

func (Database) GetExpensesSince

func (d Database) GetExpensesSince(accountingDateStart time.Time, accountingDateEnd time.Time) (float64, error)

func (Database) GetMovedOut

func (d Database) GetMovedOut(since time.Time, until time.Time) (float64, error)

func (Database) GetPensionSince

func (d Database) GetPensionSince(accountingDateStart time.Time, accountingDateEnd time.Time) (float64, error)

func (Database) GetRevenueSince

func (d Database) GetRevenueSince(accountingDateStart time.Time, accountingDateEnd time.Time) (float64, error)

func (Database) GetTransactionsByCategories

func (d Database) GetTransactionsByCategories(categories ...TransactionCategory) ([]Transaction, error)

func (Database) GetTransactionsCount

func (d Database) GetTransactionsCount() (int, error)

func (Database) GetUnallocated

func (d Database) GetUnallocated() ([]Transaction, error)

func (Database) ImportTransactions

func (d Database) ImportTransactions(transactions []Transaction) (int, error)

type Transaction

type Transaction struct {
	Pk            int             `storm:"id,increment"` // primary key with auto increment
	Date          time.Time       `storm:"index"`        // midnight, GMT
	Type          TransactionType `storm:"index"`
	Card          string          // last 4 digits
	Description   string
	Credit        float64
	Debit         float64
	Balance       float64
	ToBeAllocated bool                `storm:"index"` // when category of this transaction is specified, it is "allocated"
	Category      TransactionCategory `storm:"index"`
}

func (*Transaction) PrettyPrint

func (s *Transaction) PrettyPrint() string

type TransactionCategory

type TransactionCategory int
const (
	Unknown  TransactionCategory = 1 + iota
	Personal                     // split between company and personal accounts (salary and dividends)
	Legal                        // accountancy, advertising
	Travel
	Office            // rent
	EquipmentExpenses // computers, hosting
	Premises          // heat, water, electricity
	CostOfSales       // goods purchased for resale, subcontractors
	WagesPayment      // non-director sales
	Penalties
	BankCharges
	Pension
	HMRC
	FixedAssetPurchase
	Income
	LoansReturn
	Loan // when you borrow some money from your company and have to return it back
)

type TransactionType

type TransactionType int
const (
	Credit TransactionType = 1 + iota
	Debit
)

type TransactionUi

type TransactionUi struct {
	// contains filtered or unexported fields
}
var CreditTransactionUI TransactionUi
var DebitTransactionUI TransactionUi

func (TransactionUi) GetLabels

func (d TransactionUi) GetLabels() []string

func (TransactionUi) GetPositionFor

func (d TransactionUi) GetPositionFor(category TransactionCategory) int

Jump to

Keyboard shortcuts

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