rest

package
v0.0.0-...-4c964fd Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2023 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = &ErrResponse{HTTPStatusCode: 404, StatusText: "Resource not found."}

Functions

func ErrInvalidRequest

func ErrInvalidRequest(err error) render.Renderer

func ErrRender

func ErrRender(err error) render.Renderer

Types

type CategoryHandler

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

func NewCategoryHandler

func NewCategoryHandler(s category.Service) *CategoryHandler

func (*CategoryHandler) Create

func (h *CategoryHandler) Create(w http.ResponseWriter, r *http.Request)

func (*CategoryHandler) List

func (*CategoryHandler) Read

func (*CategoryHandler) Update

func (h *CategoryHandler) Update(w http.ResponseWriter, r *http.Request)

type ErrResponse

type ErrResponse struct {
	Err            error `json:"-"` // low-level runtime error
	HTTPStatusCode int   `json:"-"` // http response status code

	StatusText string `json:"status"`          // user-level status message
	AppCode    int64  `json:"code,omitempty"`  // application-specific error code
	ErrorText  string `json:"error,omitempty"` // application-level error message, for debugging
}

func (*ErrResponse) Render

func (e *ErrResponse) Render(w http.ResponseWriter, r *http.Request) error

type RecipeHandler

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

func NewRecipeHandler

func NewRecipeHandler(s recipe.Service) *RecipeHandler

func (*RecipeHandler) Create

func (h *RecipeHandler) Create(w http.ResponseWriter, r *http.Request)

func (*RecipeHandler) List

func (h *RecipeHandler) List(w http.ResponseWriter, r *http.Request)

func (*RecipeHandler) Read

func (h *RecipeHandler) Read(w http.ResponseWriter, r *http.Request)

func (*RecipeHandler) Update

func (h *RecipeHandler) Update(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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