service

package
v0.0.0-...-7a1ea33 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInternalServer = fmt.Errorf("internal server error")
	ErrNotFound       = fmt.Errorf("resource not found")
	ErrInvalidInput   = fmt.Errorf("the product object passed in is invalid")
)

Functions

This section is empty.

Types

type ProductsService

type ProductsService interface {
	// errors that this function can return:
	//
	// 1. ErrNotFound
	//
	// 2. ErrInternalServer
	//
	// 3. ErrInvalidInput
	GetProducts(ctx context.Context, page int) ([]dto.GetProduct, error)

	// errors that this function can return:
	//
	// 1. ErrInternalServer
	//
	// 2. ErrInvalidInput
	//
	// 3. ErrNotFound
	GetProductById(ctx context.Context, id string) (dto.GetProduct, error)

	// errors that this function can return:
	//
	// 1. ErrInternalServer
	//
	// 2. ErrInvalidInput
	SaveProduct(ctx context.Context, product dto.SaveProduct) (dto.GetProduct, error)

	// errors that this function can return:
	//
	// 1. ErrInternalServer
	//
	// 2. ErrInvalidInput
	//
	// 3. ErrNotFound
	SearchProducts(ctx context.Context, term string) ([]dto.GetProduct, error)

	// errors that this function can return:
	//
	// 1. ErrInternalServer
	//
	// 2. ErrInvalidInput
	//
	// 3. ErrNotFound
	UpdateProduct(ctx context.Context, product dto.UpdateProduct) (dto.GetProduct, error)

	// errors that this function can return:
	//
	// 1. ErrInternalServer
	//
	// 2. ErrInvalidInput
	//
	// 3. ErrNotFound
	DeleteProductById(ctx context.Context, id string) error
}

func NewProductsService

func NewProductsService(productsServiceCfg config.ProductsService, productsRepo repository.ProductsRepository) ProductsService

Jump to

Keyboard shortcuts

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