Documentation ¶
Index ¶
- func NewCreateProductHandler(log logger.Logger, cfg *config.Config, mongoRepo repository.Repository, ...) *createProductHandler
- func NewDeleteProductCmdHandler(log logger.Logger, cfg *config.Config, mongoRepo repository.Repository, ...) *deleteProductCmdHandler
- func NewUpdateProductCmdHandler(log logger.Logger, cfg *config.Config, mongoRepo repository.Repository, ...) *updateProductCmdHandler
- type CreateProductCmdHandler
- type CreateProductCommand
- type DeleteProductCmdHandler
- type DeleteProductCommand
- type ProductCommands
- type UpdateProductCmdHandler
- type UpdateProductCommand
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCreateProductHandler ¶
func NewCreateProductHandler(log logger.Logger, cfg *config.Config, mongoRepo repository.Repository, redisRepo repository.CacheRepository) *createProductHandler
func NewDeleteProductCmdHandler ¶
func NewDeleteProductCmdHandler(log logger.Logger, cfg *config.Config, mongoRepo repository.Repository, redisRepo repository.CacheRepository) *deleteProductCmdHandler
func NewUpdateProductCmdHandler ¶
func NewUpdateProductCmdHandler(log logger.Logger, cfg *config.Config, mongoRepo repository.Repository, redisRepo repository.CacheRepository) *updateProductCmdHandler
Types ¶
type CreateProductCmdHandler ¶
type CreateProductCmdHandler interface {
Handle(ctx context.Context, command *CreateProductCommand) error
}
type CreateProductCommand ¶
type CreateProductCommand struct { ProductID string `json:"productId" bson:"_id,omitempty"` Name string `json:"name,omitempty" bson:"name,omitempty" validate:"required,min=3,max=250"` Description string `json:"description,omitempty" bson:"description,omitempty" validate:"required,min=3,max=500"` Price float64 `json:"price,omitempty" bson:"price,omitempty" validate:"required"` CreatedAt time.Time `json:"createdAt,omitempty" bson:"createdAt,omitempty"` UpdatedAt time.Time `json:"updatedAt,omitempty" bson:"updatedAt,omitempty"` }
type DeleteProductCmdHandler ¶
type DeleteProductCmdHandler interface {
Handle(ctx context.Context, command *DeleteProductCommand) error
}
type DeleteProductCommand ¶
func NewDeleteProductCommand ¶
func NewDeleteProductCommand(productID uuid.UUID) *DeleteProductCommand
type ProductCommands ¶
type ProductCommands struct { CreateProduct CreateProductCmdHandler UpdateProduct UpdateProductCmdHandler DeleteProduct DeleteProductCmdHandler }
func NewProductCommands ¶
func NewProductCommands( createProduct CreateProductCmdHandler, updateProduct UpdateProductCmdHandler, deleteProduct DeleteProductCmdHandler, ) *ProductCommands
type UpdateProductCmdHandler ¶
type UpdateProductCmdHandler interface {
Handle(ctx context.Context, command *UpdateProductCommand) error
}
type UpdateProductCommand ¶
type UpdateProductCommand struct { ProductID string `json:"productId" bson:"_id,omitempty"` Name string `json:"name,omitempty" bson:"name,omitempty" validate:"required,min=3,max=250"` Description string `json:"description,omitempty" bson:"description,omitempty" validate:"required,min=3,max=500"` Price float64 `json:"price,omitempty" bson:"price,omitempty" validate:"required"` UpdatedAt time.Time `json:"updatedAt,omitempty" bson:"updatedAt,omitempty"` }
func NewUpdateProductCommand ¶
Click to show internal directories.
Click to hide internal directories.