Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrProductNotFound = fmt.Errorf("Product not found")
ErrProductNotFound is an error raised when a product can not be found in the database
Functions ¶
func FromJSON ¶
FromJSON deserializes the object from JSON string in an io.Reader to the given interface
func UpdateProduct ¶
UpdateProduct replaces a product in the database with the given item. If a product with the given id does not exist in the database this function returns a ProductNotFound error
Types ¶
type Product ¶
type Product struct { ID int `json:"id"` Name string `json:"name"` Description string `json:"description"` Price float32 `json:"price"` SKU string `json:"sku"` }
Product defines the structure for an API product
func GetProductByID ¶
GetProductByID returns a single product which matches the id from the database. If a product is not found this function returns a ProductNotFound error
Click to show internal directories.
Click to hide internal directories.