Documentation
¶
Index ¶
- Variables
- func BindMiddlewares(app App, p *Plugin)
- func Copy(header http.Header) http.Header
- func CustomHTTPErrorHandler(app App) func(err error, c echo.Context)
- func Down(app App) error
- func GetConfiguration() configuration.ConfigurationInterface
- func GetDefaultDatabaseConnection() *gorm.DB
- func GetQueryInt64FromReq(param string, c echo.Context) int64
- func GetQueryIntFromReq(param string, c echo.Context) int
- func GetSanitizer() *bluemonday.Policy
- func HealthCheckHandler(c echo.Context) error
- func InitSanitizer()
- func IsPublicRoute(url string) bool
- func MinifiAndRender(code int, name string, data interface{}, c *RequestContext) error
- func MinifiHTML(templateName string, data interface{}, c *RequestContext) (string, error)
- func NegotiateContentType(r *http.Request, offers []string, defaultOffer string) string
- func ParseList(header http.Header, key string) []string
- func ParseTime(header http.Header, key string) time.Time
- func ParseValueAndParams(header http.Header, key string) (value string, params map[string]string)
- func Up(app App) error
- type AcceptSpec
- type Action
- type App
- type AppOptions
- type AppStruct
- func (r *AppStruct) Bootstrap() error
- func (r *AppStruct) Can(permission string, userRoles []string) bool
- func (r *AppStruct) Close() error
- func (app *AppStruct) GetClock() clock.Clock
- func (r *AppStruct) GetConfiguration() configuration.ConfigurationInterface
- func (app *AppStruct) GetContentTypes() []string
- func (r *AppStruct) GetDB() *gorm.DB
- func (app *AppStruct) GetDefaultContentType() string
- func (r *AppStruct) GetEvents() *event.Manager
- func (r *AppStruct) GetLayout() string
- func (r *AppStruct) GetModel(name string) interface{}
- func (r *AppStruct) GetPlugin(name string) Pluginer
- func (r *AppStruct) GetPlugins() []Pluginer
- func (r *AppStruct) GetRole(name string) *acl.Role
- func (r *AppStruct) GetRolePermission(name string, permission string) bool
- func (r *AppStruct) GetRoles() map[string]*acl.Role
- func (r *AppStruct) GetRouter() *echo.Echo
- func (r *AppStruct) GetRouterGroup(name string) *echo.Group
- func (app *AppStruct) GetSanitizer() *bluemonday.Policy
- func (r *AppStruct) GetTemplates() *template.Template
- func (r *AppStruct) GetTheme() string
- func (r *AppStruct) InitDatabase(name, engine string, isDefault bool) error
- func (r *AppStruct) LoadTemplates() error
- func (r *AppStruct) Migrate() error
- func (app *AppStruct) NewRequestContext(opts *RequestContextOpts) *RequestContext
- func (r *AppStruct) RegisterPlugin(p Pluginer)
- func (app *AppStruct) RenderTemplate(wr io.Writer, name string, data interface{}) error
- func (app *AppStruct) SetClock(clock clock.Clock) error
- func (app *AppStruct) SetContentTypes(contentTypes []string) error
- func (r *AppStruct) SetDB(db *gorm.DB) error
- func (r *AppStruct) SetLayout(layout string) error
- func (r *AppStruct) SetModel(name string, f interface{})
- func (r *AppStruct) SetPlugin(name string, plugin Pluginer) error
- func (r *AppStruct) SetResource(name string, httpController HTTPController, routerGroup *echo.Group) error
- func (r *AppStruct) SetRole(name string, role acl.Role) error
- func (r *AppStruct) SetRolePermission(name string, permission string, hasAccess bool) error
- func (r *AppStruct) SetRouterGroup(name, path string) *echo.Group
- func (app *AppStruct) SetSanitizer(sanitizer *bluemonday.Policy) error
- func (r *AppStruct) SetTemplateFunction(name string, f interface{})
- func (r *AppStruct) SetTheme(theme string) error
- func (r *AppStruct) StartHTTPServer() error
- type BaseErrorResponse
- type BaseErrorResponseMessage
- type BaseListReponse
- type BaseMetaResponse
- type ContentDates
- type Context
- type CustomBinder
- type DefaultResponse
- type EmptyResponse
- type HTTPController
- type HTTPError
- func (e *HTTPError) Error() string
- func (e *HTTPError) GetCode() int
- func (e *HTTPError) GetInternal() error
- func (e *HTTPError) GetMessage() interface{}
- func (e *HTTPError) SetCode(code int) error
- func (e *HTTPError) SetInternal(internal error) error
- func (e *HTTPError) SetMessage(message interface{}) error
- type HTTPErrorInterface
- type HTTPResource
- type Migration
- type MigrationEngine
- type MigrationModel
- type NewMigrationEngineOpts
- type Plugin
- type PluginManager
- type Pluginer
- type RequestContext
- func (r *RequestContext) AddBodyClass(class string)
- func (r *RequestContext) AddResponseMessage(msg *ResponseMessage) error
- func (c *RequestContext) Attachment(file string, name string) error
- func (c *RequestContext) Bind(i interface{}) error
- func (c *RequestContext) Blob(code int, contentType string, b []byte) error
- func (r *RequestContext) Can(permission string) bool
- func (c *RequestContext) Cookie(name string) (*http.Cookie, error)
- func (c *RequestContext) Cookies() []*http.Cookie
- func (c *RequestContext) Echo() *echo.Echo
- func (c *RequestContext) Error(err error)
- func (c *RequestContext) File(file string) error
- func (c *RequestContext) FormFile(name string) (*multipart.FileHeader, error)
- func (c *RequestContext) FormParams() (url.Values, error)
- func (c *RequestContext) FormValue(name string) string
- func (r *RequestContext) Get(name string) interface{}
- func (r *RequestContext) GetAuthenticatedRoles() *[]string
- func (r *RequestContext) GetBodyClassText() string
- func (r *RequestContext) GetBool(name string) bool
- func (r *RequestContext) GetLimit() int
- func (r *RequestContext) GetOffset() int
- func (r *RequestContext) GetResponseContentType() string
- func (r *RequestContext) GetResponseMessages() []*ResponseMessage
- func (r *RequestContext) GetString(name string) string
- func (r *RequestContext) GetStringMap(name string) []string
- func (r *RequestContext) GetTemplateHTML(name string) template.HTML
- func (c *RequestContext) HTML(code int, html string) error
- func (c *RequestContext) HTMLBlob(code int, b []byte) error
- func (c *RequestContext) Handler() echo.HandlerFunc
- func (c *RequestContext) Inline(file string, name string) error
- func (c *RequestContext) IsTLS() bool
- func (c *RequestContext) IsWebSocket() bool
- func (c *RequestContext) JSON(code int, i interface{}) error
- func (c *RequestContext) JSONBlob(code int, b []byte) error
- func (c *RequestContext) JSONP(code int, callback string, i interface{}) error
- func (c *RequestContext) JSONPBlob(code int, callback string, b []byte) error
- func (c *RequestContext) JSONPretty(code int, i interface{}, indent string) error
- func (c *RequestContext) Logger() echo.Logger
- func (c *RequestContext) MultipartForm() (*multipart.Form, error)
- func (c *RequestContext) NoContent(code int) error
- func (c *RequestContext) Param(name string) string
- func (c *RequestContext) ParamNames() []string
- func (c *RequestContext) ParamValues() []string
- func (r *RequestContext) ParseQueryFromReq(c echo.Context) error
- func (r *RequestContext) Partial(name string, data interface{}) template.HTML
- func (c *RequestContext) Path() string
- func (c *RequestContext) QueryParam(name string) string
- func (c *RequestContext) QueryParams() url.Values
- func (c *RequestContext) QueryString() string
- func (c *RequestContext) RealIP() string
- func (c *RequestContext) Redirect(code int, url string) error
- func (r *RequestContext) RemoveBodyClass(class string)
- func (c *RequestContext) Render(code int, name string, data interface{}) error
- func (r *RequestContext) RenderPagination(name string) string
- func (r *RequestContext) RenderTemplate(wr io.Writer, name string, data interface{}) error
- func (c *RequestContext) Request() *http.Request
- func (c *RequestContext) Reset(r *http.Request, w http.ResponseWriter)
- func (c *RequestContext) Response() *echo.Response
- func (c *RequestContext) Scheme() string
- func (r *RequestContext) Set(name string, value interface{})
- func (r *RequestContext) SetAuthenticatedUser(user UserInterface)
- func (r *RequestContext) SetAuthenticatedUserAndFillRoles(user UserInterface)
- func (c *RequestContext) SetCookie(cookie *http.Cookie)
- func (c *RequestContext) SetHandler(h echo.HandlerFunc)
- func (c *RequestContext) SetLogger(l echo.Logger)
- func (c *RequestContext) SetParamNames(names ...string)
- func (c *RequestContext) SetParamValues(values ...string)
- func (c *RequestContext) SetPath(p string)
- func (c *RequestContext) SetRequest(r *http.Request)
- func (c *RequestContext) SetResponse(r *echo.Response)
- func (r *RequestContext) SetResponseContentType(v string) error
- func (c *RequestContext) Stream(code int, contentType string, r io.Reader) error
- func (c *RequestContext) String(code int, s string) error
- func (c *RequestContext) Validate(i interface{}) error
- func (c *RequestContext) XML(code int, i interface{}) error
- func (c *RequestContext) XMLBlob(code int, b []byte) error
- func (c *RequestContext) XMLPretty(code int, i interface{}, indent string) error
- type RequestContextOpts
- type Response
- type ResponseMessage
- type ResponseMessageTPLCtx
- type ResponseMessagesTPLCtx
- type Route
- type SessionData
- type TemplateCTX
- type TemplateRenderer
- type UserInterface
- type ValidationFieldError
- type ValidationResponse
Constants ¶
This section is empty.
Variables ¶
var SanitizerDefault *bluemonday.Policy
Functions ¶
func BindMiddlewares ¶
BindMiddlewares - Bind middlewares in order
func CustomHTTPErrorHandler ¶
func GetConfiguration ¶
func GetConfiguration() configuration.ConfigurationInterface
func GetQueryInt64FromReq ¶
func GetQueryIntFromReq ¶
func GetSanitizer ¶
func GetSanitizer() *bluemonday.Policy
func HealthCheckHandler ¶
func HealthCheckHandler(c echo.Context) error
func InitSanitizer ¶
func InitSanitizer()
func IsPublicRoute ¶
func MinifiAndRender ¶
func MinifiAndRender(code int, name string, data interface{}, c *RequestContext) error
func MinifiHTML ¶
func MinifiHTML(templateName string, data interface{}, c *RequestContext) (string, error)
func NegotiateContentType ¶
NegotiateContentType returns the best offered content type for the request's Accept header. If two offers match with equal weight, then the more specific offer is preferred. For example, text/* trumps */*. If two offers match with equal weight and specificity, then the offer earlier in the list is preferred. If no offers match, then defaultOffer is returned.
func ParseList ¶
ParseList parses a comma separated list of values. Commas are ignored in quoted strings. Quoted values are not unescaped or unquoted. Whitespace is trimmed.
func ParseTime ¶
ParseTime parses the header as time. The zero value is returned if the header is not present or there is an error parsing the header.
func ParseValueAndParams ¶
ParseValueAndParams parses a comma separated list of values with optional semicolon separated name-value pairs. Content-Type and Content-Disposition headers are in this format.
Types ¶
type AcceptSpec ¶
AcceptSpec describes an Accept* header.
func ParseAccept ¶
func ParseAccept(header http.Header, key string) (specs []AcceptSpec)
ParseAccept parses Accept* headers.
type App ¶
type App interface { RegisterPlugin(p Pluginer) GetPlugins() []Pluginer GetPlugin(name string) Pluginer SetPlugin(name string, plugin Pluginer) error GetClock() clock.Clock SetClock(clock clock.Clock) error GetDefaultContentType() string GetContentTypes() []string SetContentTypes(contentTypes []string) error GetRouter() *echo.Echo SetRouterGroup(name, path string) *echo.Group GetRouterGroup(name string) *echo.Group SetResource(name string, httpController HTTPController, routerGroup *echo.Group) error StartHTTPServer() error NewRequestContext(opts *RequestContextOpts) *RequestContext // Get default app theme GetTheme() string // Set default app theme SetTheme(theme string) error // Get default app layout GetLayout() string // Set default app layout SetLayout(layout string) error GetTemplates() *template.Template LoadTemplates() error SetTemplateFunction(name string, f interface{}) RenderTemplate(wr io.Writer, name string, data interface{}) error InitDatabase(name, engine string, isDefault bool) error SetModel(name string, f interface{}) GetModel(name string) interface{} Can(permission string, userRoles []string) bool SetRole(name string, role acl.Role) error GetRoles() map[string]*acl.Role GetRole(name string) *acl.Role SetRolePermission(name string, permission string, hasAccess bool) error GetRolePermission(name string, permission string) bool GetEvents() *event.Manager GetConfiguration() configuration.ConfigurationInterface // HTML / Text sanitizer: GetSanitizer() *bluemonday.Policy SetSanitizer(policy *bluemonday.Policy) error GetDB() *gorm.DB SetDB(db *gorm.DB) error Migrate() error Bootstrap() error Close() error }
func Init ¶
func Init(options *AppOptions) App
func NewApp ¶
func NewApp(options *AppOptions) App
type AppOptions ¶
type AppStruct ¶
type AppStruct struct { InitTime time.Time Options *AppOptions Events *event.Manager Configuration configuration.ConfigurationInterface // Default database DB *gorm.DB `json:"-"` // avaible databases DBs map[string]*gorm.DB `json:"-"` Plugins []Pluginer Models map[string]interface{} Resources map[string]*HTTPResource RolesString string RolesList map[string]*acl.Role // default theme for HTML responses Theme string // default layout for HTML responses Layout string // contains filtered or unexported fields }
func (*AppStruct) Close ¶
Method for close and end all app operations, use that before close the app execution
func (*AppStruct) GetConfiguration ¶
func (r *AppStruct) GetConfiguration() configuration.ConfigurationInterface
func (*AppStruct) GetContentTypes ¶ added in v1.0.1
func (*AppStruct) GetDefaultContentType ¶ added in v1.0.1
func (*AppStruct) GetPlugins ¶
func (*AppStruct) GetRolePermission ¶
func (*AppStruct) GetRouterGroup ¶
func (*AppStruct) GetSanitizer ¶
func (app *AppStruct) GetSanitizer() *bluemonday.Policy
func (*AppStruct) GetTemplates ¶
func (*AppStruct) InitDatabase ¶
func (*AppStruct) LoadTemplates ¶
func (*AppStruct) NewRequestContext ¶
func (app *AppStruct) NewRequestContext(opts *RequestContextOpts) *RequestContext
func (*AppStruct) RegisterPlugin ¶
func (*AppStruct) RenderTemplate ¶
RenderTemplate - Render template with default app theme
func (*AppStruct) SetContentTypes ¶ added in v1.0.1
func (*AppStruct) SetResource ¶
func (r *AppStruct) SetResource(name string, httpController HTTPController, routerGroup *echo.Group) error
Set Resource CRUD. Now we only supports HTTP Resources / Ex Rest
func (*AppStruct) SetRolePermission ¶
func (*AppStruct) SetRouterGroup ¶
func (*AppStruct) SetSanitizer ¶
func (app *AppStruct) SetSanitizer(sanitizer *bluemonday.Policy) error
func (*AppStruct) SetTemplateFunction ¶
func (*AppStruct) StartHTTPServer ¶
type BaseErrorResponse ¶
type BaseErrorResponse struct {
Messages []BaseErrorResponseMessage `json:"messages"`
}
type BaseListReponse ¶
type BaseListReponse struct {
Meta BaseMetaResponse `json:"meta"`
}
type BaseMetaResponse ¶
type BaseMetaResponse struct {
Count int64 `json:"count"`
}
type ContentDates ¶
type ContentDates interface {
}type CustomBinder ¶
type CustomBinder struct{}
func (*CustomBinder) Bind ¶
func (cb *CustomBinder) Bind(i interface{}, c echo.Context) (err error)
type DefaultResponse ¶
func (*DefaultResponse) GetData ¶
func (r *DefaultResponse) GetData() any
func (*DefaultResponse) GetStatusCode ¶
func (r *DefaultResponse) GetStatusCode() int
type EmptyResponse ¶
type EmptyResponse struct{}
type HTTPController ¶
type HTTPError ¶
type HTTPError struct { Code int `json:"code"` Message interface{} `json:"message"` Internal error `json:"-"` // Stores the error returned by an external dependency }
HTTPError implements HTTP Error interface, default error object
func (*HTTPError) GetInternal ¶
func (*HTTPError) GetMessage ¶
func (e *HTTPError) GetMessage() interface{}
func (*HTTPError) SetInternal ¶
func (*HTTPError) SetMessage ¶
type HTTPErrorInterface ¶
type HTTPResource ¶
type HTTPResource struct { Name string Controller *HTTPController }
type MigrationEngine ¶ added in v1.1.0
type MigrationEngine struct {
App App
}
func NewMigrationEngine ¶ added in v1.1.0
func NewMigrationEngine(opts *NewMigrationEngineOpts) *MigrationEngine
func (*MigrationEngine) FindAllMigrations ¶ added in v1.1.0
func (m *MigrationEngine) FindAllMigrations() ([]*MigrationModel, error)
func (*MigrationEngine) FindAllMigrationsByPlugin ¶ added in v1.1.0
func (m *MigrationEngine) FindAllMigrationsByPlugin() (map[string]*MigrationModel, error)
func (*MigrationEngine) GetPluginMigrations ¶ added in v1.1.0
func (m *MigrationEngine) GetPluginMigrations() ([]*Migration, error)
func (*MigrationEngine) SetupMigrationEngine ¶ added in v1.1.0
func (m *MigrationEngine) SetupMigrationEngine() error
type MigrationModel ¶ added in v1.1.0
type MigrationModel struct { PluginName string `gorm:"column:plugin_name;primaryKey;type:varchar(200)"` Version int `gorm:"column:version"` LastUpgradeName string `gorm:"column:last_upgrade_name"` Installed bool `gorm:"column:installed;default:false;not null"` CreatedAt time.Time `gorm:"column:created_at;default:NOW();not null"` UpdatedAt time.Time `gorm:"column:updated_at;default:NOW();not null"` LastError string `gorm:"column:last_error;type:TEXT"` }
func (*MigrationModel) Save ¶ added in v1.1.0
func (m *MigrationModel) Save(app App) error
func (*MigrationModel) TableName ¶ added in v1.1.0
func (m *MigrationModel) TableName() string
type NewMigrationEngineOpts ¶ added in v1.1.0
type NewMigrationEngineOpts struct {
App App
}
type Plugin ¶
type Plugin struct {
Name string
}
Core plugin
func (*Plugin) BindMiddlewares ¶
func (*Plugin) GetMigrations ¶ added in v1.1.0
func (*Plugin) SetTemplateFuncMap ¶
type PluginManager ¶
type RequestContext ¶
type RequestContext struct { App App Protocol string Domain string AppOrigin string Title string IsAuthenticated bool AuthenticatedUser UserInterface // authenticated user role name list Roles []string Session SessionData Widgets map[string]map[string]string Theme string Layout string BodyClass []string Content template.HTML Query query_parser_to_db.QueryInterface Pager *pagination.Pager ENV string // contains filtered or unexported fields }
func NewBotContext ¶
func NewBotContext(app App) (*RequestContext, error)
NewBotContext - Create a new request context for non http calls and testing
func NewRequestContext ¶
func NewRequestContext(opts *RequestContextOpts) *RequestContext
func (*RequestContext) AddBodyClass ¶
func (r *RequestContext) AddBodyClass(class string)
Add a body class string checking if is unique
func (*RequestContext) AddResponseMessage ¶ added in v1.0.2
func (r *RequestContext) AddResponseMessage(msg *ResponseMessage) error
func (*RequestContext) Attachment ¶
func (c *RequestContext) Attachment(file string, name string) error
Attachment sends a response as attachment, prompting client to save the file.
func (*RequestContext) Bind ¶
func (c *RequestContext) Bind(i interface{}) error
Bind binds the request body into provided type `i`. The default binder does it based on Content-Type header.
func (*RequestContext) Blob ¶
func (c *RequestContext) Blob(code int, contentType string, b []byte) error
Blob sends a blob response with status code and content type.
func (*RequestContext) Can ¶
func (r *RequestContext) Can(permission string) bool
func (*RequestContext) Cookie ¶
func (c *RequestContext) Cookie(name string) (*http.Cookie, error)
Cookie returns the named cookie provided in the request.
func (*RequestContext) Cookies ¶
func (c *RequestContext) Cookies() []*http.Cookie
Cookies returns the HTTP cookies sent with the request.
func (*RequestContext) Echo ¶
func (c *RequestContext) Echo() *echo.Echo
Echo returns the `Echo` instance.
func (*RequestContext) Error ¶
func (c *RequestContext) Error(err error)
Error invokes the registered HTTP error handler. Generally used by middleware.
func (*RequestContext) File ¶
func (c *RequestContext) File(file string) error
File sends a response with the content of the file.
func (*RequestContext) FormFile ¶
func (c *RequestContext) FormFile(name string) (*multipart.FileHeader, error)
FormFile returns the multipart form file for the provided name.
func (*RequestContext) FormParams ¶
func (c *RequestContext) FormParams() (url.Values, error)
FormParams returns the form parameters as `url.Values`.
func (*RequestContext) FormValue ¶
func (c *RequestContext) FormValue(name string) string
FormValue returns the form field value for the provided name.
func (*RequestContext) Get ¶
func (r *RequestContext) Get(name string) interface{}
func (*RequestContext) GetAuthenticatedRoles ¶
func (r *RequestContext) GetAuthenticatedRoles() *[]string
func (*RequestContext) GetBodyClassText ¶
func (r *RequestContext) GetBodyClassText() string
Get body class as string,
func (*RequestContext) GetBool ¶
func (r *RequestContext) GetBool(name string) bool
Get value from echo context data in boolean format
func (*RequestContext) GetLimit ¶
func (r *RequestContext) GetLimit() int
func (*RequestContext) GetOffset ¶
func (r *RequestContext) GetOffset() int
func (*RequestContext) GetResponseContentType ¶
func (r *RequestContext) GetResponseContentType() string
Get selected response type
func (*RequestContext) GetResponseMessages ¶ added in v1.0.2
func (r *RequestContext) GetResponseMessages() []*ResponseMessage
func (*RequestContext) GetString ¶
func (r *RequestContext) GetString(name string) string
func (*RequestContext) GetStringMap ¶
func (r *RequestContext) GetStringMap(name string) []string
Get data in string map format ([]string) from echo context data
func (*RequestContext) GetTemplateHTML ¶
func (r *RequestContext) GetTemplateHTML(name string) template.HTML
func (*RequestContext) HTML ¶
func (c *RequestContext) HTML(code int, html string) error
HTML sends an HTTP response with status code.
func (*RequestContext) HTMLBlob ¶
func (c *RequestContext) HTMLBlob(code int, b []byte) error
HTMLBlob sends an HTTP blob response with status code.
func (*RequestContext) Handler ¶
func (c *RequestContext) Handler() echo.HandlerFunc
Handler returns the matched handler by router.
func (*RequestContext) Inline ¶
func (c *RequestContext) Inline(file string, name string) error
Inline sends a response as inline, opening the file in the browser.
func (*RequestContext) IsTLS ¶
func (c *RequestContext) IsTLS() bool
IsTLS returns true if HTTP connection is TLS otherwise false.
func (*RequestContext) IsWebSocket ¶
func (c *RequestContext) IsWebSocket() bool
IsWebSocket returns true if HTTP connection is WebSocket otherwise false.
func (*RequestContext) JSON ¶
func (c *RequestContext) JSON(code int, i interface{}) error
JSON sends a JSON response with status code.
func (*RequestContext) JSONBlob ¶
func (c *RequestContext) JSONBlob(code int, b []byte) error
JSONBlob sends a JSON blob response with status code.
func (*RequestContext) JSONP ¶
func (c *RequestContext) JSONP(code int, callback string, i interface{}) error
JSONP sends a JSONP response with status code. It uses `callback` to construct the JSONP payload.
func (*RequestContext) JSONPBlob ¶
func (c *RequestContext) JSONPBlob(code int, callback string, b []byte) error
JSONPBlob sends a JSONP blob response with status code. It uses `callback` to construct the JSONP payload.
func (*RequestContext) JSONPretty ¶
func (c *RequestContext) JSONPretty(code int, i interface{}, indent string) error
JSONPretty sends a pretty-print JSON with status code.
func (*RequestContext) Logger ¶
func (c *RequestContext) Logger() echo.Logger
Logger returns the `Logger` instance.
func (*RequestContext) MultipartForm ¶
func (c *RequestContext) MultipartForm() (*multipart.Form, error)
MultipartForm returns the multipart form.
func (*RequestContext) NoContent ¶
func (c *RequestContext) NoContent(code int) error
NoContent sends a response with no body and a status code.
func (*RequestContext) Param ¶
func (c *RequestContext) Param(name string) string
Param returns path parameter by name.
func (*RequestContext) ParamNames ¶
func (c *RequestContext) ParamNames() []string
ParamNames returns path parameter names.
func (*RequestContext) ParamValues ¶
func (c *RequestContext) ParamValues() []string
ParamValues returns path parameter values.
func (*RequestContext) ParseQueryFromReq ¶
func (r *RequestContext) ParseQueryFromReq(c echo.Context) error
func (*RequestContext) Partial ¶
func (r *RequestContext) Partial(name string, data interface{}) template.HTML
Partial - Include and render one template inside other
func (*RequestContext) Path ¶
func (c *RequestContext) Path() string
Path returns the registered path for the handler.
func (*RequestContext) QueryParam ¶
func (c *RequestContext) QueryParam(name string) string
QueryParam returns the query param for the provided name.
func (*RequestContext) QueryParams ¶
func (c *RequestContext) QueryParams() url.Values
QueryParams returns the query parameters as `url.Values`.
func (*RequestContext) QueryString ¶
func (c *RequestContext) QueryString() string
QueryString returns the URL query string.
func (*RequestContext) RealIP ¶
func (c *RequestContext) RealIP() string
RealIP returns the client's network address based on `X-Forwarded-For` or `X-Real-IP` request header. The behavior can be configured using `Echo#IPExtractor`.
func (*RequestContext) Redirect ¶
func (c *RequestContext) Redirect(code int, url string) error
Redirect redirects the request to a provided URL with status code.
func (*RequestContext) RemoveBodyClass ¶
func (r *RequestContext) RemoveBodyClass(class string)
Remove a body class string checking if is unique
func (*RequestContext) Render ¶
func (c *RequestContext) Render(code int, name string, data interface{}) error
Render renders a template with data and sends a text/html response with status code. Renderer must be registered using `Echo.Renderer`.
func (*RequestContext) RenderPagination ¶
func (r *RequestContext) RenderPagination(name string) string
func (*RequestContext) RenderTemplate ¶
func (r *RequestContext) RenderTemplate(wr io.Writer, name string, data interface{}) error
Render one template, with support for themes
func (*RequestContext) Request ¶
func (c *RequestContext) Request() *http.Request
Request returns `*http.Request`.
func (*RequestContext) Reset ¶
func (c *RequestContext) Reset(r *http.Request, w http.ResponseWriter)
Reset resets the context after request completes. It must be called along with `Echo#AcquireContext()` and `Echo#ReleaseContext()`. See `Echo#ServeHTTP()`
func (*RequestContext) Response ¶
func (c *RequestContext) Response() *echo.Response
Response returns `*Response`.
func (*RequestContext) Scheme ¶
func (c *RequestContext) Scheme() string
Scheme returns the HTTP protocol scheme, `http` or `https`.
func (*RequestContext) Set ¶
func (r *RequestContext) Set(name string, value interface{})
func (*RequestContext) SetAuthenticatedUser ¶
func (r *RequestContext) SetAuthenticatedUser(user UserInterface)
func (*RequestContext) SetAuthenticatedUserAndFillRoles ¶
func (r *RequestContext) SetAuthenticatedUserAndFillRoles(user UserInterface)
func (*RequestContext) SetCookie ¶
func (c *RequestContext) SetCookie(cookie *http.Cookie)
SetCookie adds a `Set-Cookie` header in HTTP response.
func (*RequestContext) SetHandler ¶
func (c *RequestContext) SetHandler(h echo.HandlerFunc)
SetHandler sets the matched handler by router.
func (*RequestContext) SetParamNames ¶
func (c *RequestContext) SetParamNames(names ...string)
SetParamNames sets path parameter names.
func (*RequestContext) SetParamValues ¶
func (c *RequestContext) SetParamValues(values ...string)
SetParamValues sets path parameter values.
func (*RequestContext) SetPath ¶
func (c *RequestContext) SetPath(p string)
SetPath sets the registered path for the handler.
func (*RequestContext) SetRequest ¶
func (c *RequestContext) SetRequest(r *http.Request)
SetRequest sets `*http.Request`.
func (*RequestContext) SetResponse ¶
func (c *RequestContext) SetResponse(r *echo.Response)
SetResponse sets `*Response`.
func (*RequestContext) SetResponseContentType ¶
func (r *RequestContext) SetResponseContentType(v string) error
Set response type, returns error if the type is invalid
func (*RequestContext) Stream ¶
Stream sends a streaming response with status code and content type.
func (*RequestContext) String ¶
func (c *RequestContext) String(code int, s string) error
String sends a string response with status code.
func (*RequestContext) Validate ¶
func (c *RequestContext) Validate(i interface{}) error
Validate validates provided `i`. It is usually called after `Context#Bind()`. Validator must be registered using `Echo#Validator`.
func (*RequestContext) XML ¶
func (c *RequestContext) XML(code int, i interface{}) error
XML sends an XML response with status code.
type RequestContextOpts ¶
type RequestContextOpts struct { App App EchoContext echo.Context }
type ResponseMessage ¶ added in v1.0.2
type ResponseMessageTPLCtx ¶ added in v1.0.2
type ResponseMessageTPLCtx struct { Ctx *RequestContext Message *ResponseMessage }
type ResponseMessagesTPLCtx ¶ added in v1.0.2
type ResponseMessagesTPLCtx struct { Ctx *RequestContext Content string }
type SessionData ¶
type SessionData struct {
UserID string
}
type TemplateCTX ¶
type TemplateCTX struct { EchoContext echo.Context Ctx interface{} Record interface{} Records interface{} }
type TemplateRenderer ¶
type TemplateRenderer struct {
// contains filtered or unexported fields
}
type UserInterface ¶
type UserInterface interface { // getters: GetID() string SetID(id string) error GetRoles() []string SetRoles(v []string) error AddRole(role string) error RemoveRole(role string) error GetEmail() string SetEmail(v string) error GetUsername() string SetUsername(v string) error GetDisplayName() string SetDisplayName(v string) error GetFullName() string SetFullName(v string) error GetLanguage() string SetLanguage(v string) error IsActive() bool SetActive(blocked bool) error IsBlocked() bool SetBlocked(blocked bool) error // FillById FillById(ID string) error }
type ValidationFieldError ¶
type ValidationResponse ¶
type ValidationResponse struct {
Errors []*ValidationFieldError `json:"errors"`
}
Source Files
¶
- App.go
- HTTPController.go
- HTTPResource.go
- Plugin-func-maps.go
- Plugin.go
- Pluginer.go
- RequestContext.go
- bolo.go
- context.go
- http-header.go
- middlewares.go
- migration.go
- minifier.go
- plugin_manager.go
- request.go
- responses.go
- router.go
- sanitizer.go
- server_errors.go
- server_handlers.go
- user_interface.go
- view.go