Documentation ¶
Index ¶
- Constants
- func NewLogger() *log.Logger
- type Context
- func (ctx *Context) ActiveTransaction() *dbx.Trx
- func (ctx *Context) AddAuthCookie(user *models.User) (string, error)
- func (ctx *Context) AddCookie(name, value string, expires time.Time)
- func (ctx *Context) AddRenderVar(name string, value interface{})
- func (ctx *Context) AuthEndpoint() string
- func (ctx *Context) BadRequest(dict Map) error
- func (ctx *Context) BaseURL() string
- func (ctx *Context) BindTo(i actions.Actionable) *validate.Result
- func (ctx *Context) Failure(err error) error
- func (ctx *Context) HandleValidation(result *validate.Result) error
- func (ctx *Context) IsAjax() bool
- func (ctx *Context) IsAuthenticated() bool
- func (ctx *Context) NotFound() error
- func (ctx *Context) Ok(data interface{}) error
- func (ctx *Context) Page(dict Map) error
- func (ctx *Context) ParamAsInt(name string) (int, error)
- func (ctx *Context) RemoveCookie(name string)
- func (ctx *Context) RenderVars() Map
- func (ctx *Context) Services() *app.Services
- func (ctx *Context) SetActiveTransaction(trx *dbx.Trx)
- func (ctx *Context) SetParams(dict Map)
- func (ctx *Context) SetServices(services *app.Services)
- func (ctx *Context) SetTenant(tenant *models.Tenant)
- func (ctx *Context) SetUser(user *models.User)
- func (ctx *Context) Tenant() *models.Tenant
- func (ctx *Context) TenantBaseURL(tenant *models.Tenant) string
- func (ctx *Context) Unauthorized() error
- func (ctx *Context) User() *models.User
- type Engine
- type Group
- type HTMLRenderer
- type HandlerFunc
- type Map
- type MiddlewareFunc
Constants ¶
const CookieAuthName = "auth"
CookieAuthName is the name of the authentication cookie
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Context ¶
Context wraps echo.context to provide userful information
func (*Context) ActiveTransaction ¶
ActiveTransaction returns current active Database transaction
func (*Context) AddAuthCookie ¶ added in v0.6.0
AddAuthCookie generates and adds a cookie
func (*Context) AddRenderVar ¶
AddRenderVar register given key/value to RenderVar map
func (*Context) BadRequest ¶
BadRequest returns 400 BadRequest with JSON result
func (*Context) BindTo ¶ added in v0.4.0
func (ctx *Context) BindTo(i actions.Actionable) *validate.Result
BindTo context values into given model
func (*Context) HandleValidation ¶ added in v0.4.0
HandleValidation handles given validation result property to return 400 or 500
func (*Context) IsAuthenticated ¶
IsAuthenticated returns true if user is authenticated
func (*Context) ParamAsInt ¶
ParamAsInt returns parameter as int
func (*Context) RemoveCookie ¶ added in v0.6.0
RemoveCookie removes a cookie
func (*Context) RenderVars ¶
RenderVars returns all registered RenderVar
func (*Context) SetActiveTransaction ¶
SetActiveTransaction adds transaction to context
func (*Context) SetServices ¶
SetServices update current context with app.Services
func (*Context) TenantBaseURL ¶ added in v0.6.0
TenantBaseURL returns base URL for a given tenant
func (*Context) Unauthorized ¶ added in v0.4.0
Unauthorized returns a 401 response
type Engine ¶
Engine is our web engine wrapper
func (*Engine) HandleError ¶
HandleError redirect error to router
func (*Engine) NewContext ¶
NewContext creates and return a new context
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group is our router group wrapper
func (*Group) Get ¶
func (g *Group) Get(path string, handler HandlerFunc)
Get handles HTTP GET requests
func (*Group) Post ¶
func (g *Group) Post(path string, handler HandlerFunc)
Post handles HTTP POST requests
func (*Group) Use ¶
func (g *Group) Use(middleware MiddlewareFunc)
Use add middleware to sub-routes within the Group
type HTMLRenderer ¶
type HTMLRenderer struct {
// contains filtered or unexported fields
}
HTMLRenderer renderer
func NewHTMLRenderer ¶
func NewHTMLRenderer(settings *models.AppSettings, logger echo.Logger) *HTMLRenderer
NewHTMLRenderer creates a new HTMLRenderer
type Map ¶ added in v0.4.0
type Map map[string]interface{}
Map defines a generic map of type `map[string]interface{}`.
type MiddlewareFunc ¶
type MiddlewareFunc func(HandlerFunc) HandlerFunc
MiddlewareFunc represents an HTTP middleware