database

package
v0.0.0-...-14f5618 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckExistingAccount

func CheckExistingAccount(db *pgxpool.Pool, params CheckExistingAccountParams) (bool, error)

func CreateNewAccount

func CreateNewAccount(db *pgxpool.Pool, params CreateNewAccountParams) (bool, error)

func CreateNewCashRecord

func CreateNewCashRecord(db *pgxpool.Pool, params CreateNewCashRecordParams) (bool, error)

func CreateNewClient

func CreateNewClient(db *pgxpool.Pool, params CreateNewClientParams) (string, error)

func CreateNewFuturePayment

func CreateNewFuturePayment(db *pgxpool.Pool, params CreateNewFuturePaymentParams) (bool, error)

func CreateNewStockHolding

func CreateNewStockHolding(db *pgxpool.Pool, params CreateNewStockHoldingParams) (bool, error)

func CreateNewTransaction

func CreateNewTransaction(db *pgxpool.Pool, params CreateNewTransactionParams) (bool, error)

func DeleteAccount

func DeleteAccount(db *pgxpool.Pool, accountId string) (bool, error)

func DeleteCashRecord

func DeleteCashRecord(db *pgxpool.Pool, cashId string, clientId string) (bool, error)

func DeleteFuturePayment

func DeleteFuturePayment(db *pgxpool.Pool, futurePaymentId string, clientId string) (bool, error)

func DeleteStockHolding

func DeleteStockHolding(db *pgxpool.Pool, accountStockId string) (bool, error)

func DeleteTransaction

func DeleteTransaction(db *pgxpool.Pool, transactionId string, clientId string) (bool, error)

func GetAccountBalance

func GetAccountBalance(db *pgxpool.Pool, accountId string) (string, error)

func GetDefaultCurrency

func GetDefaultCurrency(db *pgxpool.Pool) (string, error)

func UpdateAccount

func UpdateAccount(db *pgxpool.Pool, params UpdateAccountParams) (bool, error)

func UpdateAccountBalance

func UpdateAccountBalance(db *pgxpool.Pool, balance string, accountId string) (bool, error)

func UpdateCashRecord

func UpdateCashRecord(db *pgxpool.Pool, params UpdateCashRecordParams) (bool, error)

func UpdateClientSettings

func UpdateClientSettings(db *pgxpool.Pool, params UpdateClientSettingsParams) (bool, error)

func UpdateExchangeRate

func UpdateExchangeRate(db *pgxpool.Pool, params UpdateExchangeRateParams) (bool, error)

func UpdateFuturePayment

func UpdateFuturePayment(db *pgxpool.Pool, params UpdateFuturePaymentParams) (bool, error)

func UpdateFuturePaymentSchedule

func UpdateFuturePaymentSchedule(db *pgxpool.Pool, scheduledAt time.Time, id string) (bool, error)

func UpdateStockHoldingCost

func UpdateStockHoldingCost(db *pgxpool.Pool, params UpdateStockHoldingCostParams) (bool, error)

func UpdateStockPrice

func UpdateStockPrice(db *pgxpool.Pool, params UpdateStockPriceParams) (bool, error)

Types

type Account

type Account struct {
	Id                         string    `json:"id"`
	ClientId                   string    `json:"client_id"`
	AssetProviderAccountTypeId string    `json:"asset_provider_account_type_id"`
	CurrencyId                 string    `json:"currency_id"`
	Balance                    string    `json:"balance"`
	CreatedAt                  time.Time `json:"created_at"`
	UpdatedAt                  time.Time `json:"updated_at"`
}

type AccountDetails

type AccountDetails struct {
	Name       string `json:"name"`
	Balance    string `json:"balance"`
	CurrencyId string `json:"currencyId"`
}

type AccountStock

type AccountStock struct {
	Id        string `json:"id"`
	AccountId string `json:"account_id"`
	StockId   string `json:"stock_id"`
	Unit      string `json:"unit"`
	Cost      string `json:"cost"`
}

func GetAllStockHoldings

func GetAllStockHoldings(db *pgxpool.Pool, clientId string) ([]AccountStock, error)

type AccountSummary

type AccountSummary struct {
	Id              string `json:"id"`
	Name            string `json:"name"`
	Balance         string `json:"balance"`
	CurrencyId      string `json:"currencyId"`
	AccountTypeId   string `json:"accountTypeId"`
	AssetProviderId string `json:"assetProviderId"`
}

func GetAccountSummary

func GetAccountSummary(db *pgxpool.Pool, accountId string) (AccountSummary, error)

func GetAllAccountSummaryByType

func GetAllAccountSummaryByType(db *pgxpool.Pool, providerType string, clientId string) ([]AccountSummary, error)

