Version: v0.0.0-...-5a98790 Latest Latest

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

Go to latest
Published: Jul 25, 2021 License: MIT Imports: 13 Imported by: 0



Package context extends the default echo.Context.

All functions return our standard xerror.Error in case of error.



This section is empty.


This section is empty.


This section is empty.


type Context

type Context struct {
	// contains filtered or unexported fields

Context extends the default echo.Context.

func MustCastFromEchoContext

func MustCastFromEchoContext(c echo.Context) Context

MustCastFromEchoContext cast an echo.Context to our custom Context.

It panics if casting goes wrong.

func New

func New(c echo.Context, logger xlog.Logger, config conf.Config) Context

New creates a new Context.

func (Context) Config

func (ctx Context) Config() conf.Config

Config returns the conf.Config associated with the Context.

func (Context) HasResource

func (ctx Context) HasResource() bool

HasResource returns true if the Context has a resource.Resource.

func (Context) LogRequestResult

func (ctx Context) LogRequestResult(err error, isDebug bool) error

LogRequestResult logs the result of a request. This method should only be used by a middleware!

If an error is given, returns the exact same error.

func (Context) MustResource

func (ctx Context) MustResource() resource.Resource

MustResource returns the resource.Resource associated with the Context.

It panics if no resource.Resource.

func (*Context) WithResource

func (ctx *Context) WithResource(directoryName string) error

WithResource creates a resource.Resource and adds it to the Context.

func (Context) XLogger

func (ctx Context) XLogger() xlog.Logger

XLogger returns the xlog.Logger associated with the Context.

This method should be used instead of the default Logger() method coming from the echo.Context.

Source Files

Jump to

Keyboard shortcuts

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