Documentation ¶
Index ¶
- Constants
- func ErrUnauthorized(w http.ResponseWriter, err error)
- type CartApp
- type CartHandler
- func (h *CartHandler) AddItem(w http.ResponseWriter, r *http.Request)
- func (h *CartHandler) ClearCart(w http.ResponseWriter, r *http.Request)
- func (h *CartHandler) GetCart(w http.ResponseWriter, r *http.Request)
- func (h *CartHandler) MiddlewareAuth(next http.Handler) http.Handler
- func (h *CartHandler) MiddlewareValidateCartItem(next http.Handler) http.Handler
- func (h *CartHandler) RemoveItem(w http.ResponseWriter, r *http.Request)
- func (h *CartHandler) UpdateCartItemQuantity(w http.ResponseWriter, r *http.Request)
Constants ¶
View Source
const AuthCTXKey contextKey = "auth_token"
View Source
const CartCTXKey contextKey = "cart_item_payload"
Variables ¶
This section is empty.
Functions ¶
func ErrUnauthorized ¶
func ErrUnauthorized(w http.ResponseWriter, err error)
ErrUnauthorized is a helper for consistent unauthorized responses
Types ¶
type CartApp ¶
type CartApp struct {
// contains filtered or unexported fields
}
func NewCartApp ¶
func NewCartApp(s *service.CartService, c *config.CartConfig, log *zerolog.Logger) *CartApp
type CartHandler ¶
type CartHandler struct {
// contains filtered or unexported fields
}
func NewCartHandler ¶
func NewCartHandler(s *service.CartService, l *zerolog.Logger) *CartHandler
func (*CartHandler) AddItem ¶
func (h *CartHandler) AddItem(w http.ResponseWriter, r *http.Request)
func (*CartHandler) ClearCart ¶
func (h *CartHandler) ClearCart(w http.ResponseWriter, r *http.Request)
func (*CartHandler) GetCart ¶
func (h *CartHandler) GetCart(w http.ResponseWriter, r *http.Request)
func (*CartHandler) MiddlewareAuth ¶
func (h *CartHandler) MiddlewareAuth(next http.Handler) http.Handler
func (*CartHandler) MiddlewareValidateCartItem ¶
func (h *CartHandler) MiddlewareValidateCartItem(next http.Handler) http.Handler
func (*CartHandler) RemoveItem ¶
func (h *CartHandler) RemoveItem(w http.ResponseWriter, r *http.Request)
func (*CartHandler) UpdateCartItemQuantity ¶
func (h *CartHandler) UpdateCartItemQuantity(w http.ResponseWriter, r *http.Request)
Click to show internal directories.
Click to hide internal directories.