handlers

package
v5.0.0-...-ff4b850 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLoggerFromContext

func GetLoggerFromContext(ctx context.Context) *zap.Logger

func GetProductFromContext

func GetProductFromContext(ctx context.Context) *data.Product

func GetRequestFromContext

func GetRequestFromContext(ctx context.Context) *http.Request

func GetResponseWriterFromContext

func GetResponseWriterFromContext(ctx context.Context) http.ResponseWriter

func InjectLogger

func InjectLogger(ctx context.Context, l *zap.Logger) context.Context

func InjectProduct

func InjectProduct(ctx context.Context, prod *data.Product) context.Context

func InjectRequest

func InjectRequest(ctx context.Context, r *http.Request) context.Context

func InjectResponseWriter

func InjectResponseWriter(ctx context.Context, w http.ResponseWriter) context.Context

func NewReadHandler

func NewReadHandler(l *zap.Logger) *readHandler

func NewWelcomeHandler

func NewWelcomeHandler(l *zap.Logger) *welcomeHandler

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

Jump to

Keyboard shortcuts

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