Documentation ¶
Index ¶
- func GetProduct(w http.ResponseWriter, r *http.Request)
- func PutProduct(w http.ResponseWriter, r *http.Request)
- func PutProductImage(w http.ResponseWriter, r *http.Request)
- func SearchProducts(w http.ResponseWriter, r *http.Request)
- type Image
- type Product
- type Usecases
- func (u Usecases) AddImageToProduct(sku string, image io.ReadSeeker) (*Image, error)
- func (u Usecases) GetProduct(sku string) (*Product, error)
- func (u Usecases) SaveProduct(product Product) (*Product, error)
- func (u Usecases) SearchProducts(search, category string, page int) (responses.PaginatedResponse, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetProduct ¶
func GetProduct(w http.ResponseWriter, r *http.Request)
func PutProduct ¶
func PutProduct(w http.ResponseWriter, r *http.Request)
func PutProductImage ¶
func PutProductImage(w http.ResponseWriter, r *http.Request)
func SearchProducts ¶
func SearchProducts(w http.ResponseWriter, r *http.Request)
Types ¶
type Product ¶
type Product struct { Sku string `json:"sku" gorm:"primaryKey"` Name string `json:"name"` Price float64 `json:"price"` Description string `json:"description"` Category string `json:"category" gorm:"index"` Stock int64 `json:"stock"` Images []Image `json:"images" gorm:"foreignKey:ProductSku"` CreatedAt time.Time `json:"createdAt" gorm:"autoUpdateTime"` UpdatedAt time.Time `json:"updatedAt" gorm:"autoCreateTime"` }
func (Product) MarshalJSON ¶
type Usecases ¶
type Usecases struct{}
func (Usecases) AddImageToProduct ¶
func (Usecases) SearchProducts ¶
Click to show internal directories.
Click to hide internal directories.