commands

package
v0.0.0-...-358e048 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2022 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewCreateProductHandler

func NewCreateProductHandler(log logger.Logger, cfg *config.Config, pgRepo repository.Repository, kafkaProducer kafkaClient.Producer) *createProductHandler

func NewDeleteProductHandler

func NewDeleteProductHandler(log logger.Logger, cfg *config.Config, pgRepo repository.Repository, kafkaProducer kafkaClient.Producer) *deleteProductHandler

func NewUpdateProductHandler

func NewUpdateProductHandler(log logger.Logger, cfg *config.Config, pgRepo repository.Repository, kafkaProducer kafkaClient.Producer) *updateProductHandler

Types

type CreateProductCmdHandler

type CreateProductCmdHandler interface {
	Handle(ctx context.Context, command *CreateProductCommand) error
}

type CreateProductCommand

type CreateProductCommand struct {
	ProductID   uuid.UUID `json:"productId" validate:"required"`
	Name        string    `json:"name" validate:"required,gte=0,lte=255"`
	Description string    `json:"description" validate:"required,gte=0,lte=5000"`
	Price       float64   `json:"price" validate:"required,gte=0"`
}

func NewCreateProductCommand

func NewCreateProductCommand(productID uuid.UUID, name string, description string, price float64) *CreateProductCommand

type DeleteProductCmdHandler

type DeleteProductCmdHandler interface {
	Handle(ctx context.Context, command *DeleteProductCommand) error
}

type DeleteProductCommand

type DeleteProductCommand struct {
	ProductID uuid.UUID `json:"productId" validate:"required"`
}

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   uuid.UUID `json:"productId" validate:"required,gte=0,lte=255"`
	Name        string    `json:"name" validate:"required,gte=0,lte=255"`
	Description string    `json:"description" validate:"required,gte=0,lte=5000"`
	Price       float64   `json:"price" validate:"required,gte=0"`
}

func NewUpdateProductCommand

func NewUpdateProductCommand(productID uuid.UUID, name string, description string, price float64) *UpdateProductCommand

Jump to

Keyboard shortcuts

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