responses

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AlreadyExists

func AlreadyExists(c echo.Context) error

AlreadyExists dumps a simple "already exists" message response (409) in the gin context.

func AuthBadScheme

func AuthBadScheme(c echo.Context) error

AuthBadScheme dumps a simple "bad scheme" message response (400) in the gin context.

func AuthForbidden

func AuthForbidden(c echo.Context) error

AuthForbidden dumps a simple "forbidden" message response (403) in the gin context.

func AuthMissing

func AuthMissing(c echo.Context) error

AuthMissing dumps a simple "missing header" message response (401) in the gin context.

func AuthNotFound

func AuthNotFound(c echo.Context) error

AuthNotFound dumps a simple "not found" message response (401, for auth) in the gin context.

func AuthSyntaxError

func AuthSyntaxError(c echo.Context) error

AuthSyntaxError dumps a simple "syntax error" message response (400) in the gin context.

func Created

func Created(c echo.Context, id primitive.ObjectID) error

Created dumps a simple "created" message with the id of the created object.

func DuplicateKey

func DuplicateKey(c echo.Context) error

DuplicateKey dumps a "duplicate key" message response (409) with the attempted key combination.

func FindOneOperationError added in v1.1.0

func FindOneOperationError(c echo.Context, err error, logger ...*slog.Logger) error

FindOneOperationError is a helper to render an error for a MongoDB's FindOne operation on a collection.

func InternalError

func InternalError(c echo.Context) error

InternalError dumps a simple "internal error" message response (500) in the gin context.

func InvalidFormat

func InvalidFormat(c echo.Context, errors validator.ValidationErrors) error

InvalidFormat dumps an "invalid format" message response (400) in the gin context, with the errors that must flow to the user.

func MethodNotAllowed

func MethodNotAllowed(c echo.Context) error

MethodNotAllowed dumps a simple "method not allowed" message response (405) in the gin context.

func NotFound

func NotFound(c echo.Context) error

NotFound dumps a simple "not found" message response (404) in the gin context.

func Ok

func Ok(c echo.Context) error

Ok dumps a simple "ok" message response (200) in the gin context

func OkWith

func OkWith(c echo.Context, value any) error

OkWith dumps a 200 message with a given body. Most likely, the body will be a echo.Map instance.

func UnexpectedFormat

func UnexpectedFormat(c echo.Context) error

UnexpectedFormat dumps a simple "unexpected format" message response (400) in the gin context.

Types

This section is empty.

Jump to

Keyboard shortcuts

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