Documentation
¶
Index ¶
Constants ¶
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 ¶
StatusText returns a text for the HTTP status code. It returns the empty string if the code is unknown.
Types ¶
type FormRequest ¶
type HandlerFunc ¶
type HandlerFunc func(Context)
type Middleware ¶
type Middleware func(Context)
type RateLimiter ¶
type Request ¶
type Request interface {
Header(key string, defaultValue ...string) string
Headers() http.Header
Method() string
Path() string
Url() string
FullUrl() string
Ip() string
// 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
// Form Retrieve a form string item from the post: /users POST:id=1
Form(key string, defaultValue ...string) string
// Json Retrieve data from the post: /users JSON:{"id": 1}
Json(key string, defaultValue ...string) string
// Bind Retrieve JSON and bind to obj
Bind(obj any) error
// Input Retrieve data by order: json, form, query, route
Input(key string, defaultValue ...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 Response ¶
type Response interface {
Data(code int, contentType string, data []byte)
Download(filepath, filename string)
File(filepath string)
Header(key, value string) Response
Json(code int, obj any)
Origin() ResponseOrigin
Redirect(code int, location string)
String(code int, format string, values ...any)
Success() ResponseSuccess
Writer() http.ResponseWriter
}
type ResponseOrigin ¶
Click to show internal directories.
Click to hide internal directories.