Documentation ¶
Index ¶
- Constants
- Variables
- func Background() http.Context
- func Cors() http.Middleware
- func NewContext(ctx *fiber.Ctx) http.Context
- func NewContextRequest(ctx *Context, log log.Log, validation contractsvalidate.Validation) contractshttp.ContextRequest
- func NewGroup(config config.Config, instance *fiber.App, prefix string, ...) route.Router
- func NewStatus(instance *fiber.Ctx, code int) contractshttp.ResponseStatus
- func ResponseMiddleware() contractshttp.Middleware
- type Context
- func (c *Context) Context() context.Context
- func (c *Context) Deadline() (deadline time.Time, ok bool)
- func (c *Context) Done() <-chan struct{}
- func (c *Context) Err() error
- func (c *Context) Instance() *fiber.Ctx
- func (c *Context) Request() http.ContextRequest
- func (c *Context) Response() http.ContextResponse
- func (c *Context) Value(key any) any
- func (c *Context) WithValue(key any, value any)
- type ContextRequest
- func (r *ContextRequest) AbortWithStatus(code int)
- func (r *ContextRequest) AbortWithStatusJson(code int, jsonObj any)
- func (r *ContextRequest) All() map[string]any
- func (r *ContextRequest) Bind(obj any) error
- func (r *ContextRequest) Cookie(key string, defaultValue ...string) string
- func (r *ContextRequest) File(name string) (contractsfilesystem.File, error)
- func (r *ContextRequest) Form(key string, defaultValue ...string) string
- func (r *ContextRequest) FullUrl() string
- func (r *ContextRequest) HasSession() bool
- func (r *ContextRequest) Header(key string, defaultValue ...string) string
- func (r *ContextRequest) Headers() http.Header
- func (r *ContextRequest) Host() string
- func (r *ContextRequest) Input(key string, defaultValue ...string) string
- func (r *ContextRequest) InputArray(key string, defaultValue ...[]string) []string
- func (r *ContextRequest) InputBool(key string, defaultValue ...bool) bool
- func (r *ContextRequest) InputInt(key string, defaultValue ...int) int
- func (r *ContextRequest) InputInt64(key string, defaultValue ...int64) int64
- func (r *ContextRequest) InputMap(key string, defaultValue ...map[string]string) map[string]string
- func (r *ContextRequest) Ip() string
- func (r *ContextRequest) Json(key string, defaultValue ...string) string
- func (r *ContextRequest) Method() string
- func (r *ContextRequest) Next()
- func (r *ContextRequest) Origin() *http.Request
- func (r *ContextRequest) Path() string
- func (r *ContextRequest) Queries() map[string]string
- func (r *ContextRequest) Query(key string, defaultValue ...string) string
- func (r *ContextRequest) QueryArray(key string) []string
- func (r *ContextRequest) QueryBool(key string, defaultValue ...bool) bool
- func (r *ContextRequest) QueryInt(key string, defaultValue ...int) int
- func (r *ContextRequest) QueryInt64(key string, defaultValue ...int64) int64
- func (r *ContextRequest) QueryMap(key string) map[string]string
- func (r *ContextRequest) Route(key string) string
- func (r *ContextRequest) RouteInt(key string) int
- func (r *ContextRequest) RouteInt64(key string) int64
- func (r *ContextRequest) Session() contractsession.Session
- func (r *ContextRequest) SetSession(session contractsession.Session) contractshttp.ContextRequest
- func (r *ContextRequest) Url() string
- func (r *ContextRequest) Validate(rules map[string]string, options ...contractsvalidate.Option) (contractsvalidate.Validator, error)
- func (r *ContextRequest) ValidateRequest(request contractshttp.FormRequest) (contractsvalidate.Errors, error)
- type ContextResponse
- func (r *ContextResponse) Cookie(cookie contractshttp.Cookie) contractshttp.ContextResponse
- func (r *ContextResponse) Data(code int, contentType string, data []byte) contractshttp.Response
- func (r *ContextResponse) Download(filepath, filename string) contractshttp.Response
- func (r *ContextResponse) File(filepath string) contractshttp.Response
- func (r *ContextResponse) Flush()
- func (r *ContextResponse) Header(key, value string) contractshttp.ContextResponse
- func (r *ContextResponse) Json(code int, obj any) contractshttp.Response
- func (r *ContextResponse) NoContent(code ...int) contractshttp.Response
- func (r *ContextResponse) Origin() contractshttp.ResponseOrigin
- func (r *ContextResponse) Redirect(code int, location string) contractshttp.Response
- func (r *ContextResponse) Status(code int) contractshttp.ResponseStatus
- func (r *ContextResponse) String(code int, format string, values ...any) contractshttp.Response
- func (r *ContextResponse) Success() contractshttp.ResponseStatus
- func (r *ContextResponse) View() contractshttp.ResponseView
- func (r *ContextResponse) WithoutCookie(name string) contractshttp.ContextResponse
- func (r *ContextResponse) Writer() http.ResponseWriter
- type DataResponse
- type DownloadResponse
- type FileResponse
- type Group
- func (r *Group) Any(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Delete(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Get(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Group(handler route.GroupFunc)
- func (r *Group) Middleware(middlewares ...httpcontract.Middleware) route.Router
- func (r *Group) Options(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Patch(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Post(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Prefix(addr string) route.Router
- func (r *Group) Put(relativePath string, handler httpcontract.HandlerFunc)
- func (r *Group) Resource(relativePath string, controller httpcontract.ResourceController)
- func (r *Group) Static(relativePath, root string)
- func (r *Group) StaticFS(relativePath string, fs http.FileSystem)
- func (r *Group) StaticFile(relativePath, filePath string)
- type HtmlResponse
- type JsonResponse
- type NoContentResponse
- type RedirectResponse
- type ResponseOrigin
- type Route
- func (r *Route) Fallback(handler httpcontract.HandlerFunc)
- func (r *Route) GlobalMiddleware(middlewares ...httpcontract.Middleware)
- func (r *Route) Run(host ...string) error
- func (r *Route) RunTLS(host ...string) error
- func (r *Route) RunTLSWithCert(host, certFile, keyFile string) error
- func (r *Route) ServeHTTP(writer http.ResponseWriter, request *http.Request)
- func (r *Route) Shutdown(ctx ...context.Context) error
- func (r *Route) Test(request *http.Request) (*http.Response, error)
- type ServiceProvider
- type Status
- type StringResponse
- type View
Constants ¶
View Source
const RouteBinding = "goravel.fiber.route"
Variables ¶
View Source
var ( App foundation.Application ConfigFacade config.Config LogFacade log.Log ValidationFacade validation.Validation ViewFacade http.View )
Functions ¶
func Background ¶
func Cors ¶ added in v1.1.6
func Cors() http.Middleware
func NewContext ¶ added in v1.0.4
func NewContextRequest ¶ added in v1.1.6
func NewContextRequest(ctx *Context, log log.Log, validation contractsvalidate.Validation) contractshttp.ContextRequest
func NewGroup ¶ added in v1.0.4
func NewGroup(config config.Config, instance *fiber.App, prefix string, originMiddlewares []httpcontract.Middleware, lastMiddlewares []httpcontract.Middleware) route.Router
func NewStatus ¶ added in v1.1.4
func NewStatus(instance *fiber.Ctx, code int) contractshttp.ResponseStatus
func ResponseMiddleware ¶ added in v1.0.4
func ResponseMiddleware() contractshttp.Middleware
Types ¶
type Context ¶ added in v1.0.4
type Context struct {
// contains filtered or unexported fields
}
func (*Context) Request ¶ added in v1.0.4
func (c *Context) Request() http.ContextRequest
func (*Context) Response ¶ added in v1.0.4
func (c *Context) Response() http.ContextResponse
type ContextRequest ¶ added in v1.1.6
type ContextRequest struct {
// contains filtered or unexported fields
}
func (*ContextRequest) AbortWithStatus ¶ added in v1.1.6
func (r *ContextRequest) AbortWithStatus(code int)
func (*ContextRequest) AbortWithStatusJson ¶ added in v1.1.6
func (r *ContextRequest) AbortWithStatusJson(code int, jsonObj any)
func (*ContextRequest) All ¶ added in v1.1.6
func (r *ContextRequest) All() map[string]any
func (*ContextRequest) Bind ¶ added in v1.1.6
func (r *ContextRequest) Bind(obj any) error
func (*ContextRequest) Cookie ¶ added in v1.2.0
func (r *ContextRequest) Cookie(key string, defaultValue ...string) string
func (*ContextRequest) File ¶ added in v1.1.6
func (r *ContextRequest) File(name string) (contractsfilesystem.File, error)
func (*ContextRequest) Form ¶ added in v1.1.6
func (r *ContextRequest) Form(key string, defaultValue ...string) string
func (*ContextRequest) FullUrl ¶ added in v1.1.6
func (r *ContextRequest) FullUrl() string
func (*ContextRequest) HasSession ¶ added in v1.2.0
func (r *ContextRequest) HasSession() bool
func (*ContextRequest) Header ¶ added in v1.1.6
func (r *ContextRequest) Header(key string, defaultValue ...string) string
func (*ContextRequest) Headers ¶ added in v1.1.6
func (r *ContextRequest) Headers() http.Header
func (*ContextRequest) Host ¶ added in v1.1.6
func (r *ContextRequest) Host() string
func (*ContextRequest) Input ¶ added in v1.1.6
func (r *ContextRequest) Input(key string, defaultValue ...string) string
func (*ContextRequest) InputArray ¶ added in v1.1.6
func (r *ContextRequest) InputArray(key string, defaultValue ...[]string) []string
func (*ContextRequest) InputBool ¶ added in v1.1.6
func (r *ContextRequest) InputBool(key string, defaultValue ...bool) bool
func (*ContextRequest) InputInt ¶ added in v1.1.6
func (r *ContextRequest) InputInt(key string, defaultValue ...int) int
func (*ContextRequest) InputInt64 ¶ added in v1.1.6
func (r *ContextRequest) InputInt64(key string, defaultValue ...int64) int64
func (*ContextRequest) Ip ¶ added in v1.1.6
func (r *ContextRequest) Ip() string
func (*ContextRequest) Json ¶ added in v1.1.6
func (r *ContextRequest) Json(key string, defaultValue ...string) string
func (*ContextRequest) Method ¶ added in v1.1.6
func (r *ContextRequest) Method() string
func (*ContextRequest) Next ¶ added in v1.1.6
func (r *ContextRequest) Next()
func (*ContextRequest) Origin ¶ added in v1.1.6
func (r *ContextRequest) Origin() *http.Request
func (*ContextRequest) Path ¶ added in v1.1.6
func (r *ContextRequest) Path() string
func (*ContextRequest) Queries ¶ added in v1.1.6
func (r *ContextRequest) Queries() map[string]string
func (*ContextRequest) Query ¶ added in v1.1.6
func (r *ContextRequest) Query(key string, defaultValue ...string) string
func (*ContextRequest) QueryArray ¶ added in v1.1.6
func (r *ContextRequest) QueryArray(key string) []string
func (*ContextRequest) QueryBool ¶ added in v1.1.6
func (r *ContextRequest) QueryBool(key string, defaultValue ...bool) bool
func (*ContextRequest) QueryInt ¶ added in v1.1.6
func (r *ContextRequest) QueryInt(key string, defaultValue ...int) int
func (*ContextRequest) QueryInt64 ¶ added in v1.1.6
func (r *ContextRequest) QueryInt64(key string, defaultValue ...int64) int64
func (*ContextRequest) QueryMap ¶ added in v1.1.6
func (r *ContextRequest) QueryMap(key string) map[string]string
func (*ContextRequest) Route ¶ added in v1.1.6
func (r *ContextRequest) Route(key string) string
func (*ContextRequest) RouteInt ¶ added in v1.1.6
func (r *ContextRequest) RouteInt(key string) int
func (*ContextRequest) RouteInt64 ¶ added in v1.1.6
func (r *ContextRequest) RouteInt64(key string) int64
func (*ContextRequest) Session ¶ added in v1.2.0
func (r *ContextRequest) Session() contractsession.Session
func (*ContextRequest) SetSession ¶ added in v1.2.0
func (r *ContextRequest) SetSession(session contractsession.Session) contractshttp.ContextRequest
func (*ContextRequest) Url ¶ added in v1.1.6
func (r *ContextRequest) Url() string
func (*ContextRequest) Validate ¶ added in v1.1.6
func (r *ContextRequest) Validate(rules map[string]string, options ...contractsvalidate.Option) (contractsvalidate.Validator, error)
func (*ContextRequest) ValidateRequest ¶ added in v1.1.6
func (r *ContextRequest) ValidateRequest(request contractshttp.FormRequest) (contractsvalidate.Errors, error)
type ContextResponse ¶ added in v1.1.6
type ContextResponse struct {
// contains filtered or unexported fields
}
func NewContextResponse ¶ added in v1.1.6
func NewContextResponse(instance *fiber.Ctx, origin contractshttp.ResponseOrigin) *ContextResponse
func (*ContextResponse) Cookie ¶ added in v1.2.0
func (r *ContextResponse) Cookie(cookie contractshttp.Cookie) contractshttp.ContextResponse
func (*ContextResponse) Data ¶ added in v1.1.6
func (r *ContextResponse) Data(code int, contentType string, data []byte) contractshttp.Response
func (*ContextResponse) Download ¶ added in v1.1.6
func (r *ContextResponse) Download(filepath, filename string) contractshttp.Response
func (*ContextResponse) File ¶ added in v1.1.6
func (r *ContextResponse) File(filepath string) contractshttp.Response
func (*ContextResponse) Flush ¶ added in v1.1.6
func (r *ContextResponse) Flush()
func (*ContextResponse) Header ¶ added in v1.1.6
func (r *ContextResponse) Header(key, value string) contractshttp.ContextResponse
func (*ContextResponse) Json ¶ added in v1.1.6
func (r *ContextResponse) Json(code int, obj any) contractshttp.Response
func (*ContextResponse) NoContent ¶ added in v1.2.0
func (r *ContextResponse) NoContent(code ...int) contractshttp.Response
func (*ContextResponse) Origin ¶ added in v1.1.6
func (r *ContextResponse) Origin() contractshttp.ResponseOrigin
func (*ContextResponse) Redirect ¶ added in v1.1.6
func (r *ContextResponse) Redirect(code int, location string) contractshttp.Response
func (*ContextResponse) Status ¶ added in v1.1.6
func (r *ContextResponse) Status(code int) contractshttp.ResponseStatus
func (*ContextResponse) String ¶ added in v1.1.6
func (r *ContextResponse) String(code int, format string, values ...any) contractshttp.Response
func (*ContextResponse) Success ¶ added in v1.1.6
func (r *ContextResponse) Success() contractshttp.ResponseStatus
func (*ContextResponse) View ¶ added in v1.1.6
func (r *ContextResponse) View() contractshttp.ResponseView
func (*ContextResponse) WithoutCookie ¶ added in v1.2.0
func (r *ContextResponse) WithoutCookie(name string) contractshttp.ContextResponse
func (*ContextResponse) Writer ¶ added in v1.1.6
func (r *ContextResponse) Writer() http.ResponseWriter
type DataResponse ¶ added in v1.1.6
type DataResponse struct {
// contains filtered or unexported fields
}
func (*DataResponse) Render ¶ added in v1.1.6
func (r *DataResponse) Render() error
type DownloadResponse ¶ added in v1.1.6
type DownloadResponse struct {
// contains filtered or unexported fields
}
func (*DownloadResponse) Render ¶ added in v1.1.6
func (r *DownloadResponse) Render() error
type FileResponse ¶ added in v1.1.6
type FileResponse struct {
// contains filtered or unexported fields
}
func (*FileResponse) Render ¶ added in v1.1.6
func (r *FileResponse) Render() error
type Group ¶ added in v1.0.4
type Group struct {
// contains filtered or unexported fields
}
func (*Group) Any ¶ added in v1.0.4
func (r *Group) Any(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Delete ¶ added in v1.0.4
func (r *Group) Delete(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Get ¶ added in v1.0.4
func (r *Group) Get(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Middleware ¶ added in v1.0.4
func (r *Group) Middleware(middlewares ...httpcontract.Middleware) route.Router
func (*Group) Options ¶ added in v1.0.4
func (r *Group) Options(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Patch ¶ added in v1.0.4
func (r *Group) Patch(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Post ¶ added in v1.0.4
func (r *Group) Post(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Put ¶ added in v1.0.4
func (r *Group) Put(relativePath string, handler httpcontract.HandlerFunc)
func (*Group) Resource ¶ added in v1.0.4
func (r *Group) Resource(relativePath string, controller httpcontract.ResourceController)
func (*Group) StaticFS ¶ added in v1.0.4
func (r *Group) StaticFS(relativePath string, fs http.FileSystem)
func (*Group) StaticFile ¶ added in v1.0.4
type HtmlResponse ¶ added in v1.1.6
type HtmlResponse struct {
// contains filtered or unexported fields
}
func (*HtmlResponse) Render ¶ added in v1.1.6
func (r *HtmlResponse) Render() error
type JsonResponse ¶ added in v1.1.6
type JsonResponse struct {
// contains filtered or unexported fields
}
func (*JsonResponse) Render ¶ added in v1.1.6
func (r *JsonResponse) Render() error
type NoContentResponse ¶ added in v1.2.0
type NoContentResponse struct {
// contains filtered or unexported fields
}
func (*NoContentResponse) Render ¶ added in v1.2.0
func (r *NoContentResponse) Render() error
type RedirectResponse ¶ added in v1.1.6
type RedirectResponse struct {
// contains filtered or unexported fields
}
func (*RedirectResponse) Render ¶ added in v1.1.6
func (r *RedirectResponse) Render() error
type ResponseOrigin ¶ added in v1.0.4
type ResponseOrigin struct {
*fiber.Ctx
}
func (*ResponseOrigin) Body ¶ added in v1.0.4
func (w *ResponseOrigin) Body() *bytes.Buffer
func (*ResponseOrigin) Header ¶ added in v1.0.4
func (w *ResponseOrigin) Header() http.Header
func (*ResponseOrigin) Size ¶ added in v1.0.4
func (w *ResponseOrigin) Size() int
func (*ResponseOrigin) Status ¶ added in v1.0.4
func (w *ResponseOrigin) Status() int
type Route ¶ added in v1.0.4
Route fiber route Route fiber 路由
func (*Route) Fallback ¶ added in v1.0.4
func (r *Route) Fallback(handler httpcontract.HandlerFunc)
Fallback set fallback handler Fallback 设置回退处理程序
func (*Route) GlobalMiddleware ¶ added in v1.0.4
func (r *Route) GlobalMiddleware(middlewares ...httpcontract.Middleware)
GlobalMiddleware set global middleware GlobalMiddleware 设置全局中间件
func (*Route) RunTLSWithCert ¶ added in v1.0.4
RunTLSWithCert run TLS server with cert file and key file RunTLSWithCert 使用证书文件和密钥文件运行 TLS 服务器
func (*Route) ServeHTTP ¶ added in v1.0.4
func (r *Route) ServeHTTP(writer http.ResponseWriter, request *http.Request)
ServeHTTP serve http request (Not support) ServeHTTP 服务 HTTP 请求 (不支持)
type ServiceProvider ¶
type ServiceProvider struct{}
func (*ServiceProvider) Boot ¶
func (receiver *ServiceProvider) Boot(app foundation.Application)
func (*ServiceProvider) Register ¶
func (receiver *ServiceProvider) Register(app foundation.Application)
type Status ¶ added in v1.1.4
type Status struct {
// contains filtered or unexported fields
}
type StringResponse ¶ added in v1.1.6
type StringResponse struct {
// contains filtered or unexported fields
}
func (*StringResponse) Render ¶ added in v1.1.6
func (r *StringResponse) Render() error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.