Documentation ¶
Index ¶
- type Cart
- type CartRepositoryMock
- func (repository *CartRepositoryMock) Delete(cartID int64) error
- func (repository *CartRepositoryMock) DeleteAll() error
- func (repository *CartRepositoryMock) GetAll() ([]Cart, error)
- func (repository *CartRepositoryMock) GetByID(cartID string) (*Cart, error)
- func (repository *CartRepositoryMock) UpdateInsert(cart *Cart) error
- type Controller
- type Repository
- type UseCase
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cart ¶
type Cart struct { ID string `gorm:"type:uuid;default:uuid_generate_v4();primary_key" json:"id"` UserID string `gorm:"null" json:"userId"` ProductID string `gorm:"not null" json:"productId"` Quantity int64 `gorm:"not null" json:"quantity"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` }
type CartRepositoryMock ¶
func (*CartRepositoryMock) Delete ¶
func (repository *CartRepositoryMock) Delete(cartID int64) error
func (*CartRepositoryMock) DeleteAll ¶
func (repository *CartRepositoryMock) DeleteAll() error
func (*CartRepositoryMock) GetAll ¶
func (repository *CartRepositoryMock) GetAll() ([]Cart, error)
func (*CartRepositoryMock) GetByID ¶
func (repository *CartRepositoryMock) GetByID(cartID string) (*Cart, error)
func (*CartRepositoryMock) UpdateInsert ¶
func (repository *CartRepositoryMock) UpdateInsert(cart *Cart) error
type Controller ¶
type Controller struct {
UseCase UseCase
}
func (*Controller) AddItemToCart ¶
func (ctrl *Controller) AddItemToCart(c *gin.Context)
func (*Controller) DeleteItemFromCart ¶
func (ctrl *Controller) DeleteItemFromCart(c *gin.Context)
func (*Controller) GetCartInfo ¶
func (ctrl *Controller) GetCartInfo(c *gin.Context)
func (*Controller) ResetCart ¶
func (ctrl *Controller) ResetCart(c *gin.Context)
type Repository ¶
type Repository interface { GetAll() ([]Cart, error) UpdateInsert(cart *Cart) error Delete(cartID int64) error DeleteAll() error }
func NewRepository ¶
func NewRepository(db *gorm.DB) Repository
Click to show internal directories.
Click to hide internal directories.