db

package
v0.0.0-...-9b0c1e2 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountInterface

type AccountInterface interface {
	InsertAccount(account *types.Account) error
	UpdateAccount(account *types.Account) error
	GetAccount(string) (*types.Account, error)
	GetAccountsByOrgId(orgId string) ([]*types.Account, error)
	GetPermissionedAccountIds(string, string, string) ([]string, error)
	GetSplitCountByAccountId(id string) (int64, error)
	GetChildCountByAccountId(id string) (int64, error)
	DeleteAccount(id string) error
	AddBalances([]*types.Account, time.Time) error
	AddNativeBalancesCost([]*types.Account, time.Time) error
	AddNativeBalancesNearestInTime([]*types.Account, time.Time) error
	AddBalance(*types.Account, time.Time) error
	AddNativeBalanceCost(*types.Account, time.Time) error
	AddNativeBalanceNearestInTime(*types.Account, time.Time) error
	GetRootAccount(string) (*types.Account, error)
}

type ApiKeyInterface

type ApiKeyInterface interface {
	InsertApiKey(*types.ApiKey) error
	UpdateApiKey(*types.ApiKey) error
	DeleteApiKey(string, string) error
	GetApiKeys(string) ([]*types.ApiKey, error)
	UpdateApiKeyActivity(string) error
}

type BudgetInterface

type BudgetInterface interface {
	GetBudget(string) (*types.Budget, error)
	InsertAndReplaceBudget(*types.Budget) error
	DeleteBudget(string) error
}

type DB

type DB struct {
	*sql.DB
}

func NewDB

func NewDB(dataSourceName string) (*DB, error)

func (*DB) AcceptInvite

func (db *DB) AcceptInvite(invite *types.Invite, userId string) error

func (*DB) AddBalance

func (db *DB) AddBalance(account *types.Account, date time.Time) error

func (*DB) AddBalances

func (db *DB) AddBalances(accounts []*types.Account, date time.Time) error

func (*DB) AddNativeBalanceCost

func (db *DB) AddNativeBalanceCost(account *types.Account, date time.Time) error

func (*DB) AddNativeBalanceNearestInTime

func (db *DB) AddNativeBalanceNearestInTime(account *types.Account, date time.Time) error

func (*DB) AddNativeBalancesCost

func (db *DB) AddNativeBalancesCost(accounts []*types.Account, date time.Time) error

func (*DB) AddNativeBalancesNearestInTime

func (db *DB) AddNativeBalancesNearestInTime(accounts []*types.Account, date time.Time) error

func (*DB) CreateOrg

func (db *DB) CreateOrg(org *types.Org, userId string, accounts []*types.Account) (err error)

func (*DB) DeleteAccount

func (db *DB) DeleteAccount(id string) error

func (*DB) DeleteAndInsertTransaction

func (db *DB) DeleteAndInsertTransaction(oldId string, transaction *types.Transaction) (err error)

func (*DB) DeleteApiKey

func (db *DB) DeleteApiKey(id string, userId string) error

func (*DB) DeleteBudget

func (db *DB) DeleteBudget(orgId string) error

func (*DB) DeleteInvite

func (db *DB) DeleteInvite(id string) error

func (*DB) DeletePrice

func (db *DB) DeletePrice(id string) error

func (*DB) DeleteSession

func (db *DB) DeleteSession(id string, userId string) error

func (*DB) DeleteTransaction

func (db *DB) DeleteTransaction(id string) (err error)

func (*DB) Escape

func (db *DB) Escape(sql string) string

func (*DB) GetAccount

func (db *DB) GetAccount(id string) (*types.Account, error)

func (*DB) GetAccountsByOrgId

func (db *DB) GetAccountsByOrgId(orgId string) ([]*types.Account, error)

func (*DB) GetApiKeys

func (db *DB) GetApiKeys(userId string) ([]*types.ApiKey, error)

func (*DB) GetBudget

func (db *DB) GetBudget(orgId string) (*types.Budget, error)

func (*DB) GetChildCountByAccountId

func (db *DB) GetChildCountByAccountId(id string) (int64, error)

func (*DB) GetInvite

func (db *DB) GetInvite(id string) (*types.Invite, error)

func (*DB) GetInvites

func (db *DB) GetInvites(orgId string) ([]*types.Invite, error)

func (*DB) GetOrg

func (db *DB) GetOrg(orgId string, userId string) (*types.Org, error)

func (*DB) GetOrgAdmins

func (db *DB) GetOrgAdmins(orgId string) ([]*types.User, error)

func (*DB) GetOrgUserIds

func (db *DB) GetOrgUserIds(orgId string) ([]string, error)

func (*DB) GetOrgs

func (db *DB) GetOrgs(userId string) ([]*types.Org, error)

func (*DB) GetPermissionedAccountIds

func (db *DB) GetPermissionedAccountIds(orgId string, userId string, tokenId string) ([]string, error)

func (*DB) GetPriceById

func (db *DB) GetPriceById(id string) (*types.Price, error)

func (*DB) GetPricesByCurrency

func (db *DB) GetPricesByCurrency(orgId string, currency string) ([]*types.Price, error)

func (*DB) GetPricesNearestInTime

