product_infrastructure

package
v0.0.0-...-52e64fa Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrProductNotFound = errors.New("product not found")

Functions

This section is empty.

Types

type ProductDTO

type ProductDTO struct {
	ID                 primitive.ObjectID `bson:"_id,omitempty"`
	Name               string             `bson:"name"`
	Description        string             `bson:"description"`
	Price              float64            `bson:"price"`
	Stock              int                `bson:"stock"`
	Category           string             `bson:"category"`
	PromotionExpiresAt *time.Time         `bson:"promotion_expires_at"`
}

func NewProductDTO

func NewProductDTO(name string, description string, price float64, stock int, category string) *ProductDTO

func NewPromotionProductDTO

func NewPromotionProductDTO(name string, description string, price float64, stock int, category string, promotionExpiresAt *time.Time) *ProductDTO

type ProductReciever

type ProductReciever struct {
	Ctx        context.Context
	Collection *mongo.Collection
}

func NewProductRepository

func NewProductRepository(ctx context.Context, DB *mongo.Database) *ProductReciever

func (*ProductReciever) Create

func (c *ProductReciever) Create(dto *ProductDTO) (*ProductDTO, error)

func (*ProductReciever) FindOne

func (c *ProductReciever) FindOne(id primitive.ObjectID) (*ProductDTO, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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