handlers

package
v0.0.0-...-c6c5b12 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package classification of Product API

Documentation for Product API

Schemes: http
BasePath: /
Version: 1.0.0

Consumes:
- application/json

Produces:
- application/json

swagger:meta

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type GenericError

type GenericError struct {
	Message string `json:"message"`
}

GenericError is a generic error message returned by a server

type KeyProduct

type KeyProduct struct{}

type Products

type Products struct {
	// contains filtered or unexported fields
}

Products is a http.Handler

func NewProducts

func NewProducts(l *log.Logger) *Products

NewProducts creates a Products handler with the given logger

func (*Products) AddProduct

func (p *Products) AddProduct(rw http.ResponseWriter, r *http.Request)

AddProduct adds a product to the data store.

func (*Products) DeleteProduct

func (p *Products) DeleteProduct(rw http.ResponseWriter, r *http.Request)

DeleteProduct deletes a product from the data store.

func (*Products) GetProduct

func (p *Products) GetProduct(rw http.ResponseWriter, r *http.Request)

GetProduct handles GET requests and returns a product.

func (*Products) GetProducts

func (p *Products) GetProducts(rw http.ResponseWriter, r *http.Request)

GetProducts handles GET requests and returns all current products.

func (Products) MiddlewareValidateProduct

func (p Products) MiddlewareValidateProduct(next http.Handler) http.Handler

func (Products) UpdateProducts

func (p Products) UpdateProducts(rw http.ResponseWriter, r *http.Request)

UpdateProducts replaces the Product with a matching id.

type ValidationError

type ValidationError struct {
	Messages []string `json:"messages"`
}

ValidationError is a collection of validation error messages

Jump to

Keyboard shortcuts

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