func (db *DB) GetPricesNearestInTime(orgId string, date time.Time) ([]*types.Price, error)

func (*DB) GetRootAccount

func (db *DB) GetRootAccount(orgId string) (*types.Account, error)

func (*DB) GetSplitCountByAccountId

func (db *DB) GetSplitCountByAccountId(id string) (int64, error)

func (*DB) GetTransactionById

func (db *DB) GetTransactionById(id string) (*types.Transaction, error)

func (*DB) GetTransactionsByAccount

func (db *DB) GetTransactionsByAccount(accountId string, options *types.QueryOptions) ([]*types.Transaction, error)

func (*DB) GetTransactionsByOrg

func (db *DB) GetTransactionsByOrg(orgId string, options *types.QueryOptions, accountIds []string) ([]*types.Transaction, error)

func (*DB) GetUserByActiveSession

func (db *DB) GetUserByActiveSession(sessionId string) (*types.User, error)

func (*DB) GetUserByApiKey

func (db *DB) GetUserByApiKey(keyId string) (*types.User, error)

func (*DB) GetUserByEmailVerifyCode

func (db *DB) GetUserByEmailVerifyCode(code string) (*types.User, error)

func (*DB) GetUserByResetCode

func (db *DB) GetUserByResetCode(code string) (*types.User, error)

func (*DB) GetVerifiedUserByEmail

func (db *DB) GetVerifiedUserByEmail(email string) (*types.User, error)

func (*DB) InsertAccount

func (db *DB) InsertAccount(account *types.Account) error

func (*DB) InsertAndReplaceBudget

func (db *DB) InsertAndReplaceBudget(budget *types.Budget) (err error)

func (*DB) InsertApiKey

func (db *DB) InsertApiKey(key *types.ApiKey) error

func (*DB) InsertInvite

func (db *DB) InsertInvite(invite *types.Invite) error

func (*DB) InsertPrice

func (db *DB) InsertPrice(price *types.Price) error

func (*DB) InsertSession

func (db *DB) InsertSession(session *types.Session) error

func (*DB) InsertTransaction

func (db *DB) InsertTransaction(transaction *types.Transaction) (err error)

func (*DB) InsertUser

func (db *DB) InsertUser(user *types.User) error

func (*DB) UpdateAccount

func (db *DB) UpdateAccount(account *types.Account) error

func (*DB) UpdateApiKey

func (db *DB) UpdateApiKey(key *types.ApiKey) error

func (*DB) UpdateApiKeyActivity

func (db *DB) UpdateApiKeyActivity(id string) error

func (*DB) UpdateOrg

func (db *DB) UpdateOrg(org *types.Org) error

func (*DB) UpdateSessionActivity

func (db *DB) UpdateSessionActivity(id string) error

func (*DB) UpdateUser

func (db *DB) UpdateUser(user *types.User) error

func (*DB) UpdateUserResetPassword

func (db *DB) UpdateUserResetPassword(user *types.User) error

func (*DB) VerifyUser

func (db *DB) VerifyUser(code string) error

type OrgInterface

type OrgInterface interface {
	CreateOrg(*types.Org, string, []*types.Account) error
	UpdateOrg(*types.Org) error
	GetOrg(string, string) (*types.Org, error)
	GetOrgs(string) ([]*types.Org, error)
	GetOrgUserIds(string) ([]string, error)
	InsertInvite(*types.Invite) error
	AcceptInvite(*types.Invite, string) error
	GetInvites(string) ([]*types.Invite, error)
	GetInvite(string) (*types.Invite, error)
	DeleteInvite(string) error
}

type PriceInterface

type PriceInterface interface {
	InsertPrice(*types.Price) error
	GetPriceById(string) (*types.Price, error)
	DeletePrice(string) error
	GetPricesNearestInTime(string, time.Time) ([]*types.Price, error)
	GetPricesByCurrency(string, string) ([]*types.Price, error)
}

type SessionInterface

type SessionInterface interface {
	InsertSession(*types.Session) error
	DeleteSession(string, string) error
	UpdateSessionActivity(string) error
}

type SystemHealthInteface

type SystemHealthInteface interface {
	Ping() error
}

type TransactionInterface

type TransactionInterface interface {
	InsertTransaction(*types.Transaction) error
	GetTransactionById(string) (*types.Transaction, error)
	GetTransactionsByAccount(string, *types.QueryOptions) ([]*types.Transaction, error)
	GetTransactionsByOrg(string, *types.QueryOptions, []string) ([]*types.Transaction, error)
	DeleteTransaction(string) error
	DeleteAndInsertTransaction(string, *types.Transaction) error
}

type UserInterface

type UserInterface interface {
	InsertUser(*types.User) error
	VerifyUser(string) error
	UpdateUser(*types.User) error
	UpdateUserResetPassword(*types.User) error
	GetVerifiedUserByEmail(string) (*types.User, error)
	GetUserByActiveSession(string) (*types.User, error)
	GetUserByApiKey(string) (*types.User, error)
	GetUserByResetCode(string) (*types.User, error)
	GetUserByEmailVerifyCode(string) (*types.User, error)
	GetOrgAdmins(string) ([]*types.User, error)
}

Jump to

Keyboard shortcuts

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