model

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: 12 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 {
	CreateAccount(account *types.Account, userId string) error
	UpdateAccount(account *types.Account, userId string) error
	DeleteAccount(id string, userId string, orgId string) error
	GetAccounts(orgId string, userId string, tokenId string) ([]*types.Account, error)
	GetAccountsWithBalances(orgId string, userId string, tokenId string, date time.Time) ([]*types.Account, error)
	GetAccount(orgId, accId, userId, tokenId string) (*types.Account, error)
	GetAccountWithBalance(orgId, accId, userId, tokenId string, date time.Time) (*types.Account, error)
}

type ApiKeyInterface

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

type BudgetInterface

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

type ByName

type ByName []*types.Account

func (ByName) Len

func (a ByName) Len() int

func (ByName) Less

func (a ByName) Less(i, j int) bool

func (ByName) Swap

func (a ByName) Swap(i, j int)

type Model

type Model struct {
	// contains filtered or unexported fields
}

func NewModel

func NewModel(db db.Datastore, bcrypt util.Bcrypt, config types.Config) *Model

func (*Model) AcceptInvite

func (model *Model) AcceptInvite(invite *types.Invite, userId string) error

func (*Model) ConfirmResetPassword

func (model *Model) ConfirmResetPassword(password string, code string) (*types.User, error)

func (*Model) CreateAccount

func (model *Model) CreateAccount(account *types.Account, userId string) (err error)

func (*Model) CreateApiKey

func (model *Model) CreateApiKey(key *types.ApiKey) error

func (*Model) CreateBudget

func (model *Model) CreateBudget(budget *types.Budget, userId string) error

func (*Model) CreateInvite

func (model *Model) CreateInvite(invite *types.Invite, userId string) error

func (*Model) CreateOrg

func (model *Model) CreateOrg(org *types.Org, userId string) error

func (*Model) CreatePrice

func (model *Model) CreatePrice(price *types.Price, userId string) error

func (*Model) CreateSession

func (model *Model) CreateSession(session *types.Session) error

func (*Model) CreateTransaction

func (model *Model) CreateTransaction(transaction *types.Transaction) (err error)

func (*Model) CreateUser

func (model *Model) CreateUser(user *types.User) error

func (*Model) DeleteAccount

func (model *Model) DeleteAccount(id string, userId string, orgId string) (err error)

func (*Model) DeleteApiKey

func (model *Model) DeleteApiKey(id string, userId string) error

func (*Model) DeleteBudget

func (model *Model) DeleteBudget(orgId string, userId string) error

func (*Model) DeleteInvite

func (model *Model) DeleteInvite(id string, userId string) error

func (*Model) DeletePrice

func (model *Model) DeletePrice(id string, userId string) error

func (*Model) DeleteSession

func (model *Model) DeleteSession(id string, userId string) error

func (*Model) DeleteTransaction

func (model *Model) DeleteTransaction(id string, userId string, orgId string) (err error)

func (*Model) GetAccount

func (model *Model) GetAccount(orgId, accId, userId, tokenId string) (*types.Account, error)

func (*Model) GetAccountWithBalance

func (model *Model) GetAccountWithBalance(orgId, accId, userId, tokenId string, date time.Time) (*types.Account, error)

func (*Model) GetAccounts

func (model *Model) GetAccounts(orgId string, userId string, tokenId string) ([]*types.Account, error)

func (*Model) GetAccountsWithBalances

func (model *Model) GetAccountsWithBalances(orgId string, userId string, tokenId string, date time.Time) ([]*types.Account, error)

func (*Model) GetApiKeys

func (model *Model) GetApiKeys(userId string) ([]*types.ApiKey, error)

func (*Model) GetBudget

func (model *Model) GetBudget(orgId string, userId string) (*types.Budget, error)

func (*Model) GetInvites

func (model *Model) GetInvites(orgId string, userId string) ([]*types.Invite, error)

func (*Model) GetOrg

func (model *Model) GetOrg(orgId string, userId string) (*types.Org, error)

func (*Model) GetOrgs

func (model *Model) GetOrgs(userId string) ([]*types.Org, error)

func (*Model) GetPricesByCurrency

func (model *Model) GetPricesByCurrency(orgId string, currency string, userId string) ([]*types.Price, error)

func (*Model) GetPricesNearestInTime

func (model *Model) GetPricesNearestInTime(orgId string, date time.Time, userId string) ([]*types.Price, error)

func (*Model) GetTransactionsByAccount

func (model *Model) GetTransactionsByAccount(orgId string, userId string, accountId string, options *types.QueryOptions) ([]*types.Transaction, error)

func (*Model) GetTransactionsByOrg

func (model *Model) GetTransactionsByOrg(orgId string, userId string, options *types.QueryOptions) ([]*types.Transaction, error)

func (*Model) PingDatabase

func (model *Model) PingDatabase() error

func (*Model) ResetPassword

func (model *Model) ResetPassword(email string) error

func (*Model) SendPasswordResetEmail

func (model *Model) SendPasswordResetEmail(user *types.User) error

func (*Model) SendVerificationEmail

func (model *Model) SendVerificationEmail(user *types.User) error

func (*Model) UpdateAccount

func (model *Model) UpdateAccount(account *types.Account, userId string) (err error)

func (*Model) UpdateApiKey

func (model *Model) UpdateApiKey(key *types.ApiKey) error

func (*Model) UpdateOrg

func (model *Model) UpdateOrg(org *types.Org, userId string) error

func (*Model) UpdateTransaction

func (model *Model) UpdateTransaction(oldId string, transaction *types.Transaction) (err error)

func (*Model) UpdateUser

func (model *Model) UpdateUser(user *types.User) error

func (*Model) UserBelongsToOrg

func (model *Model) UserBelongsToOrg(userId string, orgId string) (bool, error)

func (*Model) VerifyUser

func (model *Model) VerifyUser(code string) error

type OrgInterface

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

type PriceInterface

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

type SessionInterface

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

type SystemHealthInteface

type SystemHealthInteface interface {
	PingDatabase() error
}

type TransactionInterface

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

type UserInterface

type UserInterface interface {
	CreateUser(user *types.User) error
	VerifyUser(string) error
	UpdateUser(user *types.User) error
	ResetPassword(email string) error
	ConfirmResetPassword(string, string) (*types.User, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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