Documentation ¶
Index ¶
- Constants
- Variables
- type App
- type C
- func (c *C) Attachment(file, name string) error
- func (c *C) Blob(statusCode int, contentType string, b []byte) error
- func (c *C) ContentDisposition(file, name, dispositionType string) error
- func (c *C) Context() context.Context
- func (c *C) Cookie(name string) (*http.Cookie, error)
- func (c *C) Cookies() []*http.Cookie
- func (c *C) File(path string) error
- func (c *C) FormFile(name string) (*multipart.FileHeader, error)
- func (c *C) FormParams() (url.Values, error)
- func (c *C) FormValue(name string) (string, error)
- func (c *C) FormValues(name string) ([]string, error)
- func (c *C) HTML(statusCode int, html string) error
- func (c *C) Inline(file, name string) error
- func (c *C) JSON(statusCode int, i interface{}) error
- func (c *C) JSONBlob(statusCode int, b []byte) error
- func (c *C) JSONPretty(statusCode int, i interface{}, indent string) error
- func (c *C) Logger() zerolog.Logger
- func (c *C) MultipartForm() (*multipart.Form, error)
- func (c *C) QueryParam(name string) string
- func (c *C) QueryParams() url.Values
- func (c *C) QueryString() string
- func (c *C) Render(statusCode int, name string, data interface{}) error
- func (c *C) SetCookie(cookie *http.Cookie)
- func (c *C) Stream(statusCode int, contentType string, r io.Reader) error
- func (c *C) String(statusCode int, s string) error
- func (c *C) URLParam(name string) string
- type Error
- type ErrorHandler
- type HTTPError
- type Handler
- type HandlerFunc
- type Middleware
- type MiddlewareFunc
- type R
- func (r *R) Any(pattern string, h Handler)
- func (r *R) Connect(pattern string, h Handler)
- func (r *R) Delete(pattern string, h Handler)
- func (r *R) Get(pattern string, h Handler)
- func (r *R) Head(pattern string, h Handler)
- func (r *R) Options(pattern string, h Handler)
- func (r *R) Patch(pattern string, h Handler)
- func (r *R) Post(pattern string, h Handler)
- func (r *R) Put(pattern string, h Handler)
- func (r *R) SetErrorHandler(errHandler ErrorHandler)
- func (r *R) SubRouter(pattern string, sr *R)
- func (r *R) Trace(pattern string, h Handler)
- func (r *R) Use(middlewares ...Middleware)
- type ReportTarget
- type TemplateRenderer
Constants ¶
View Source
const ( ErrCodeUnknown = "UNKNOWN" ErrMsgUnknown = "unknown error" )
Variables ¶
View Source
var ( ErrBadRequest = NewStatusCodeHTTPError(http.StatusBadRequest) ErrForbidden = NewStatusCodeHTTPError(http.StatusForbidden) ErrNotFound = NewStatusCodeHTTPError(http.StatusNotFound) ErrMethodNotAllowed = NewStatusCodeHTTPError(http.StatusMethodNotAllowed) ErrRequestTimeout = NewStatusCodeHTTPError(http.StatusRequestTimeout) ErrStatusRequestEntityTooLarge = NewStatusCodeHTTPError(http.StatusRequestEntityTooLarge) ErrUnsupportedMediaType = NewStatusCodeHTTPError(http.StatusUnsupportedMediaType) ErrTooManyRequests = NewStatusCodeHTTPError(http.StatusTooManyRequests) ErrInternalServerError = NewStatusCodeHTTPError(http.StatusInternalServerError) ErrBadGateway = NewStatusCodeHTTPError(http.StatusBadGateway) ErrRendererNotRegistered = NewMsgHTTPError("renderer not registered") ErrCookieNotFound = NewMsgHTTPError("cookie not found") )
Errors
View Source
var ( OnlyLogReportTargets = []ReportTarget{LogReportTarget} OnlyUserReportTargets = []ReportTarget{UserReportTarget} AllReportTargets = []ReportTarget{LogReportTarget, UserReportTarget} )
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the top-level web application instance.
type C ¶
type C struct {
// contains filtered or unexported fields
}
C represents the context of the current HTTP request.
func (*C) Attachment ¶
func (*C) ContentDisposition ¶
func (*C) QueryParam ¶
func (*C) QueryParams ¶
func (*C) QueryString ¶
type ErrorHandler ¶
type HTTPError ¶
type HTTPError interface { error Code() string StatusCode() int ReportTargets() []ReportTarget }
func NewMsgHTTPError ¶
func NewStatusCodeHTTPError ¶
type HandlerFunc ¶
func (HandlerFunc) ServeHTTP ¶
func (f HandlerFunc) ServeHTTP(c *C) error
type Middleware ¶
type MiddlewareFunc ¶
func (MiddlewareFunc) Apply ¶
func (m MiddlewareFunc) Apply(h Handler) Handler
type R ¶
type R struct {
// contains filtered or unexported fields
}
func (*R) SetErrorHandler ¶
func (r *R) SetErrorHandler(errHandler ErrorHandler)
func (*R) Use ¶
func (r *R) Use(middlewares ...Middleware)
type ReportTarget ¶
type ReportTarget uint8
const ( LogReportTarget ReportTarget = iota UserReportTarget )
Click to show internal directories.
Click to hide internal directories.