Documentation ¶
Index ¶
- type KeyProduct
- type ProductsHandler
- func (productHandler *ProductsHandler) AddProduct(responseWriter http.ResponseWriter, request *http.Request)
- func (productHandler *ProductsHandler) Delete(responseWriter http.ResponseWriter, request *http.Request)
- func (productHandler *ProductsHandler) GetProductByID(responseWriter http.ResponseWriter, request *http.Request)
- func (productHandler *ProductsHandler) GetProducts(responseWriter http.ResponseWriter, request *http.Request)
- func (productHandler *ProductsHandler) LivenessCheck(responseWriter http.ResponseWriter, request *http.Request)
- func (productHandler *ProductsHandler) MiddlewareProductValidation(next http.Handler) http.Handler
- func (productHandler *ProductsHandler) ReadinessCheck(responseWriter http.ResponseWriter, request *http.Request)
- func (productHandler *ProductsHandler) UpdateProducts(responseWriter http.ResponseWriter, request *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type KeyProduct ¶
type KeyProduct struct{}
KeyProduct is a key used for the Product object inside context
type ProductsHandler ¶
type ProductsHandler struct {
// contains filtered or unexported fields
}
ProductsHandler contains the items common to all product handler functions
func NewProductsHandler ¶
func NewProductsHandler(db database.ProductDB) *ProductsHandler
func (*ProductsHandler) AddProduct ¶
func (productHandler *ProductsHandler) AddProduct(responseWriter http.ResponseWriter, request *http.Request)
AddProduct creates a new product from the received JSON
func (*ProductsHandler) Delete ¶
func (productHandler *ProductsHandler) Delete(responseWriter http.ResponseWriter, request *http.Request)
Delete a product with specified id from the database
func (*ProductsHandler) GetProductByID ¶
func (productHandler *ProductsHandler) GetProductByID(responseWriter http.ResponseWriter, request *http.Request)
GetProductByID returns a single product from the database
func (*ProductsHandler) GetProducts ¶
func (productHandler *ProductsHandler) GetProducts(responseWriter http.ResponseWriter, request *http.Request)
GetProducts returns the full list of products
func (*ProductsHandler) LivenessCheck ¶
func (productHandler *ProductsHandler) LivenessCheck(responseWriter http.ResponseWriter, request *http.Request)
LivenessCheck determine when the application needs to be restarted
func (*ProductsHandler) MiddlewareProductValidation ¶
func (productHandler *ProductsHandler) MiddlewareProductValidation(next http.Handler) http.Handler
MiddlewareProductValidation is used to validate incoming product JSONS
func (*ProductsHandler) ReadinessCheck ¶
func (productHandler *ProductsHandler) ReadinessCheck(responseWriter http.ResponseWriter, request *http.Request)
ReadinessCheck verifies that the application is ready to accept requests
func (*ProductsHandler) UpdateProducts ¶
func (productHandler *ProductsHandler) UpdateProducts(responseWriter http.ResponseWriter, request *http.Request)
UpdateProducts updates the product with the ID specified in the received JSON product