handler

package
v1.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetListLimit

func GetListLimit(c echo.Context, defaultLimit int) int

func GetListOffest

func GetListOffest(c echo.Context, defaultOffset int) int

func GetNumericQueryParam

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

func GetParameterID

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

func GetParameterString

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

func GetQueryID

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

func GetQueryParamsInt64

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

func LogErrorStacktrace added in v1.0.5

func LogErrorStacktrace(err error)

Types

type BaseHandler

type BaseHandler struct {
	Server RESTServer
}

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

func NewHandler

func NewHandler(Server RESTServer) *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) 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 RESTServer

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

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