domain

package
v0.0.0-...-238b7f8 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2024 License: Unlicense Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Product

type Product struct {
	ID          string  `db:"id"`
	CategoryID  string  `db:"category_id"`
	Code        string  `db:"code"`
	Description string  `db:"name"`
	Price       float64 `db:"price"`
	Weight      float64 `db:"weight"`
	Length      float64 `db:"length"`
	IsAvailable bool    `db:"is_available"`
}

type ReadProductRepository

type ReadProductRepository interface {
	GetProductByID(ctx context.Context, id string) (*Product, error)
	ListProducts(ctx context.Context, limit, offset int) ([]Product, error) // no se va a usar por lo visto
	ListProductsByName(ctx context.Context, limit, offset int, description string) ([]Product, error)
	ListProductByCategory(ctx context.Context, categoryID string) ([]Product, error)
}

type ReadProductService

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

func NewReadProductService

func NewReadProductService(readProductRepo ReadProductRepository, readCategoryRepo domain.ReadCategoryRepository) *ReadProductService

func (*ReadProductService) GetProductByID

func (s *ReadProductService) GetProductByID(ctx context.Context, productID string) (*Product, error)

func (*ReadProductService) ListProductByCategory

func (s *ReadProductService) ListProductByCategory(ctx context.Context, categoryName string) ([]Product, error)

func (*ReadProductService) ListProductsByName

func (s *ReadProductService) ListProductsByName(ctx context.Context, limit, offset int, name string) ([]Product, error)

type WriteProductRepository

type WriteProductRepository interface {
	SaveProduct(ctx context.Context, args Product) (Product, error)
	DeleteProduct(ctx context.Context, id string) error
	UpdateProduct(ctx context.Context, args Product) (Product, error)
}

type WriteProductService

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

func NewWriteProductService

func NewWriteProductService(writeProductRepo WriteProductRepository, writeCategoryRepo domain.WriteCategoryRepository, readCategoryRepo domain.ReadCategoryRepository) *WriteProductService

func (*WriteProductService) CreateProduct

func (s *WriteProductService) CreateProduct(ctx context.Context, product Product) (*Product, error)

func (*WriteProductService) DeleteProduct

func (s *WriteProductService) DeleteProduct(ctx context.Context, productID string) error

func (*WriteProductService) UpdateProduct

func (s *WriteProductService) UpdateProduct(ctx context.Context, product Product) (*Product, error)

Jump to

Keyboard shortcuts

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