Documentation
¶
Index ¶
- Constants
- func DefaultOpenAPIHandler(specURL string) fiber.Handler
- func NewOpenAPISpec() openapi3.T
- func StatusMessage(statusCode int) string
- type App
- func (s *App) AddServer(url, description string)
- func (s *App) AddTags(tags ...string) *App
- func (s *App) Description(description string) *App
- func (s *App) Listen(address string) error
- func (s *App) SaveOpenAPISpec() ([]byte, error)
- func (s *App) Shutdown() error
- func (s *App) Title(title string) *App
- func (s *App) Version(version string) *App
- type Context
- type ContextNoRequest
- func (c *ContextNoRequest) Accepts(offers ...string) string
- func (c *ContextNoRequest) AcceptsCharsets(offers ...string) string
- func (c *ContextNoRequest) AcceptsEncodings(offers ...string) string
- func (c *ContextNoRequest) AcceptsLanguages(offers ...string) string
- func (c *ContextNoRequest) AllParams() map[string]string
- func (c *ContextNoRequest) App() *App
- func (c *ContextNoRequest) Append(field string, values ...string)
- func (c *ContextNoRequest) Attachment(filename ...string)
- func (c *ContextNoRequest) BaseURL() string
- func (c *ContextNoRequest) Bind(vars fiber.Map) error
- func (c *ContextNoRequest) BodyRaw() []byte
- func (c *ContextNoRequest) ClearCookie(key ...string)
- func (c *ContextNoRequest) ClientHelloInfo() *tls.ClientHelloInfo
- func (c *ContextNoRequest) Context() context.Context
- func (c *ContextNoRequest) Cookie(cookie *fiber.Cookie)
- func (c *ContextNoRequest) Cookies(key string, defaultValue ...string) string
- func (c *ContextNoRequest) Download(file string, filename ...string) error
- func (c *ContextNoRequest) FormFile(key string) (*multipart.FileHeader, error)
- func (c *ContextNoRequest) FormValue(key string, defaultValue ...string) string
- func (c *ContextNoRequest) Format(body interface{}) error
- func (c *ContextNoRequest) Fresh() bool
- func (c *ContextNoRequest) Get(key string, defaultValue ...string) string
- func (c *ContextNoRequest) GetReqHeaders() map[string][]string
- func (c *ContextNoRequest) GetRespHeaders() map[string][]string
- func (c *ContextNoRequest) GetRouteURL(routeName string, params fiber.Map) (string, error)
- func (c *ContextNoRequest) Hostname() string
- func (c *ContextNoRequest) IP() string
- func (c *ContextNoRequest) IPs() []string
- func (c *ContextNoRequest) Is(extension string) bool
- func (c *ContextNoRequest) IsFromLocal() bool
- func (c *ContextNoRequest) IsProxyTrusted() bool
- func (c *ContextNoRequest) Links(link ...string)
- func (c *ContextNoRequest) Locals(key interface{}, value ...interface{}) interface{}
- func (c *ContextNoRequest) Location(path string)
- func (c *ContextNoRequest) Method(override ...string) string
- func (c *ContextNoRequest) MultipartForm() (*multipart.Form, error)
- func (c *ContextNoRequest) Next() error
- func (c *ContextNoRequest) OriginalURL() string
- func (c *ContextNoRequest) Params(key string, defaultValue ...string) string
- func (c *ContextNoRequest) Path(override ...string) string
- func (c *ContextNoRequest) Port() string
- func (c *ContextNoRequest) Protocol() string
- func (c *ContextNoRequest) Queries() map[string]string
- func (c *ContextNoRequest) QueryInt(key string, defaultValue ...int) int
- func (c *ContextNoRequest) Range(size int) (fiber.Range, error)
- func (c *ContextNoRequest) Redirect(location string, status ...int) error
- func (c *ContextNoRequest) RedirectBack(fallback string, status ...int) error
- func (c *ContextNoRequest) RedirectToRoute(routeName string, params fiber.Map, status ...int) error
- func (c *ContextNoRequest) Render(name string, bind interface{}, layouts ...string) error
- func (c *ContextNoRequest) Request() *fasthttp.Request
- func (c *ContextNoRequest) RequestContext() *fasthttp.RequestCtx
- func (c *ContextNoRequest) Requests() (any, error)
- func (c *ContextNoRequest) Response() *fasthttp.Response
- func (c *ContextNoRequest) RestartRouting() error
- func (c *ContextNoRequest) SaveFile(file *multipart.FileHeader, path string) error
- func (c *ContextNoRequest) SaveFileToStorage(fileheader *multipart.FileHeader, path string, storage fiber.Storage) error
- func (c *ContextNoRequest) Secure() bool
- func (c *ContextNoRequest) Set(key string, val string)
- func (c *ContextNoRequest) SetUserContext(ctx context.Context)
- func (c *ContextNoRequest) Stale() bool
- func (c *ContextNoRequest) Status(status int) Context[any]
- func (c *ContextNoRequest) String() string
- func (c *ContextNoRequest) Subdomains(offset ...int) []string
- func (c *ContextNoRequest) Type(extension string, charset ...string) Context[any]
- func (c *ContextNoRequest) Vary(fields ...string)
- func (c *ContextNoRequest) XHR() bool
- type ContextWithRequest
- type OpenAPIConfig
- type Route
- func Connect[ResponseBody, Request any, Contexted Context[Request]](app *App, path string, controller func(Contexted) (ResponseBody, error), ...) Route[ResponseBody, Request]
- func Delete[ResponseBody, Request any, Contexted Context[Request]](app *App, path string, controller func(Contexted) (ResponseBody, error), ...) Route[ResponseBody, Request]
- func Get[ResponseBody, Request any, Contexted Context[Request]](app *App, path string, controller func(Contexted) (ResponseBody, error), ...) Route[ResponseBody, Request]
- func Head[ResponseBody, Request any, Contexted Context[Request]](app *App, path string, controller func(Contexted) (ResponseBody, error), ...) Route[ResponseBody, Request]
- func Options[ResponseBody, Request any, Contexted Context[Request]](app *App, path string, controller func(Contexted) (ResponseBody, error), ...) Route[ResponseBody, Request]
- func Patch[ResponseBody, Request any, Contexted Context[Request]](app *App, path string, controller func(Contexted) (ResponseBody, error), ...) Route[ResponseBody, Request]
- func Post[ResponseBody, Request any, Contexted Context[Request]](app *App, path string, controller func(Contexted) (ResponseBody, error), ...) Route[ResponseBody, Request]
- func Put[ResponseBody, Request any, Contexted Context[Request]](app *App, path string, controller func(Contexted) (ResponseBody, error), ...) Route[ResponseBody, Request]
- func Trace[ResponseBody, Request any, Contexted Context[Request]](app *App, path string, controller func(Contexted) (ResponseBody, error), ...) Route[ResponseBody, Request]
- func (r Route[ResponseBody, Request]) AddTags(tags ...string) Route[ResponseBody, Request]
- func (r Route[ResponseBody, Request]) Deprecated() Route[ResponseBody, Request]
- func (r Route[ResponseBody, Request]) Description(description string) Route[ResponseBody, Request]
- func (r Route[ResponseBody, Request]) OperationID(operationID string) Route[ResponseBody, Request]
- func (r Route[ResponseBody, Request]) SetResponseContentType(contentType string) Route[ResponseBody, Request]
- func (r Route[ResponseBody, Request]) Summary(summary string) Route[ResponseBody, Request]
Constants ¶
View Source
const ( StatusContinue = 100 // RFC 7231, 6.2.1 StatusSwitchingProtocols = 101 // RFC 7231, 6.2.2 StatusProcessing = 102 // RFC 2518, 10.1 StatusEarlyHints = 103 // RFC 8297 StatusOK = 200 // RFC 7231, 6.3.1 StatusCreated = 201 // RFC 7231, 6.3.2 StatusAccepted = 202 // RFC 7231, 6.3.3 StatusNonAuthoritativeInfo = 203 // RFC 7231, 6.3.4 StatusNoContent = 204 // RFC 7231, 6.3.5 StatusResetContent = 205 // RFC 7231, 6.3.6 StatusPartialContent = 206 // RFC 7233, 4.1 StatusMultiStatus = 207 // RFC 4918, 11.1 StatusAlreadyReported = 208 // RFC 5842, 7.1 StatusIMUsed = 226 // RFC 3229, 10.4.1 StatusMultipleChoices = 300 // RFC 7231, 6.4.1 StatusMovedPermanently = 301 // RFC 7231, 6.4.2 StatusFound = 302 // RFC 7231, 6.4.3 StatusSeeOther = 303 // RFC 7231, 6.4.4 StatusNotModified = 304 // RFC 7232, 4.1 StatusUseProxy = 305 // RFC 7231, 6.4.5 StatusTemporaryRedirect = 307 // RFC 7231, 6.4.7 StatusPermanentRedirect = 308 // RFC 7538, 3 StatusBadRequest = 400 // RFC 7231, 6.5.1 StatusPaymentRequired = 402 // RFC 7231, 6.5.2 StatusForbidden = 403 // RFC 7231, 6.5.3 StatusNotFound = 404 // RFC 7231, 6.5.4 StatusMethodNotAllowed = 405 // RFC 7231, 6.5.5 StatusNotAcceptable = 406 // RFC 7231, 6.5.6 StatusProxyAuthRequired = 407 // RFC 7235, 3.2 StatusRequestTimeout = 408 // RFC 7231, 6.5.7 StatusConflict = 409 // RFC 7231, 6.5.8 StatusGone = 410 // RFC 7231, 6.5.9 StatusLengthRequired = 411 // RFC 7231, 6.5.10 StatusPreconditionFailed = 412 // RFC 7232, 4.2 StatusRequestEntityTooLarge = 413 // RFC 7231, 6.5.11 StatusRequestURITooLong = 414 // RFC 7231, 6.5.12 StatusUnsupportedMediaType = 415 // RFC 7231, 6.5.13 StatusRequestedRangeNotSatisfiable = 416 // RFC 7233, 4.4 StatusExpectationFailed = 417 // RFC 7231, 6.5.14 StatusTeapot = 418 // RFC 7168, 2.3.3 StatusMisdirectedRequest = 421 // RFC 7540, 9.1.2 StatusUnprocessableEntity = 422 // RFC 4918, 11.2 StatusLocked = 423 // RFC 4918, 11.3 StatusFailedDependency = 424 // RFC 4918, 11.4 StatusUpgradeRequired = 426 // RFC 7231, 6.5.15 StatusPreconditionRequired = 428 // RFC 6585, 3 StatusTooManyRequests = 429 // RFC 6585, 4 StatusRequestHeaderFieldsTooLarge = 431 // RFC 6585, 5 StatusInternalServerError = 500 // RFC 7231, 6.6.1 StatusNotImplemented = 501 // RFC 7231, 6.6.2 StatusBadGateway = 502 // RFC 7231, 6.6.3 StatusGatewayTimeout = 504 // RFC 7231, 6.6.5 StatusHTTPVersionNotSupported = 505 // RFC 7231, 6.6.6 StatusVariantAlsoNegotiates = 506 // RFC 2295, 8.1 StatusInsufficientStorage = 507 // RFC 4918, 11.5 StatusLoopDetected = 508 // RFC 5842, 7.2 StatusNotExtended = 510 // RFC 2774, 7 StatusNetworkAuthenticationRequired = 511 // RFC 6585, 6 )
HTTP status codes were stolen from net/http.
Variables ¶
This section is empty.
Functions ¶
func DefaultOpenAPIHandler ¶
func NewOpenAPISpec ¶
func StatusMessage ¶
StatusMessage returns HTTP status message for the given status code.
Types ¶
type App ¶
type App struct {
*fiber.App
OpenAPISpec openapi3.T
OpenAPIConfig OpenAPIConfig
Serializer func(ctx *fasthttp.RequestCtx, response any) error
// contains filtered or unexported fields
}
func (*App) AddTags ¶
AddTags adds tags from the Server (i.e Group) Tags from the parent Groups will be respected
func (*App) Description ¶
Description sets the description of the OpenAPI spec
func (*App) SaveOpenAPISpec ¶
SaveOpenAPISpec saves the OpenAPI spec to a file in YAML format
type Context ¶
type Context[Request any] interface { Context() context.Context Requests() (Request, error) Accepts(offers ...string) string AcceptsCharsets(offers ...string) string AcceptsEncodings(offers ...string) string AcceptsLanguages(offers ...string) string App() *App Append(field string, values ...string) Attachment(filename ...string) BaseURL() string BodyRaw() []byte ClearCookie(key ...string) RequestContext() *fasthttp.RequestCtx SetUserContext(ctx context.Context) Cookie(cookie *fiber.Cookie) Cookies(key string, defaultValue ...string) string Download(file string, filename ...string) error Request() *fasthttp.Request Response() *fasthttp.Response Format(body interface{}) error FormFile(key string) (*multipart.FileHeader, error) FormValue(key string, defaultValue ...string) string Fresh() bool Get(key string, defaultValue ...string) string GetReqHeaders() map[string][]string GetRespHeaders() map[string][]string Hostname() string Port() string IP() string IPs() []string Is(extension string) bool Links(link ...string) Locals(key interface{}, value ...interface{}) interface{} Location(path string) Method(override ...string) string MultipartForm() (*multipart.Form, error) ClientHelloInfo() *tls.ClientHelloInfo Next() error RestartRouting() error OriginalURL() string AllParams() map[string]string Path(override ...string) string Protocol() string Queries() map[string]string Range(size int) (fiber.Range, error) Redirect(location string, status ...int) error Bind(vars fiber.Map) error GetRouteURL(routeName string, params fiber.Map) (string, error) RedirectToRoute(routeName string, params fiber.Map, status ...int) error RedirectBack(fallback string, status ...int) error Render(name string, bind interface{}, layouts ...string) error SaveFile(fileheader *multipart.FileHeader, path string) error SaveFileToStorage(fileheader *multipart.FileHeader, path string, storage fiber.Storage) error Secure() bool Set(key string, val string) Subdomains(offset ...int) []string Stale() bool Status(status int) Context[Request] String() string // Type sets the Content-Type response header with the given type and charset. Type(extension string, charset ...string) Context[Request] Vary(fields ...string) XHR() bool IsProxyTrusted() bool IsFromLocal() bool }
type ContextNoRequest ¶
type ContextNoRequest struct {
// contains filtered or unexported fields
}
func (*ContextNoRequest) Accepts ¶
func (c *ContextNoRequest) Accepts(offers ...string) string
func (*ContextNoRequest) AcceptsCharsets ¶
func (c *ContextNoRequest) AcceptsCharsets(offers ...string) string
func (*ContextNoRequest) AcceptsEncodings ¶
func (c *ContextNoRequest) AcceptsEncodings(offers ...string) string
func (*ContextNoRequest) AcceptsLanguages ¶
func (c *ContextNoRequest) AcceptsLanguages(offers ...string) string
func (*ContextNoRequest) AllParams ¶
func (c *ContextNoRequest) AllParams() map[string]string
func (*ContextNoRequest) App ¶
func (c *ContextNoRequest) App() *App
func (*ContextNoRequest) Append ¶
func (c *ContextNoRequest) Append(field string, values ...string)
func (*ContextNoRequest) Attachment ¶
func (c *ContextNoRequest) Attachment(filename ...string)
func (*ContextNoRequest) BaseURL ¶
func (c *ContextNoRequest) BaseURL() string
func (*ContextNoRequest) BodyRaw ¶
func (c *ContextNoRequest) BodyRaw() []byte
func (*ContextNoRequest) ClearCookie ¶
func (c *ContextNoRequest) ClearCookie(key ...string)
func (*ContextNoRequest) ClientHelloInfo ¶
func (c *ContextNoRequest) ClientHelloInfo() *tls.ClientHelloInfo
func (*ContextNoRequest) Context ¶
func (c *ContextNoRequest) Context() context.Context
func (*ContextNoRequest) Cookie ¶
func (c *ContextNoRequest) Cookie(cookie *fiber.Cookie)
func (*ContextNoRequest) Cookies ¶
func (c *ContextNoRequest) Cookies(key string, defaultValue ...string) string
func (*ContextNoRequest) Download ¶
func (c *ContextNoRequest) Download(file string, filename ...string) error
func (*ContextNoRequest) FormFile ¶
func (c *ContextNoRequest) FormFile(key string) (*multipart.FileHeader, error)
func (*ContextNoRequest) FormValue ¶
func (c *ContextNoRequest) FormValue(key string, defaultValue ...string) string
func (*ContextNoRequest) Format ¶
func (c *ContextNoRequest) Format(body interface{}) error
func (*ContextNoRequest) Fresh ¶
func (c *ContextNoRequest) Fresh() bool
func (*ContextNoRequest) Get ¶
func (c *ContextNoRequest) Get(key string, defaultValue ...string) string
func (*ContextNoRequest) GetReqHeaders ¶
func (c *ContextNoRequest) GetReqHeaders() map[string][]string
func (*ContextNoRequest) GetRespHeaders ¶
func (c *ContextNoRequest) GetRespHeaders() map[string][]string
func (*ContextNoRequest) GetRouteURL ¶
func (*ContextNoRequest) Hostname ¶
func (c *ContextNoRequest) Hostname() string
func (*ContextNoRequest) IP ¶
func (c *ContextNoRequest) IP() string
func (*ContextNoRequest) IPs ¶
func (c *ContextNoRequest) IPs() []string
func (*ContextNoRequest) Is ¶
func (c *ContextNoRequest) Is(extension string) bool
func (*ContextNoRequest) IsFromLocal ¶
func (c *ContextNoRequest) IsFromLocal() bool
func (*ContextNoRequest) IsProxyTrusted ¶
func (c *ContextNoRequest) IsProxyTrusted() bool
func (*ContextNoRequest) Links ¶
func (c *ContextNoRequest) Links(link ...string)
func (*ContextNoRequest) Locals ¶
func (c *ContextNoRequest) Locals(key interface{}, value ...interface{}) interface{}
func (*ContextNoRequest) Location ¶
func (c *ContextNoRequest) Location(path string)
func (*ContextNoRequest) Method ¶
func (c *ContextNoRequest) Method(override ...string) string
func (*ContextNoRequest) MultipartForm ¶
func (c *ContextNoRequest) MultipartForm() (*multipart.Form, error)
func (*ContextNoRequest) Next ¶
func (c *ContextNoRequest) Next() error
func (*ContextNoRequest) OriginalURL ¶
func (c *ContextNoRequest) OriginalURL() string
func (*ContextNoRequest) Params ¶
func (c *ContextNoRequest) Params(key string, defaultValue ...string) string
func (*ContextNoRequest) Path ¶
func (c *ContextNoRequest) Path(override ...string) string
func (*ContextNoRequest) Port ¶
func (c *ContextNoRequest) Port() string
func (*ContextNoRequest) Protocol ¶
func (c *ContextNoRequest) Protocol() string
func (*ContextNoRequest) Queries ¶
func (c *ContextNoRequest) Queries() map[string]string
func (*ContextNoRequest) QueryInt ¶
func (c *ContextNoRequest) QueryInt(key string, defaultValue ...int) int
func (*ContextNoRequest) Redirect ¶
func (c *ContextNoRequest) Redirect(location string, status ...int) error
func (*ContextNoRequest) RedirectBack ¶
func (c *ContextNoRequest) RedirectBack(fallback string, status ...int) error
func (*ContextNoRequest) RedirectToRoute ¶
func (*ContextNoRequest) Render ¶
func (c *ContextNoRequest) Render(name string, bind interface{}, layouts ...string) error
func (*ContextNoRequest) Request ¶
func (c *ContextNoRequest) Request() *fasthttp.Request
func (*ContextNoRequest) RequestContext ¶
func (c *ContextNoRequest) RequestContext() *fasthttp.RequestCtx
func (*ContextNoRequest) Requests ¶
func (c *ContextNoRequest) Requests() (any, error)
func (*ContextNoRequest) Response ¶
func (c *ContextNoRequest) Response() *fasthttp.Response
func (*ContextNoRequest) RestartRouting ¶
func (c *ContextNoRequest) RestartRouting() error
func (*ContextNoRequest) SaveFile ¶
func (c *ContextNoRequest) SaveFile(file *multipart.FileHeader, path string) error
func (*ContextNoRequest) SaveFileToStorage ¶
func (c *ContextNoRequest) SaveFileToStorage(fileheader *multipart.FileHeader, path string, storage fiber.Storage) error
func (*ContextNoRequest) Secure ¶
func (c *ContextNoRequest) Secure() bool
func (*ContextNoRequest) Set ¶
func (c *ContextNoRequest) Set(key string, val string)
Set sets the response's HTTP header field to the specified key, value.
func (*ContextNoRequest) SetUserContext ¶
func (c *ContextNoRequest) SetUserContext(ctx context.Context)
func (*ContextNoRequest) Stale ¶
func (c *ContextNoRequest) Stale() bool
func (*ContextNoRequest) String ¶
func (c *ContextNoRequest) String() string
func (*ContextNoRequest) Subdomains ¶
func (c *ContextNoRequest) Subdomains(offset ...int) []string
func (*ContextNoRequest) Type ¶
func (c *ContextNoRequest) Type(extension string, charset ...string) Context[any]
func (*ContextNoRequest) Vary ¶
func (c *ContextNoRequest) Vary(fields ...string)
func (*ContextNoRequest) XHR ¶
func (c *ContextNoRequest) XHR() bool
type ContextWithRequest ¶
type ContextWithRequest[Request any] struct { ContextNoRequest }
func (*ContextWithRequest[Request]) Requests ¶
func (c *ContextWithRequest[Request]) Requests() (Request, error)
func (*ContextWithRequest[Request]) Status ¶
func (c *ContextWithRequest[Request]) Status(status int) Context[Request]
type OpenAPIConfig ¶
type OpenAPIConfig struct {
DisableSwagger bool // If true, the server will not serve the swagger ui nor the openapi json spec
DisableLocalSave bool // If true, the server will not save the openapi json spec locally
SwaggerURL string // URL to serve the swagger ui
UIHandler func(specURL string) fiber.Handler // Handler to serve the openapi ui from spec url
YamlURL string // Local path to save the openapi json spec
}
type Route ¶
type Route[T, B any] struct { // contains filtered or unexported fields }
func (Route[ResponseBody, Request]) Deprecated ¶
func (Route[ResponseBody, Request]) Description ¶
func (Route[ResponseBody, Request]) OperationID ¶
func (Route[ResponseBody, Request]) SetResponseContentType ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.