Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrProductNotFound = fmt.Errorf("product not found")
Functions ¶
func AddProduct ¶
func AddProduct(p *Product)
func UpdateProduct ¶
Types ¶
type Product ¶
type Product struct {
ID int `json:"id"`
Name string `json:"name" validate:"required"`
Description string `json:"description"`
Price float32 `json:"price" validate:"gt=0"`
SKU string `json:"sku" validate:"required,sku"`
CreatedOn string `json:"-"`
UpdatedOn string `json:"-"`
DeletedOn string `json:"-"`
}
Product defines the structure for an API product
type Products ¶
type Products []*Product
Products is a collection of Product
Click to show internal directories.
Click to hide internal directories.