Documentation
¶
Index ¶
- func GetLoggerFromContext(ctx context.Context) *zap.Logger
- func GetProductFromContext(ctx context.Context) *data.Product
- func GetRequestFromContext(ctx context.Context) *http.Request
- func GetResponseWriterFromContext(ctx context.Context) http.ResponseWriter
- func InjectLogger(ctx context.Context, l *zap.Logger) context.Context
- func InjectProduct(ctx context.Context, prod *data.Product) context.Context
- func InjectRequest(ctx context.Context, r *http.Request) context.Context
- func InjectResponseWriter(ctx context.Context, w http.ResponseWriter) context.Context
- func NewReadHandler(l *zap.Logger) *readHandler
- func NewWelcomeHandler(l *zap.Logger) *welcomeHandler
- type DataKeyType
- type LoggerKeyType
- type ProductKeyType
- type ProductsHandler
- func (p *ProductsHandler) AddProduct(w http.ResponseWriter, r *http.Request)
- func (p *ProductsHandler) GetProducts(w http.ResponseWriter, r *http.Request)
- func (p *ProductsHandler) MiddlewareValidateProduct(next http.Handler) http.Handler
- func (p *ProductsHandler) UpdateProduct(w http.ResponseWriter, r *http.Request)
- type RequestKeyType
- type ResponseWriterKeyType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetResponseWriterFromContext ¶
func GetResponseWriterFromContext(ctx context.Context) http.ResponseWriter
func InjectResponseWriter ¶
func NewReadHandler ¶
func NewWelcomeHandler ¶
Types ¶
type DataKeyType ¶
type DataKeyType string
type LoggerKeyType ¶
type LoggerKeyType string
type ProductKeyType ¶
type ProductKeyType string
type ProductsHandler ¶
type ProductsHandler struct {
// contains filtered or unexported fields
}
Products is a http.Handler
func NewProducts ¶
func NewProducts(l *zap.Logger) *ProductsHandler
NewProducts creates a products handler with the given logger
func (*ProductsHandler) AddProduct ¶
func (p *ProductsHandler) AddProduct(w http.ResponseWriter, r *http.Request)
func (*ProductsHandler) GetProducts ¶
func (p *ProductsHandler) GetProducts(w http.ResponseWriter, r *http.Request)
getProducts returns the products from the data store
func (*ProductsHandler) MiddlewareValidateProduct ¶
func (p *ProductsHandler) MiddlewareValidateProduct(next http.Handler) http.Handler
func (*ProductsHandler) UpdateProduct ¶
func (p *ProductsHandler) UpdateProduct(w http.ResponseWriter, r *http.Request)
type RequestKeyType ¶
type RequestKeyType string
type ResponseWriterKeyType ¶
type ResponseWriterKeyType string
Click to show internal directories.
Click to hide internal directories.