pgrepo

package
v0.0.0-...-0c44e78 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrDuplicateEntry        = errors.New("duplicate entry")
	ErrInvalidIdempotency    = errors.New("invalid idempotency")
	ErrInsufficientInventory = errors.New("insufficient inventory")
)

Functions

func NewCategoryRepositoryImpl

func NewCategoryRepositoryImpl(db *gorm.DB) domain.CategoryRepository

Types

type ProductInventory

type ProductInventory struct {
	Inventory uint64
}

type ProductRepository

type ProductRepository interface {
	CheckProduct(ctx context.Context, productID uint64, quantity uint64) (*valueobject.ProductStatus, error)
	GetProductDetail(ctx context.Context, productID uint64) (*valueobject.ProductDetail, error)
	GetProductInventory(ctx context.Context, productID uint64) (uint64, error)
	GetProduct(ctx context.Context, productID uint64) (*entity.Product, error)
	ListProducts(ctx context.Context, limit, offset uint64) (*[]valueobject.ProductCatalog, error)
	CreateProduct(ctx context.Context, product *entity.Product) error
	UpdateProductDetail(ctx context.Context, productID uint64, product *valueobject.ProductDetail) error
	UpdateProductInventory(ctx context.Context, idempotencyKey uint64, purchasedProducts *[]valueobject.PurchasedProduct) error
	RollbackProductInventory(ctx context.Context, idempotencyKey uint64, purchasedProducts *[]valueobject.PurchasedProduct) error
}

func NewProductRepository

func NewProductRepository(db *gorm.DB) ProductRepository

Jump to

Keyboard shortcuts

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