type AssetProvider

type AssetProvider struct {
	Id        string    `json:"id"`
	Name      string    `json:"name"`
	Icon      string    `json:"icon"`
	Type      string    `json:"type"`
	CountryId string    `json:"country_id"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type AssetProviderAccountType

type AssetProviderAccountType struct {
	Id              string    `json:"id"`
	AssetProviderId string    `json:"asset_provider_id"`
	Name            string    `json:"name"`
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
}

type Cash

type Cash struct {
	Id         string    `json:"id"`
	ClientId   string    `json:"client_id"`
	CurrencyId string    `json:"currency_id"`
	Amount     string    `json:"amount"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

func GetAllCash

func GetAllCash(db *pgxpool.Pool, clientId string) ([]Cash, error)

type CheckExistingAccountParams

type CheckExistingAccountParams struct {
	Name            string `json:"name"`
	ClientId        string `json:"client_id"`
	AssetProviderId string `json:"asset_provider_id"`
}

type Client

type Client struct {
	Id         string    `json:"id"`
	Email      string    `json:"email"`
	Username   string    `json:"username"`
	Password   string    `json:"password"`
	CurrencyId string    `json:"currency_id"`
	CreatedAt  time.Time `json:"created_at"`
	UpdatedAt  time.Time `json:"updated_at"`
}

func GetClientByEmail

func GetClientByEmail(db *pgxpool.Pool, email string) (Client, error)

func GetClientById

func GetClientById(db *pgxpool.Pool, id string) (Client, error)

type Country

type Country struct {
	Id   string `json:"id"`
	Name string `json:"name"`
	Code string `json:"code"`
}

func GetAllCountries

func GetAllCountries(db *pgxpool.Pool) ([]Country, error)

func GetCountryByCode

func GetCountryByCode(db *pgxpool.Pool, code string) (Country, error)

type CreateNewAccountParams

type CreateNewAccountParams struct {
	Name            string `json:"name"`
	ClientId        string `json:"client_id"`
	CurrencyId      string `json:"currency_id"`
	AssetProviderId string `json:"asset_provider_id"`
}

type CreateNewCashRecordParams

type CreateNewCashRecordParams struct {
	Amount     string `json:"amount"`
	ClientId   string `json:"client_id"`
	CurrencyId string `json:"currency_id"`
}

type CreateNewClientParams

type CreateNewClientParams struct {
	Email      string `json:"email"`
	Username   string `json:"username"`
	Password   string `json:"password"`
	CurrencyId string `json:"currency_id"`
}

type CreateNewFuturePaymentParams

type CreateNewFuturePaymentParams struct {
	Id          string    `json:"id"`
	Name        string    `json:"name"`
	Income      bool      `json:"income"`
	Amount      string    `json:"amount"`
	Remarks     *string   `json:"remarks"`
	Rolling     bool      `json:"rolling"`
	Category    string    `json:"category"`
	Frequency   *int64    `json:"frequency"`
	ClientId    string    `json:"client_id"`
	AccountId   string    `json:"account_id"`
	CurrencyId  string    `json:"currency_id"`
	ScheduledAt time.Time `json:"scheduled_at"`
}

type CreateNewStockHoldingParams

type CreateNewStockHoldingParams struct {
	Unit      string `json:"unit"`
	Cost      string `json:"cost"`
	StockId   string `json:"stock_id"`
	AccountId string `json:"account_id"`
}

type CreateNewTransactionParams

type CreateNewTransactionParams struct {
	Name       string    `json:"name"`
	Income     bool      `json:"income"`
	Amount     string    `json:"amount"`
	Remarks    *string   `json:"remarks"`
	Category   string    `json:"category"`
	ClientId   string    `json:"client_id"`
	AccountId  string    `json:"account_id"`
	CurrencyId string    `json:"currency_id"`
	ExecutedAt time.Time `json:"executed_at"`
}

type Currency

type Currency struct {
	Id     string `json:"id"`
	Ticker string `json:"ticker"`
	Symbol string `json:"symbol"`
}

func GetAllCurrencies

func GetAllCurrencies(db *pgxpool.Pool) ([]Currency, error)

type ExchangeRate

type ExchangeRate struct {
	Id               string `json:"id"`
	BaseCurrencyId   string `json:"base_currency_id"`
	TargetCurrencyId string `json:"target_currency_id"`
	Rate             string `json:"rate"`
}

func GetAllExchangeRates

func GetAllExchangeRates(db *pgxpool.Pool) ([]ExchangeRate, error)

type FuturePayment

type FuturePayment struct {
	Id          string         `json:"id"`
	ClientId    string         `json:"client_id"`
	AccountId   string         `json:"account_id"`
	CurrencyId  string         `json:"currency_id"`
	Name        string         `json:"name"`
	Amount      string         `json:"amount"`
	Income      bool           `json:"income"`
	Rolling     bool           `json:"rolling"`
	Category    string         `json:"category"`
	Frequency   sql.NullInt64  `json:"frequency"`
	Remarks     sql.NullString `json:"remarks"`
	ScheduledAt time.Time      `json:"scheduled_at"`
}

func GetAllFuturePayments

func GetAllFuturePayments(db *pgxpool.Pool) ([]FuturePayment, error)

func GetAllFuturePaymentsByClientId

func GetAllFuturePaymentsByClientId(db *pgxpool.Pool, clientId string) ([]FuturePayment, error)

type ProviderDetail

type ProviderDetail struct {
	Id        string `json:"id"`
	Name      string `json:"name"`
	Icon      string `json:"icon"`
	CountryId string `json:"countryId"`
}

func GetAllProvidersByType

func GetAllProvidersByType(db *pgxpool.Pool, providerType string) ([]ProviderDetail, error)

type Stock

type Stock struct {
	Id           string `json:"id"`
	CountryId    string `json:"country_id"`
	CurrencyId   string `json:"currency_id"`
	Name         string `json:"name"`
	Ticker       string `json:"ticker"`
	CurrentPrice string `json:"current_price"`
}

func GetAllStocks

func GetAllStocks(db *pgxpool.Pool) ([]Stock, error)

func GetAllStocksByCountryId

func GetAllStocksByCountryId(db *pgxpool.Pool, id string) ([]Stock, error)

type Transaction

type Transaction struct {
	Id         string         `json:"id"`
	Name       string         `json:"name"`
	Income     bool           `json:"income"`
	ClientId   string         `json:"client_id"`
	AccountId  sql.NullString `json:"account_id"`
	CurrencyId string         `json:"currency_id"`
	Category   string         `json:"category"`
	Amount     string         `json:"amount"`
	Remarks    sql.NullString `json:"remarks"`
	ExecutedAt time.Time      `json:"executed_at"`
}

func GetAllTransactions

func GetAllTransactions(db *pgxpool.Pool, clientId string) ([]Transaction, error)

type TransactionAndAccountBalance

type TransactionAndAccountBalance struct {
	Income    bool   `json:"income"`
	Amount    string `json:"amount"`
	Balance   string `json:"balance"`
	AccountId string `json:"account_id"`
}

func GetTransactionAndAccountBalanceById

func GetTransactionAndAccountBalanceById(db *pgxpool.Pool, transactionId string) (TransactionAndAccountBalance, error)

type UpdateAccountParams

type UpdateAccountParams struct {
	Balance       string `json:"balance"`
	CurrencyId    string `json:"currency_id"`
	AccountTypeId string `json:"account_type_id"`
}

type UpdateCashRecordParams

type UpdateCashRecordParams struct {
	Id         string `json:"id"`
	Amount     string `json:"amount"`
	ClientId   string `json:"client_id"`
	CurrencyId string `json:"currency_id"`
}

type UpdateClientSettingsParams

type UpdateClientSettingsParams struct {
	Username   string `json:"username"`
	ClientId   string `json:"client_id"`
	CurrencyId string `json:"currency_id"`
}

type UpdateExchangeRateParams

type UpdateExchangeRateParams struct {
	Rate             string `json:"rate"`
	BaseCurrencyId   string `json:"base_currency_id"`
	TargetCurrencyId string `json:"target_currency_id"`
}

type UpdateFuturePaymentParams

type UpdateFuturePaymentParams struct {
	Id          string    `json:"id"`
	Name        string    `json:"name"`
	Income      bool      `json:"income"`
	Amount      string    `json:"amount"`
	Remarks     *string   `json:"remarks"`
	Rolling     bool      `json:"rolling"`
	Category    string    `json:"category"`
	Frequency   *int64    `json:"frequency"`
	AccountId   string    `json:"account_id"`
	CurrencyId  string    `json:"currency_id"`
	ScheduledAt time.Time `json:"scheduled_at"`
}

type UpdateStockHoldingCostParams

type UpdateStockHoldingCostParams struct {
	Unit      string `json:"unit"`
	Cost      string `json:"cost"`
	StockId   string `json:"stock_id"`
	AccountId string `json:"account_id"`
}

type UpdateStockPriceParams

type UpdateStockPriceParams struct {
	Ticker       string `json:"ticker"`
	CountryId    string `json:"country_id"`
	CurrentPrice string `json:"current_price"`
}

Jump to

Keyboard shortcuts

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