handler

package
v1.3.7 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogErrorStacktrace added in v1.0.5

func LogErrorStacktrace(err error)

Types

type App added in v1.0.7

type App interface {
	HandleRequest(requests requests.Request) (interface{}, error)
}

type BaseHandler

type BaseHandler struct {
	App App
}

BaseHandler is a struct with basic methods that should be extended to properly handle a HTTP Service.

func NewHandler

func NewHandler(App App) *BaseHandler

func (*BaseHandler) BindedRequest

func (h *BaseHandler) BindedRequest(c echo.Context, op string, request requests.Request, body requests.Body) error

func (*BaseHandler) BindedRequestXMLResponse

func (h *BaseHandler) BindedRequestXMLResponse(c echo.Context, op string, request requests.Request, body requests.Body) error

func (*BaseHandler) GetListLimit added in v1.2.0

func (h *BaseHandler) GetListLimit(c echo.Context, defaultLimit int) int

func (*BaseHandler) GetListOffest added in v1.2.0

func (h *BaseHandler) GetListOffest(c echo.Context, defaultOffset int) int

func (*BaseHandler) GetNumericQueryParam added in v1.2.0

func (h *BaseHandler) GetNumericQueryParam(c echo.Context, param string, defaultValue int) int

func (*BaseHandler) GetParameterID added in v1.2.0

func (h *BaseHandler) GetParameterID(c echo.Context, name string) (int64, error)

func (*BaseHandler) GetParameterString added in v1.2.0

func (h *BaseHandler) GetParameterString(c echo.Context, name string) (string, error)

func (*BaseHandler) GetQueryID added in v1.2.0

func (h *BaseHandler) GetQueryID(c echo.Context, value string) (int64, error)

func (*BaseHandler) GetQueryParamsInt64 added in v1.2.0

func (h *BaseHandler) GetQueryParamsInt64(c echo.Context, key string) ([]int64, error)

func (*BaseHandler) ManageError

func (h *BaseHandler) ManageError(c echo.Context, op string, request requests.Request, err error) error

ManageError translates an error into the appropriate HTTP error code

func (*BaseHandler) StandardRequest

func (h *BaseHandler) StandardRequest(c echo.Context, op string, request requests.Request, body requests.Body) error

type ErrorResponse

type ErrorResponse struct {
	Error StandardError `json:"error"`
}

ErrorResponse defines the structure of the error that the handler will return

type StandardError

type StandardError struct {
	Code      string `json:"code"`
	Message   string `json:"message"`
	RequestID string `json:"request_id"`
}

StandardError defines a error in JSON format

Jump to

Keyboard shortcuts

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