product

package
v0.0.0-...-fb33920 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ProductService

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

Service product usecase

func NewProductService

func NewProductService(r Repository) *ProductService

NewProductService create new product service

func (*ProductService) CreateProduct

func (s *ProductService) CreateProduct(productName, baseURL string) error

CreateProduct create a product

func (*ProductService) DeleteProduct

func (s *ProductService) DeleteProduct(id int64) error

DeleteProduct delete a product record

func (*ProductService) GetProduct

func (s *ProductService) GetProduct(id int64) (*entity.Product, error)

GerProduct get a product record

func (*ProductService) ListProducts

func (s *ProductService) ListProducts() ([]*entity.Product, error)

ListProducts lists product records

func (*ProductService) UpdateProduct

func (s *ProductService) UpdateProduct(e *entity.Product) error

UpdateProduct update a product record

type Reader

type Reader interface {
	Get(id int64) (*entity.Product, error)
	List() ([]*entity.Product, error)
}

Reader interface

type Repository

type Repository interface {
	Reader
	Writer
}

Repository interface

type UseCase

type UseCase interface {
	ListProducts() ([]*entity.Product, error)
	GetProduct(id int64) (*entity.Product, error)
	CreateProduct(productName, baseURL string) error
	UpdateProduct(e *entity.Product) error
	DeleteProduct(id int64) error
}

UseCase interface

type Writer

type Writer interface {
	Create(e *entity.Product) error
	Update(e *entity.Product) error
	Delete(id int64) error
}

Writer interface

Jump to

Keyboard shortcuts

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