Documentation ¶
Index ¶
- Variables
- func AddCompany(tx *sql.Tx, name string, user string) *table.Company
- func DeleteCompanies(tx *sql.Tx, ids []map[string]interface{}) int64
- func DeleteDetails(tx *sql.Tx, ids []*VersionID)
- func DeleteRelatedDetails(tx *sql.Tx, txIDs []map[string]interface{})
- func DeleteTransactionDetails(tx *sql.Tx, txIDs []map[string]interface{})
- func DeleteTransactions(tx *sql.Tx, ids []map[string]interface{})
- func DeleteTransfer(tx *sql.Tx, relatedDetailId int64)
- func GetAccountByID(tx *sql.Tx, id int64) []*table.Account
- func GetAccountsByCompanyIDs(tx *sql.Tx, companyIDs []int64) []*table.Account
- func GetAccountsByName(tx *sql.Tx, name string) []*table.Account
- func GetAllAccounts(tx *sql.Tx) []*table.Account
- func GetAllCategories(tx *sql.Tx) []*table.Category
- func GetAllCompanies(tx *sql.Tx) []*table.Company
- func GetAllGroups(tx *sql.Tx) []*table.Group
- func GetAllPayees(tx *sql.Tx) []*table.Payee
- func GetAllSecurities(tx *sql.Tx) []*table.Security
- func GetCompaniesByIDs(tx *sql.Tx, ids []int64) []*table.Company
- func GetCompanyByID(tx *sql.Tx, id int64) []*table.Company
- func GetCompanyByName(tx *sql.Tx, name string) []*table.Company
- func GetDetailsByAccountID(tx *sql.Tx, accountID int64) []*table.TransactionDetail
- func GetDetailsByTxIDs(tx *sql.Tx, txIDs []int64) []*table.TransactionDetail
- func GetRelatedDetailsByAccountID(tx *sql.Tx, accountID int64) []*table.TransactionDetail
- func GetRelatedDetailsByTxIDs(tx *sql.Tx, txIDs []int64) []*table.TransactionDetail
- func GetRelatedTransactions(tx *sql.Tx, relatedTxIDs []int64) []*table.Transaction
- func GetRelatedTransactionsByAccountID(tx *sql.Tx, accountID int64) []*table.Transaction
- func GetSecurityByID(tx *sql.Tx, id int64) []*table.Security
- func GetSecurityBySymbol(tx *sql.Tx, symbol string) []*table.Security
- func GetTransactions(tx *sql.Tx, accountID int64) []*table.Transaction
- func GetTransactionsByIDs(tx *sql.Tx, ids []int64) []*table.Transaction
- func InsertDetail(tx *sql.Tx, txID int64, amount interface{}, values InputObject, user string)
- func InsertTransaction(tx *sql.Tx, accountID int64, values InputObject, user string) int64
- func SetTransferAmount(tx *sql.Tx, relatedDetailId int64, amount interface{}, user string)
- func UpdateCompany(tx *sql.Tx, id int64, version int64, name string, user string)
- func UpdateDetail(tx *sql.Tx, id int64, version int64, setCategory bool, categoryId interface{}, ...)
- func UpdateTransaction(tx *sql.Tx, id int64, version int64, values InputObject, user string)
- func ValidateDetails(tx *sql.Tx, transactionIDs []int64)
- type InputObject
- func (io InputObject) FloatOrNull(key string) interface{}
- func (io InputObject) GetFloat(key string) (interface{}, bool)
- func (io InputObject) GetInt(key string) (interface{}, bool)
- func (io InputObject) GetString(key string) (interface{}, bool)
- func (io InputObject) GetVersionID() *VersionID
- func (io InputObject) IntOrNull(key string) interface{}
- func (io InputObject) RequireInt(key string) int64
- func (io InputObject) StringOrNull(key string) interface{}
- func (io InputObject) YesNoOrNull(key string) interface{}
- type VersionID
Constants ¶
This section is empty.
Variables ¶
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 ¶
AddCompany adds a new company.
func DeleteCompanies ¶
DeleteCompanies deletes companies and returns the number of deleted companies.
func DeleteDetails ¶
func DeleteRelatedDetails ¶
func DeleteTransactions ¶
DeleteTransactions deletes transactions and panics the number of deleted transactions is less than the number of IDs.
func DeleteTransfer ¶
func GetAccountByID ¶
GetAccountByID returns the account with ID.
func GetAccountsByCompanyIDs ¶
GetAccountsByCompanyIDs returns the accounts for the sepcified companies.
func GetAccountsByName ¶
GetAccountsByName returns the accounts having name.
func GetAllAccounts ¶
GetAllAccounts loads all accounts.
func GetAllCategories ¶
GetAllCategories loads all transaction categories.
func GetAllCompanies ¶
GetAllCompanies loads all companies.
func GetAllSecurities ¶
GetAllSecurities loads all securities.
func GetCompaniesByIDs ¶
GetCompaniesByIDs loads specified companies.
func GetCompanyByID ¶
GetCompanyByID returns the company with the ID.
func GetCompanyByName ¶
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 ¶
GetSecurityByID returns the security with ID.
func GetSecurityBySymbol ¶
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 ¶
InsertTransaction inserts a transaction.
func SetTransferAmount ¶
func UpdateCompany ¶
UpdateCompany updates a company name.
func UpdateDetail ¶
func UpdateTransaction ¶
UpdateTransactions updates transactions.
func ValidateDetails ¶
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{}