product

package
v0.0.0-...-90015ba Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ProductNotFound = errors.New("products not found")

Functions

This section is empty.

Types

type EventRepo

type EventRepo interface {
	AddEvent(ctx context.Context, event *model.ProductEvent, tx *sqlx.Tx) error
}

type ProductRepo

type ProductRepo interface {
	AddProduct(ctx context.Context, product *model.Product, tx *sqlx.Tx) error
	GetProduct(ctx context.Context, productID uint64, tx *sqlx.Tx) (model.Product, error)
	ListProducts(ctx context.Context) ([]model.Product, error)
	RemoveProduct(ctx context.Context, productID uint64, tx *sqlx.Tx) error
}

type Service

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

func NewService

func NewService(
	productRepo ProductRepo,
	eventRepo EventRepo,
	db *sqlx.DB) *Service

func (*Service) CreateProduct

func (s *Service) CreateProduct(
	ctx context.Context,
	productDto dto.CreateProductCommand,
) (dto.Product, error)

func (*Service) DeleteProduct

func (s *Service) DeleteProduct(ctx context.Context, productID uint64) (dto.Product, error)

func (*Service) GetProductById

func (s *Service) GetProductById(ctx context.Context, id uint64) (dto.Product, error)

func (*Service) GetProducts

func (s *Service) GetProducts(ctx context.Context) ([]dto.Product, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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