Documentation
¶
Index ¶
- Constants
- func StatusText(code int) string
- type Context
- type ContextRequest
- type ContextResponse
- type FormRequest
- type HandlerFunc
- type Json
- type Limit
- type Middleware
- type RateLimiter
- type ResourceController
- type Response
- type ResponseOrigin
- type ResponseStatus
- type ResponseSuccess
- type ResponseView
- type View
Constants ¶
View Source
const ( MethodGet = http.MethodGet MethodHead = http.MethodHead MethodPost = http.MethodPost MethodPut = http.MethodPut MethodPatch = http.MethodPatch MethodDelete = http.MethodDelete MethodConnect = http.MethodConnect MethodOptions = http.MethodOptions MethodTrace = http.MethodTrace )
View Source
const ( StatusContinue = http.StatusContinue StatusSwitchingProtocols = http.StatusSwitchingProtocols StatusProcessing = http.StatusProcessing StatusEarlyHints = http.StatusEarlyHints StatusOK = http.StatusOK StatusCreated = http.StatusCreated StatusAccepted = http.StatusAccepted StatusNonAuthoritativeInfo = http.StatusNonAuthoritativeInfo StatusNoContent = http.StatusNoContent StatusResetContent = http.StatusResetContent StatusPartialContent = http.StatusPartialContent StatusMultiStatus = http.StatusMultiStatus StatusAlreadyReported = http.StatusAlreadyReported StatusIMUsed = http.StatusIMUsed StatusMultipleChoices = http.StatusMultipleChoices StatusMovedPermanently = http.StatusMovedPermanently StatusFound = http.StatusFound StatusSeeOther = http.StatusSeeOther StatusNotModified = http.StatusNotModified StatusUseProxy = http.StatusUseProxy StatusTemporaryRedirect = http.StatusTemporaryRedirect StatusPermanentRedirect = http.StatusPermanentRedirect StatusBadRequest = http.StatusBadRequest StatusPaymentRequired = http.StatusPaymentRequired StatusForbidden = http.StatusForbidden StatusNotFound = http.StatusNotFound StatusMethodNotAllowed = http.StatusMethodNotAllowed StatusNotAcceptable = http.StatusNotAcceptable StatusProxyAuthRequired = http.StatusProxyAuthRequired StatusRequestTimeout = http.StatusRequestTimeout StatusConflict = http.StatusConflict StatusGone = http.StatusGone StatusLengthRequired = http.StatusLengthRequired StatusPreconditionFailed = http.StatusPreconditionFailed StatusRequestEntityTooLarge = http.StatusRequestEntityTooLarge StatusRequestURITooLong = http.StatusRequestURITooLong StatusUnsupportedMediaType = http.StatusUnsupportedMediaType StatusRequestedRangeNotSatisfiable = http.StatusRequestedRangeNotSatisfiable StatusExpectationFailed = http.StatusExpectationFailed StatusTeapot = http.StatusTeapot StatusMisdirectedRequest = http.StatusMisdirectedRequest StatusUnprocessableEntity = http.StatusUnprocessableEntity StatusLocked = http.StatusLocked StatusFailedDependency = http.StatusFailedDependency StatusTooEarly = http.StatusTooEarly StatusUpgradeRequired = http.StatusUpgradeRequired StatusPreconditionRequired = http.StatusPreconditionRequired StatusTooManyRequests = http.StatusTooManyRequests StatusRequestHeaderFieldsTooLarge = http.StatusRequestHeaderFieldsTooLarge StatusInternalServerError = http.StatusInternalServerError StatusNotImplemented = http.StatusNotImplemented StatusBadGateway = http.StatusBadGateway StatusGatewayTimeout = http.StatusGatewayTimeout StatusHTTPVersionNotSupported = http.StatusHTTPVersionNotSupported StatusVariantAlsoNegotiates = http.StatusVariantAlsoNegotiates StatusInsufficientStorage = http.StatusInsufficientStorage StatusLoopDetected = http.StatusLoopDetected StatusNotExtended = http.StatusNotExtended StatusNetworkAuthenticationRequired = http.StatusNetworkAuthenticationRequired )
Variables ¶
This section is empty.
Functions ¶
func StatusText ¶ added in v1.10.0
StatusText returns a text for the HTTP status code. It returns the empty string if the code is unknown.
Types ¶
type Context ¶ added in v1.0.1
type Context interface {
context.Context
Context() context.Context
WithValue(key string, value any)
Request() ContextRequest
Response() ContextResponse
}
type ContextRequest ¶ added in v1.13.1
type ContextRequest interface {
Header(key string, defaultValue ...string) string
Headers() http.Header
Method() string
Path() string
Url() string
FullUrl() string
Ip() string
Host() string
// All Retrieve json, form and query
All() map[string]any
// Bind Retrieve json and bind to obj
Bind(obj any) error
// Route Retrieve an input item from the request: /users/{id}
Route(key string) string
RouteInt(key string) int
RouteInt64(key string) int64
// Query Retrieve a query string item form the request: /users?id=1
Query(key string, defaultValue ...string) string
QueryInt(key string, defaultValue ...int) int
QueryInt64(key string, defaultValue ...int64) int64
QueryBool(key string, defaultValue ...bool) bool
QueryArray(key string) []string
QueryMap(key string) map[string]string
Queries() map[string]string
// Input Retrieve data by order: json, form, query, route
Input(key string, defaultValue ...string) string
InputArray(key string, defaultValue ...[]string) []string
InputMap(key string, defaultValue ...map[string]string) map[string]string
InputInt(key string, defaultValue ...int) int
InputInt64(key string, defaultValue ...int64) int64
InputBool(key string, defaultValue ...bool) bool
File(name string) (filesystem.File, error)
AbortWithStatus(code int)
AbortWithStatusJson(code int, jsonObj any)
Next()
Origin() *http.Request
Validate(rules map[string]string, options ...validation.Option) (validation.Validator, error)
ValidateRequest(request FormRequest) (validation.Errors, error)
}
type ContextResponse ¶ added in v1.13.1
type ContextResponse interface {
Data(code int, contentType string, data []byte) Response
Download(filepath, filename string) Response
File(filepath string) Response
Header(key, value string) ContextResponse
Json(code int, obj any) Response
Origin() ResponseOrigin
Redirect(code int, location string) Response
String(code int, format string, values ...any) Response
Success() ResponseSuccess
Status(code int) ResponseStatus
View() ResponseView
Writer() http.ResponseWriter
Flush()
}
type FormRequest ¶
type HandlerFunc ¶ added in v1.0.0
type Middleware ¶ added in v1.0.0
type Middleware func(Context)
type RateLimiter ¶ added in v1.10.0
type ResourceController ¶ added in v1.11.1
type ResponseOrigin ¶ added in v1.8.0
type ResponseStatus ¶ added in v1.12.5
type ResponseSuccess ¶ added in v1.0.0
type ResponseView ¶ added in v1.13.1
Source Files
¶
Click to show internal directories.
Click to hide internal directories.