httpsrv

package
v0.0.0-...-3b7be81 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PublicSrv  = "public"
	PrivateSrv = "private"
	V1         = "1"
)

Variables

This section is empty.

Functions

func EchoBadRequest

func EchoBadRequest(ec echo.Context, err error) error

BadRequest return err 400

func EchoCreateFailed

func EchoCreateFailed(ec echo.Context, err error) error

CreateFailed return err 409

func EchoForbidden

func EchoForbidden(ec echo.Context, err error) error

Forbidden return err 403

func EchoHasExpired

func EchoHasExpired(ec echo.Context, err error) error

HasExpired return err 408

func EchoInternalServerError

func EchoInternalServerError(ec echo.Context, err error) error

InternalServerError return err 500

func EchoNotDeleted

func EchoNotDeleted(ec echo.Context, err error) error

NotDeleted return err 406

func EchoNotFound

func EchoNotFound(ec echo.Context, err error) error

NotFound return err 404

func EchoNotUpdated

func EchoNotUpdated(ec echo.Context, err error) error

NotUpdated return err 409

func EchoOK

func EchoOK(ec echo.Context, data interface{}) error

func EchoOkResult

func EchoOkResult(ec echo.Context) error

func EchoUnauthorized

func EchoUnauthorized(ec echo.Context, err error) error

Unauthorized return err 401

Types

type ErrorAnsw

type ErrorAnsw struct {
	Body ErrorAnswBody `json:"error"`
}

func BadRequest

func BadRequest(err error) ErrorAnsw

BadRequest return err 400

func CreateFailed

func CreateFailed(err error) ErrorAnsw

CreateFailed return err 409

func Forbidden

func Forbidden(err error) ErrorAnsw

Forbidden return err 403

func HasExpired

func HasExpired(err error) ErrorAnsw

HasExpired return err 408

func InternalServerError

func InternalServerError(err error) ErrorAnsw

InternalServerError return err 500

func NewErrorAnsw

func NewErrorAnsw(statusCode int, code string, err error) ErrorAnsw

func NotDeleted

func NotDeleted(err error) ErrorAnsw

NotDeleted return err 406

func NotFound

func NotFound(err error) ErrorAnsw

NotFound return err 404

func NotUpdated

func NotUpdated(err error) ErrorAnsw

NotUpdated return err 409

func PreconditionFailed

func PreconditionFailed(err error) ErrorAnsw

PreconditionFailed return err 409

func Unauthorized

func Unauthorized(err error) ErrorAnsw

Unauthorized reurn err 401

func (ErrorAnsw) Error

func (e ErrorAnsw) Error() string

type ErrorAnswBody

type ErrorAnswBody struct {
	Code       string `json:"code"`
	StatusCode int    `json:"statusCode"`
	Details    string `json:"details"`
}

type HTTPSrv

type HTTPSrv struct {
	PublicSrv  *echo.Echo
	PrivateSrv *echo.Echo

	PublicV1  *echo.Group
	PrivateV1 *echo.Group
	// contains filtered or unexported fields
}

func NewHTTPSrv

func NewHTTPSrv(ctx *internalctx.Context) (*HTTPSrv, error)

func (*HTTPSrv) Shutdown

func (h *HTTPSrv) Shutdown() error

func (*HTTPSrv) Start

func (h *HTTPSrv) Start()

type ResultAnsw

type ResultAnsw struct {
	Body interface{} `json:"result"`
}

func OkResult

func OkResult() ResultAnsw

OkResult return OK answer

Jump to

Keyboard shortcuts

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