products

package
v0.0.0-...-d0fcf2f Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2024 License: MIT Imports: 3 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 Product

type Product struct {
	ID            int       `json:"id,omitempty" db:"id,omitempty"`
	Name          string    `json:"name,omitempty" db:"name"`
	Description   string    `json:"description,omitempty" db:"description"`
	Price         float64   `json:"price,omitempty" db:"price"`
	SKU           string    `json:"sku,omitempty" db:"sku"`
	StockQuantity int       `json:"stock_quantity,omitempty" db:"stock_quantity"`
	Category      string    `json:"category,omitempty" db:"category"`
	Brand         string    `json:"brand,omitempty" db:"brand"`
	ImageURL      string    `json:"image_url,omitempty" db:"image_url,omitempty"`
	CreatedAt     time.Time `json:"created_at,omitempty" db:"created_at,omitempty"`
	UpdatedAt     time.Time `json:"updated_at,omitempty" db:"updated_at,omitempty"`
	IsActive      bool      `json:"is_active,omitempty" db:"is_active,omitempty"`
}

type ProductRepository

type ProductRepository interface {
	GetProducts(ctx context.Context) ([]*Product, error)
	GetByID(ctx context.Context, id int) (*Product, error)
	Save(ctx context.Context, product *Product) error
	Delete(ctx context.Context, id int) error
	Update(ctx context.Context, product *Product) error
}

Jump to

Keyboard shortcuts

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