database

package
v0.0.0-...-b55247b Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var AddOrUpdateTransfer = func(tx *sql.Tx, relatedDetailId int64, accountId interface{}, user string) {
	count := runUpdate(tx, moveTransferDetailSQL, accountId, user, relatedDetailId)
	if count == 0 {
		insertTransferDetail(tx, relatedDetailId, accountId, user)
	}
}

Functions

func AddCompany

func AddCompany(tx *sql.Tx, name string, user string) *table.Company

AddCompany adds a new company.

func DeleteCompanies

func DeleteCompanies(tx *sql.Tx, ids []map[string]interface{}) int64

DeleteCompanies deletes companies and returns the number of deleted companies.

func DeleteDetails

func DeleteDetails(tx *sql.Tx, ids []*VersionID)

func DeleteRelatedDetails

func DeleteRelatedDetails(tx *sql.Tx, txIDs []map[string]interface{})

func DeleteTransactionDetails

func DeleteTransactionDetails(tx *sql.Tx, txIDs []map[string]interface{})

func DeleteTransactions

func DeleteTransactions(tx *sql.Tx, ids []map[string]interface{})

DeleteTransactions deletes transactions and panics the number of deleted transactions is less than the number of IDs.

func DeleteTransfer

func DeleteTransfer(tx *sql.Tx, relatedDetailId int64)

func GetAccountByID

func GetAccountByID(tx *sql.Tx, id int64) []*table.Account

GetAccountByID returns the account with ID.

func GetAccountsByCompanyIDs

func GetAccountsByCompanyIDs(tx *sql.Tx, companyIDs []int64) []*table.Account

GetAccountsByCompanyIDs returns the accounts for the sepcified companies.

func GetAccountsByName

func GetAccountsByName(tx *sql.Tx, name string) []*table.Account

GetAccountsByName returns the accounts having name.

func GetAllAccounts

func GetAllAccounts(tx *sql.Tx) []*table.Account

GetAllAccounts loads all accounts.

func GetAllCategories

func GetAllCategories(tx *sql.Tx) []*table.Category

GetAllCategories loads all transaction categories.

func GetAllCompanies

func GetAllCompanies(tx *sql.Tx) []*table.Company

GetAllCompanies loads all companies.

func GetAllGroups

func GetAllGroups(tx *sql.Tx) []*table.Group

GetAllGroups loads all groups.

func GetAllPayees

func GetAllPayees(tx *sql.Tx) []*table.Payee

GetAllPayees loads all payees.

func GetAllSecurities

func GetAllSecurities(tx *sql.Tx) []*table.Security

GetAllSecurities loads all securities.

func GetCompaniesByIDs

func GetCompaniesByIDs(tx *sql.Tx, ids []int64) []*table.Company

GetCompaniesByIDs loads specified companies.

func GetCompanyByID

func GetCompanyByID(tx *sql.Tx, id int64) []*table.Company

GetCompanyByID returns the company with the ID.

func GetCompanyByName

func GetCompanyByName(tx *sql.Tx, name string) []*table.Company

GetCompanyByName returns the company with the name.

func GetDetailsByAccountID

func GetDetailsByAccountID(tx *sql.Tx, accountID int64) []*table.TransactionDetail

func GetDetailsByTxIDs

func GetDetailsByTxIDs(tx *sql.Tx, txIDs []int64) []*table.TransactionDetail

func GetRelatedDetailsByAccountID

func GetRelatedDetailsByAccountID(tx *sql.Tx, accountID int64) []*table.TransactionDetail

func GetRelatedDetailsByTxIDs

func GetRelatedDetailsByTxIDs(tx *sql.Tx, txIDs []int64) []*table.TransactionDetail

func GetRelatedTransactions

func GetRelatedTransactions(tx *sql.Tx, relatedTxIDs []int64) []*table.Transaction

GetRelatedTransactions returns all related transactions for the transaction IDs.

func GetRelatedTransactionsByAccountID

func GetRelatedTransactionsByAccountID(tx *sql.Tx, accountID int64) []*table.Transaction

GetRelatedTransactionsByAccountID returns all related transactions for the account.

func GetSecurityByID

func GetSecurityByID(tx *sql.Tx, id int64) []*table.Security

GetSecurityByID returns the security with ID.

func GetSecurityBySymbol

func GetSecurityBySymbol(tx *sql.Tx, symbol string) []*table.Security

GetSecurityBySymbol returns the security for the symbol.

func GetTransactions

func GetTransactions(tx *sql.Tx, accountID int64) []*table.Transaction

GetTransactions returns all transactions for the account.

func GetTransactionsByIDs

func GetTransactionsByIDs(tx *sql.Tx, ids []int64) []*table.Transaction

GetTransactionsByIDs returns transactions for the specified IDs.

func InsertDetail

func InsertDetail(tx *sql.Tx, txID int64, amount interface{}, values InputObject, user string)

func InsertTransaction

func InsertTransaction(tx *sql.Tx, accountID int64, values InputObject, user string) int64

InsertTransaction inserts a transaction.

func SetTransferAmount

func SetTransferAmount(tx *sql.Tx, relatedDetailId int64, amount interface{}, user string)

func UpdateCompany

func UpdateCompany(tx *sql.Tx, id int64, version int64, name string, user string)

UpdateCompany updates a company name.

func UpdateDetail

func UpdateDetail(tx *sql.Tx, id int64, version int64, setCategory bool, categoryId interface{}, values InputObject, user string)

func UpdateTransaction

func UpdateTransaction(tx *sql.Tx, id int64, version int64, values InputObject, user string)

UpdateTransactions updates transactions.

func ValidateDetails

func ValidateDetails(tx *sql.Tx, transactionIDs []int64)

ValidateDetails checks for invalid security fields and returns a map of detail ID to validation error.

Types

type InputObject

type InputObject map[string]interface{}

func (InputObject) FloatOrNull

func (io InputObject) FloatOrNull(key string) interface{}

func (InputObject) GetFloat

func (io InputObject) GetFloat(key string) (interface{}, bool)

func (InputObject) GetInt

func (io InputObject) GetInt(key string) (interface{}, bool)

func (InputObject) GetString

func (io InputObject) GetString(key string) (interface{}, bool)

func (InputObject) GetVersionID

func (io InputObject) GetVersionID() *VersionID

func (InputObject) IntOrNull

func (io InputObject) IntOrNull(key string) interface{}

func (InputObject) RequireInt

func (io InputObject) RequireInt(key string) int64

func (InputObject) StringOrNull

func (io InputObject) StringOrNull(key string) interface{}

func (InputObject) YesNoOrNull

func (io InputObject) YesNoOrNull(key string) interface{}

type VersionID

type VersionID struct {
	ID      int64
	Version int64
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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