handlers

package
v0.0.0-...-34d2590 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 25, 2021 License: MIT Imports: 9 Imported by: 0

Documentation

Index

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL