models

package
v0.0.1-alpha-albatross... Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const Completed string = "COMPLETED"
View Source
const Failed string = "FAILED"
View Source
const Processing string = "PROCESSING"
View Source
const Submitted string = "SUBMITTED"

Variables

This section is empty.

Functions

func BootstrapDatabase

func BootstrapDatabase(ctx context.Context)

Types

type Account

type Account struct {
	gorm.Model
	Name            string
	AccountCategory string
	AccountType     string
	DefaultParser   *string
}

type AccountRepository

type AccountRepository struct{}

func GetAccountRepository

func GetAccountRepository() *AccountRepository

func (*AccountRepository) GetAccountByID

func (ar *AccountRepository) GetAccountByID(id uint) (Account, error)

func (*AccountRepository) GetAllAccounts

func (ar *AccountRepository) GetAllAccounts() ([]Account, error)

func (*AccountRepository) Save

func (*AccountRepository) Save(account Account) (id uint, err error)

Save is an UPSERT operation, returning the ID of the record and an optional error

type Balance

type Balance struct {
	gorm.Model
	EffectiveDate      string
	Amount             int64
	AccountID          uint
	Account            Account
	ImportSubmissionID *uint
	ImportSubmission   *ImportSubmission
}

type BalanceRepository

type BalanceRepository struct{}

func GetBalanceRepository

func GetBalanceRepository() *BalanceRepository

func (*BalanceRepository) GetAllBalances

func (*BalanceRepository) GetAllBalances(ctx context.Context) ([]Balance, error)

func (*BalanceRepository) GetBalanceByID

func (*BalanceRepository) GetBalanceByID(ctx context.Context, balanceID uint) Balance

func (*BalanceRepository) GetBalancesByMonth

func (*BalanceRepository) GetBalancesByMonth(ctx context.Context, accountType string, startYearMonth time.Time, endYearMonth time.Time) []BalancesWithDate

func (*BalanceRepository) GetBalancesForAccount

func (*BalanceRepository) GetBalancesForAccount(ctx context.Context, accountID uint) []Balance

func (*BalanceRepository) GetBalancesOfAllAssetsByMonth

func (*BalanceRepository) GetBalancesOfAllAssetsByMonth(ctx context.Context, startYearMonth time.Time, endYearMonth time.Time) []BalancesWithDate

func (*BalanceRepository) GetBalancesOfAllLiabilitiesByMonth

func (*BalanceRepository) GetBalancesOfAllLiabilitiesByMonth(ctx context.Context, startYearMonth time.Time, endYearMonth time.Time) []BalancesWithDate

func (*BalanceRepository) GetLatestBalanceForAccount

func (*BalanceRepository) GetLatestBalanceForAccount(ctx context.Context, accountID uint) Balance

func (*BalanceRepository) Save

func (*BalanceRepository) Save(balance Balance) (id uint, err error)

Save is an UPSERT operation, returning the ID of the record and an optional error

type BalancesWithDate

type BalancesWithDate struct {
	Date     time.Time
	Balances []Balance
}

type Budget

type Budget struct {
	gorm.Model
	Amount     int64
	CategoryID uint
	Category   Category
}

type BudgetRepository

type BudgetRepository struct{}

func GetBudgetRepository

func GetBudgetRepository() *BudgetRepository

func (*BudgetRepository) GetAllBudgets

func (*BudgetRepository) GetAllBudgets() ([]Budget, error)

func (*BudgetRepository) GetBudgetByID

func (*BudgetRepository) GetBudgetByID(id uint) (Budget, error)

func (*BudgetRepository) Save

func (*BudgetRepository) Save(budget Budget) (id uint, err error)

Save is an UPSERT operation, returning the ID of the record and an optional error

type Category

type Category struct {
	gorm.Model
	Name string `gorm:"uniqueIndex"`
}

type CategoryRepository

type CategoryRepository struct{}

func GetCategoryRepository

func GetCategoryRepository() *CategoryRepository

func (*CategoryRepository) GetAllCategories

func (*CategoryRepository) GetAllCategories() ([]Category, error)

func (*CategoryRepository) GetCategoryByID

func (*CategoryRepository) GetCategoryByID(id uint) (Category, error)

type ImportSubmission

type ImportSubmission struct {
	gorm.Model
	FileName             string
	SubmissionDateTime   string
	Status               string
	AccountType          string
	TransactionsImported int
	TransactionsSkipped  int
	BalancesImported     int
	BalancesSkipped      int
	AccountID            uint
	Account              Account
}

type ImportSubmissionRepository

type ImportSubmissionRepository struct{}

func GetImportSubmissionRepository

func GetImportSubmissionRepository() *ImportSubmissionRepository

func (*ImportSubmissionRepository) Save

func (*ImportSubmissionRepository) Save(submission ImportSubmission) (id uint, err error)

Save is an UPSERT operation, returning the ID of the record and an optional error

type Transaction

type Transaction struct {
	gorm.Model
	Date        string
	Description string
	Amount      int64
	// Excluded           int // 0 = false, 1 = true. SQLite doesn't have a boolean type
	Excluded           bool // Will be stored as 0 or 1 in SQLite
	Hash               string
	AccountID          uint
	Account            Account
	CategoryID         uint
	Category           Category
	ImportSubmissionID *uint
	ImportSubmission   *ImportSubmission
}

type TransactionRepository

type TransactionRepository struct{}

func GetTransactionRepository

func GetTransactionRepository() *TransactionRepository

func (*TransactionRepository) Create

func (*TransactionRepository) Create(txn *Transaction) error

func (*TransactionRepository) GetAllTransactions

func (*TransactionRepository) GetAllTransactions() ([]Transaction, error)

func (*TransactionRepository) GetTransactionByID

func (*TransactionRepository) GetTransactionByID(id uint) (Transaction, error)

func (*TransactionRepository) GetTransactionsByHash

func (*TransactionRepository) GetTransactionsByHash(hash string, submissionID uint) ([]Transaction, error)

func (*TransactionRepository) GetTransactionsByImportSubmission

func (*TransactionRepository) GetTransactionsByImportSubmission(id uint) ([]Transaction, error)

func (*TransactionRepository) Save

func (*TransactionRepository) Save(txn Transaction) (id uint, err error)

Save is an UPSERT operation, returning the ID of the record and an optional error

Jump to

Keyboard shortcuts

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