Documentation ¶
Index ¶
- Constants
- func CreateMiddlewareRequestLog(statics []*fs.StaticFs) func(c *Context) error
- func GetHandlerInfo(handler Handler, logger logger.Logger, resources ...*fs.Resource) (string, []fiber.Handler)
- func MiddlewareCookie(c *Context) error
- func MiddlewareCors(c *Context) error
- func MiddlewareRecover(c *Context) error
- func MiddlewareRequestID(c *Context) error
- func RegisterResourceRoutes(resources []*fs.Resource, router *Router, getHooks func() *fs.Hooks)
- func TransformHandlers(r *fs.Resource, handlers []Handler, l logger.Logger) []fiber.Handler
- func WSResourceHandler(r *fs.Resource, hooks *fs.Hooks, router *Router)
- type BaseContext
- type Config
- type Context
- func (c *Context) Arg(name string, defaults ...string) string
- func (c *Context) ArgInt(name string, defaults ...int) int
- func (c *Context) Args() map[string]string
- func (c *Context) AuthToken() string
- func (c *Context) Base() string
- func (c *Context) Bind(v any) error
- func (c *Context) Cookie(name string, values ...*Cookie) string
- func (c *Context) Files() ([]*fs.File, error)
- func (c *Context) Header(key string, vals ...string) string
- func (c *Context) Hostname() string
- func (c *Context) JSON(v any) error
- func (c *Context) Local(key string, value ...any) (val any)
- func (c *Context) Logger() logger.Logger
- func (c *Context) Method() string
- func (c *Context) Next() error
- func (c *Context) OriginalURL() string
- func (c *Context) Path() string
- func (c *Context) Payload() (*schema.Entity, error)
- func (c *Context) Redirect(path string) error
- func (c *Context) Resource() *fs.Resource
- func (c *Context) Response() *Response
- func (c *Context) Result(results ...*fs.Result) *fs.Result
- func (c *Context) RouteName() string
- func (c *Context) Send(data []byte) error
- func (c *Context) Status(v int) *Context
- func (c *Context) TraceID() string
- func (c *Context) User() *fs.User
- func (c *Context) WSClient() fs.WSClient
- type Cookie
- type Handler
- type MethodData
- type ResolverConfig
- type Response
- type RestfulResolver
- type Router
- func (g *Router) Connect(path string, handler Handler, resources ...*fs.Resource)
- func (g *Router) Delete(path string, handler Handler, resources ...*fs.Resource)
- func (g *Router) Get(path string, handler Handler, resources ...*fs.Resource)
- func (g *Router) Group(prefix string, r *fs.Resource, handlers ...Handler) *Router
- func (g *Router) Head(path string, handler Handler, resources ...*fs.Resource)
- func (g *Router) Options(path string, handler Handler, resources ...*fs.Resource)
- func (g *Router) Patch(path string, handler Handler, resources ...*fs.Resource)
- func (g *Router) Post(path string, handler Handler, resources ...*fs.Resource)
- func (g *Router) Put(path string, handler Handler, resources ...*fs.Resource)
- func (g *Router) Trace(path string, handler Handler, resources ...*fs.Resource)
- func (g *Router) Use(handlers ...Handler)
- type Server
- func (s *Server) Connect(path string, handler Handler, resources ...*fs.Resource)
- func (s *Server) Delete(path string, handler Handler, resources ...*fs.Resource)
- func (s *Server) Get(path string, handler Handler, resources ...*fs.Resource)
- func (s *Server) Group(prefix string, r *fs.Resource, handlers ...Handler) *Router
- func (s *Server) Head(path string, handler Handler, resources ...*fs.Resource)
- func (s *Server) Listen(address string) error
- func (s *Server) Options(path string, handler Handler, resources ...*fs.Resource)
- func (s *Server) Patch(path string, handler Handler, resources ...*fs.Resource)
- func (s *Server) Post(path string, handler Handler, resources ...*fs.Resource)
- func (s *Server) Put(path string, handler Handler, resources ...*fs.Resource)
- func (s *Server) Static(prefix, root string, configs ...StaticConfig)
- func (s *Server) Test(req *http.Request, msTimeout ...int) (resp *http.Response, err error)
- func (s *Server) Trace(path string, handler Handler, resources ...*fs.Resource)
- func (s *Server) Use(handlers ...Handler)
- type StaticConfig
- type WSClient
- func (c *WSClient) Close(msgs ...string) error
- func (c *WSClient) CloseWithCode(code fs.WSCloseType, msg string) error
- func (c *WSClient) ID() string
- func (c *WSClient) IsCloseNormal(err error) bool
- func (c *WSClient) Read() (messageType fs.WSMessageType, p []byte, err error)
- func (c *WSClient) Write(data []byte, messageTypes ...fs.WSMessageType) error
- type WSContext
- func (c *WSContext) Arg(name string, defaults ...string) string
- func (c *WSContext) ArgInt(name string, defaults ...int) int
- func (c *WSContext) Local(key string, value ...any) (val any)
- func (c *WSContext) Locals(key string, defaults ...any) any
- func (c *WSContext) Logger() logger.Logger
- func (c *WSContext) TraceID() string
- func (c *WSContext) User() *fs.User
- func (c *WSContext) WSClient() fs.WSClient
Constants ¶
View Source
const HeaderRequestID = "X-Request-Id"
Variables ¶
This section is empty.
Functions ¶
func GetHandlerInfo ¶
func MiddlewareCookie ¶
func MiddlewareCors ¶
func MiddlewareRecover ¶
func MiddlewareRequestID ¶
func RegisterResourceRoutes ¶ added in v0.3.0
func TransformHandlers ¶
Types ¶
type BaseContext ¶ added in v0.3.0
type BaseContext = Context
type Config ¶
type Config struct { AppName string JSONEncoder utils.JSONMarshal Logger logger.Logger }
type Context ¶
type Context struct { *fiber.Ctx *fasthttp.RequestCtx // contains filtered or unexported fields }
func CreateContext ¶
func (*Context) OriginalURL ¶
type Cookie ¶
type Cookie struct { Name string `json:"name"` Value string `json:"value"` Path string `json:"path"` Domain string `json:"domain"` MaxAge int `json:"max_age"` Expires time.Time `json:"expires"` Secure bool `json:"secure"` HTTPOnly bool `json:"http_only"` SameSite string `json:"same_site"` SessionOnly bool `json:"session_only"` }
type Handler ¶
func TransformMiddlewares ¶ added in v0.3.0
func TransformMiddlewares(inputs []fs.Middleware) []Handler
type MethodData ¶
type MethodData struct { Path string Handler func(path string, handler Handler, resources ...*fs.Resource) }
func CreateHTTPHandlers ¶ added in v0.3.0
func CreateHTTPHandlers(router *Router, meta *fs.Meta) []MethodData
type ResolverConfig ¶ added in v0.3.0
type RestfulResolver ¶
type RestfulResolver struct {
// contains filtered or unexported fields
}
func NewRestfulResolver ¶
func NewRestfulResolver(config *ResolverConfig) *RestfulResolver
func (*RestfulResolver) Server ¶
func (r *RestfulResolver) Server() *Server
func (*RestfulResolver) Shutdown ¶
func (r *RestfulResolver) Shutdown() error
func (*RestfulResolver) Start ¶
func (r *RestfulResolver) Start(address string) error
type Router ¶
type Router struct { *fiber.App // contains filtered or unexported fields }
type Server ¶
type Server struct { *fiber.App // contains filtered or unexported fields }
func (*Server) Static ¶
func (s *Server) Static(prefix, root string, configs ...StaticConfig)
type StaticConfig ¶
type StaticConfig struct { Compress bool `json:"compress"` ByteRange bool `json:"byte_range"` Browse bool `json:"browse"` Download bool `json:"download"` Index string `json:"index"` CacheDuration time.Duration `json:"cache_duration"` // Default value 10 * time.Second. MaxAge int `json:"max_age"` // Default value 0 }
type WSClient ¶ added in v0.3.0
type WSClient struct {
// contains filtered or unexported fields
}
func NewWSClient ¶ added in v0.3.0
func (*WSClient) CloseWithCode ¶ added in v0.3.0
func (c *WSClient) CloseWithCode(code fs.WSCloseType, msg string) error
CloseWithCode closes the connection with the given code and message
func (*WSClient) IsCloseNormal ¶ added in v0.3.0
IsCloseNormal checks if the close error is a normal closure
type WSContext ¶ added in v0.3.0
type WSContext struct { *BaseContext // contains filtered or unexported fields }
func CreateWSContext ¶ added in v0.3.0
Click to show internal directories.
Click to hide internal directories.