Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewProductRepository ¶
func NewProductRepository(opt Option) *productRepository
func NewUserRepository ¶
func NewUserRepository(opt Option) *userRepository
Types ¶
type IAuthRepository ¶
type IAuthRepository interface {
GetUserByEmail(email string) (database.UserEntity, error)
RegisterUser(user database.UserEntity) (database.UserEntity, error)
}
func NewAuthRepository ¶
func NewAuthRepository(opt Option) IAuthRepository
type ICacheRepository ¶
type ICacheRepository interface {
WriteCache(key string, data interface{}, ttl time.Duration) (err error)
WriteCacheIfEmpty(key string, data interface{}, ttl time.Duration) (err error)
ReadCache(key string) (data interface{}, err error)
DeleteCache(key string) (err error)
}
ICacheRepository interface for cache repo
func NewCacheRepository ¶
func NewCacheRepository(opt Option) ICacheRepository
NewCacheRepository initiate cache repo
type ICartRepository ¶
type ICartRepository interface {
GetCart(getCartPyld payload.GetUserCartPayload) ([]payload.CartModel, error)
AddToCart(cartPyld payload.AddProductToCartPayload) ([]payload.CartModel, error)
UpdateCart(updatePyld payload.UpdateCartPayload) ([]payload.CartModel, error)
DeleteCart(delPyld payload.DeleteUserCartPayload) bool
}
func NewCartRepository ¶
func NewCartRepository(opt Option) ICartRepository
type IProductRepository ¶
type IProductRepository interface {
GetAllProduct() ([]database.ProductEntity, error)
GetProductById(id int) (database.ProductEntity, error)
GetProductByIdUser() ([]database.ProductEntity, error)
CreateProduct(product database.ProductEntity) (database.ProductEntity, error)
DeleteProduct(id, userID int) error
UpdateProduct(id, userID int, product database.ProductEntity) (database.ProductEntity, error)
}
type ITransactionRepository ¶
type ITransactionRepository interface {
AddTransaction(transaction payload.TransactionPayload) (database.TransactionEntity, error)
}
func NewTransactionRepository ¶
func NewTransactionRepository(opt Option) ITransactionRepository
type IUserRepository ¶
type IUserRepository interface {
GetAll() ([]database.UserEntity, error)
GetUserById() (database.UserEntity, error)
CreateUser(user database.UserEntity) (database.UserEntity, error)
DeleteUser(id int) error
UpdateUser(id int, user database.UserEntity) (database.UserEntity, error)
}
type Repository ¶
type Repository struct {
// TODO: add all repo object here
Auth IAuthRepository
Cache ICacheRepository
Cart ICartRepository
Transaction ITransactionRepository
User IUserRepository
Product IProductRepository
}
Repository all repo object injected here
type TransactionRepository ¶
type TransactionRepository struct {
// contains filtered or unexported fields
}
func (*TransactionRepository) AddTransaction ¶
func (tr *TransactionRepository) AddTransaction(transaction payload.TransactionPayload) (database.TransactionEntity, error)
Click to show internal directories.
Click to hide internal directories.