Documentation ¶
Index ¶
- type GenericError
- type Products
- func (p *Products) CreateProduct(rw http.ResponseWriter, r *http.Request)
- func (p *Products) ListProducts(rw http.ResponseWriter, r *http.Request)
- func (p *Products) ListSingle(rw http.ResponseWriter, r *http.Request)
- func (p *Products) MiddlewareValidateProduct(next http.Handler) http.Handler
- func (p *Products) UpdateProduct(rw http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GenericError ¶
type GenericError struct {
Message string `json:"message"`
}
GenericError is a generic error message returned by a server
type Products ¶
type Products struct {
// contains filtered or unexported fields
}
Products handler for getting and updating products
func NewProducts ¶
NewProducts returns a new products handler with the given logger
func (*Products) CreateProduct ¶
func (p *Products) CreateProduct(rw http.ResponseWriter, r *http.Request)
CreateProduct handles post requests to add new products
func (*Products) ListProducts ¶
func (p *Products) ListProducts(rw http.ResponseWriter, r *http.Request)
ListProducts handles HTTP GET requests for the products
func (*Products) ListSingle ¶
func (p *Products) ListSingle(rw http.ResponseWriter, r *http.Request)
ListSingle handles GET requests
func (*Products) MiddlewareValidateProduct ¶
MiddlewareValidateProduct validates the product in the request and calls next if ok
func (*Products) UpdateProduct ¶
func (p *Products) UpdateProduct(rw http.ResponseWriter, r *http.Request)
UpdateProduct handles PUT requests to update products
Click to show internal directories.
Click to hide internal directories.