service

package
v0.0.0-...-460cdd8 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidID used when we receive an invalid ID
	ErrInvalidID = errors.New("is not a valid UUID")
	// ErrProductNoAvailable used when the product is not available
	ErrProductNoAvailable = errors.New("product no available")
	// ErrProductNotFound used when the product does not exist in database
	ErrProductNotFound = errors.New("product not found")
)

Functions

This section is empty.

Types

type Purchase

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

Purchase type encapsulates all the base for the purchase service

func NewPurchaseService

func NewPurchaseService(p PurchaseRepository) Purchase

NewPurchaseService method to instance a purchase service

func (Purchase) Make

func (p Purchase) Make(ctx context.Context, ID string) error

Make method to make a purchase

type PurchaseRepository

type PurchaseRepository interface {
	GetProduct(ctx context.Context, ID string) (*entity.Product, error)
	SetToNoAvailable(ctx context.Context, ID string) error
}

PurchaseRepository interface determine which method should be implemented in order to suit the purchase service

Jump to

Keyboard shortcuts

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