repositories

package
v0.0.0-...-74b6fac Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DEFAULT_TOKEN_LENGTH = 32

Functions

func GenerateToken

func GenerateToken() string

func SetStockRepo

func SetStockRepo(repo *StockRepository)

func SetTokenRepo

func SetTokenRepo(repo *TokenRepository)

func SetTransactionRepo

func SetTransactionRepo(repo *TransactionRepository)

func SetUserRepo

func SetUserRepo(repo *UserRepository)

Types

type Repository

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

func NewRepository

func NewRepository(dbConn database.DBConnector, dbModel interface{}, selectString []string) *Repository

func (*Repository) Add

func (s *Repository) Add(user *interface{}) apierrors.ApiError

func (*Repository) DeleteByObject

func (s *Repository) DeleteByObject(data interface{}) apierrors.ApiError

func (*Repository) FundsByID

func (s *Repository) FundsByID(data interface{}) apierrors.ApiError

func (*Repository) GetAll

func (s *Repository) GetAll(list []*interface{}) apierrors.ApiError

func (*Repository) GetByID

func (s *Repository) GetByID(object interface{}, id string) apierrors.ApiError

func (*Repository) UpdateWithMap

func (s *Repository) UpdateWithMap(data map[string]interface{}) apierrors.ApiError

func (*Repository) UpdateWithObject

func (s *Repository) UpdateWithObject(object interface{}) apierrors.ApiError

type StockRepository

type StockRepository struct {
	// contains filtered or unexported fields
}
var StockRepo *StockRepository

func NewStockRepository

func NewStockRepository(dbConn database.DBConnector) *StockRepository

func (*StockRepository) Add

func (*StockRepository) AddStockToUser

func (s *StockRepository) AddStockToUser(stockID string, userID string, quantity int) apierrors.ApiError

func (*StockRepository) DeleteByObject

func (s *StockRepository) DeleteByObject(data *models.Stock) apierrors.ApiError

func (*StockRepository) GetAll

func (s *StockRepository) GetAll() ([]*models.Stock, apierrors.ApiError)

func (*StockRepository) GetByID

func (s *StockRepository) GetByID(id string) (*models.Stock, apierrors.ApiError)

func (*StockRepository) GetStockPerUser

func (s *StockRepository) GetStockPerUser(stockID string, userID string) (*models.StockToUser, apierrors.ApiError)

func (*StockRepository) UpdateWithMap

func (s *StockRepository) UpdateWithMap(data map[string]interface{}) apierrors.ApiError

func (*StockRepository) UpdateWithObject

func (s *StockRepository) UpdateWithObject(stock *models.Stock) apierrors.ApiError

type TokenRepository

type TokenRepository struct {
	// contains filtered or unexported fields
}
var TokenRepo *TokenRepository

func NewTokenRepository

func NewTokenRepository(dbConn database.DBConnector) *TokenRepository

func (*TokenRepository) Add

func (*TokenRepository) DeleteByID

func (s *TokenRepository) DeleteByID(id string) apierrors.ApiError

func (*TokenRepository) DeleteByObject

func (s *TokenRepository) DeleteByObject(data *models.User) apierrors.ApiError

func (*TokenRepository) GenerateAndAddToken

func (s *TokenRepository) GenerateAndAddToken(userid string, validUntil int64) (string, apierrors.ApiError)

func (*TokenRepository) GetAll

func (s *TokenRepository) GetAll(userID string) ([]*models.Token, apierrors.ApiError)

func (*TokenRepository) GetByID

func (s *TokenRepository) GetByID(id string) (*models.Token, apierrors.ApiError)

func (*TokenRepository) GetUserIDByToken

func (s *TokenRepository) GetUserIDByToken(token string) (string, apierrors.ApiError)

func (*TokenRepository) UpdateWithMap

func (s *TokenRepository) UpdateWithMap(data map[string]interface{}) apierrors.ApiError

type TransactionRepository

type TransactionRepository struct {
	// contains filtered or unexported fields
}
var TransactionRepo *TransactionRepository

func NewTransactionRepository

func NewTransactionRepository(dbConn database.DBConnector) *TransactionRepository

func (*TransactionRepository) Add

func (*TransactionRepository) DeleteByObject

func (s *TransactionRepository) DeleteByObject(data *models.Transaction) apierrors.ApiError

func (*TransactionRepository) ExecuteTransaction

func (s *TransactionRepository) ExecuteTransaction(Data []interface{}) apierrors.ApiError

func (*TransactionRepository) GetAll

func (*TransactionRepository) GetByID

func (*TransactionRepository) TransactionCostsbyID

func (s *TransactionRepository) TransactionCostsbyID(transactionID string) (*models.MonetaryUnit, apierrors.ApiError)

func (*TransactionRepository) UpdateWithMap

func (s *TransactionRepository) UpdateWithMap(data map[string]interface{}) apierrors.ApiError

func (*TransactionRepository) UpdateWithObject

func (s *TransactionRepository) UpdateWithObject(Transaction *models.Transaction) apierrors.ApiError

type UserRepository

type UserRepository struct {
	// contains filtered or unexported fields
}
var UserRepo *UserRepository

func NewUserRepository

func NewUserRepository(dbConn database.DBConnector) *UserRepository

func (*UserRepository) Add

func (*UserRepository) AddFunds

func (s *UserRepository) AddFunds(userID string, mu models.MonetaryUnit) apierrors.ApiError

func (*UserRepository) DeleteByObject

func (s *UserRepository) DeleteByObject(data *models.User) apierrors.ApiError

func (*UserRepository) FundsByID

func (*UserRepository) GetAll

func (s *UserRepository) GetAll() ([]*models.User, apierrors.ApiError)

func (*UserRepository) GetByID

func (s *UserRepository) GetByID(id string) (*models.User, apierrors.ApiError)

func (*UserRepository) GetPWByName

func (s *UserRepository) GetPWByName(userName string) (string, apierrors.ApiError)

func (*UserRepository) GetyName

func (s *UserRepository) GetyName(userName string) (*models.User, apierrors.ApiError)

func (*UserRepository) UpdateWithMap

func (s *UserRepository) UpdateWithMap(data map[string]interface{}) apierrors.ApiError

func (*UserRepository) UpdateWithObject

func (s *UserRepository) UpdateWithObject(user *models.User) apierrors.ApiError

Jump to

Keyboard shortcuts

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