Documentation
¶
Index ¶
- func InitializeCacneCleanup()
- type CachedFieldInfo
- type Context
- func (c *Context) Handler() HandlerFunc
- func (c *Context) HandlerName() string
- func (c *Context) HandlerNames() []string
- func (c *Context) Next()
- func (c *Context) Reset()
- func (c *Context) ShouldBind(obj interface{}) error
- func (c *Context) ShouldBindBodyWith(obj interface{}, bb binding.BindingBody) (err error)
- func (c *Context) ShouldBindBodyWithJSON(obj interface{}) error
- func (c *Context) ShouldBindBodyWithPlain(obj interface{}) error
- func (c *Context) ShouldBindBodyWithTOML(obj interface{}) error
- func (c *Context) ShouldBindBodyWithXML(obj interface{}) error
- func (c *Context) ShouldBindBodyWithYAML(obj interface{}) error
- func (c *Context) ShouldBindHeader(obj interface{}) error
- func (c *Context) ShouldBindJSON(obj interface{}) error
- func (c *Context) ShouldBindPlain(obj interface{}) error
- func (c *Context) ShouldBindQuery(obj interface{}) error
- func (c *Context) ShouldBindTOML(obj interface{}) error
- func (c *Context) ShouldBindUri(obj interface{}) error
- func (c *Context) ShouldBindWith(obj interface{}, b binding.Binding) error
- func (c *Context) ShouldBindXML(obj interface{}) error
- func (c *Context) ShouldBindYAML(obj interface{}) error
- type Engine
- func (engine *Engine) DELETE(relativePath string, handlers ...HandlerFunc)
- func (engine *Engine) GET(relativePath string, handlers ...HandlerFunc)
- func (engine *Engine) Handle(httpMethod string, relativePath string, handlers ...HandlerFunc)
- func (engine *Engine) OPTIONS(relativePath string, handlers ...HandlerFunc)
- func (engine *Engine) PATCH(relativePath string, handlers ...HandlerFunc)
- func (engine *Engine) POST(relativePath string, handlers ...HandlerFunc)
- func (engine *Engine) PUT(relativePath string, handlers ...HandlerFunc)
- func (engine *Engine) With(opts ...OptionFunc) *Engine
- type HandlerChain
- type HandlerFunc
- type HookManager
- type HookType
- type OptionFunc
- type RouteDefinition
- type RouterGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func InitializeCacneCleanup ¶
func InitializeCacneCleanup()
Types ¶
type CachedFieldInfo ¶
type Context ¶
func (*Context) HandlerName ¶
HandlerName returns the main handler's name. For example if the handler is "handleGetUsers()", this function will return "main.handleGetUsers".
func (*Context) HandlerNames ¶
HandlerNames returns a list of all registered handlers for this context in descending order, following the semantics of HandlerName()
func (*Context) Next ¶
func (c *Context) Next()
Next is a convenience method to call Next on the underlying gin.Context
func (*Context) ShouldBind ¶
ShouldBind checks the Method and Content-Type to select a binding engine automatically, Depending on the "Content-Type" header different bindings are used, for example:
"application/json" --> JSON binding "application/xml" --> XML binding
It parses the request's body as JSON if Content-Type == "application/json" using JSON or XML as a JSON input. It decodes the json payload into the struct specified as a pointer. Like c.Bind() but this method does not set the response status code to 400 or abort if input is not valid.
func (*Context) ShouldBindBodyWith ¶
func (c *Context) ShouldBindBodyWith(obj interface{}, bb binding.BindingBody) (err error)
ShouldBindBodyWith is similar with ShouldBindWith, but it stores the request body into the context, and reuse when it is called again.
NOTE: This method reads the body before binding. So you should use ShouldBindWith for better performance if you need to call only once.
func (*Context) ShouldBindBodyWithJSON ¶
ShouldBindBodyWithJSON is a shortcut for c.ShouldBindBodyWith(obj, binding.JSON).
func (*Context) ShouldBindBodyWithPlain ¶
ShouldBindBodyWithPlain is a shortcut for c.ShouldBindBodyWith(obj, binding.Plain).
func (*Context) ShouldBindBodyWithTOML ¶
ShouldBindBodyWithTOML is a shortcut for c.ShouldBindBodyWith(obj, binding.TOML).
func (*Context) ShouldBindBodyWithXML ¶
ShouldBindBodyWithXML is a shortcut for c.ShouldBindBodyWith(obj, binding.XML).
func (*Context) ShouldBindBodyWithYAML ¶
ShouldBindBodyWithYAML is a shortcut for c.ShouldBindBodyWith(obj, binding.YAML).
func (*Context) ShouldBindHeader ¶
ShouldBindHeader is a shortcut for c.ShouldBindWith(obj, binding.Header).
func (*Context) ShouldBindJSON ¶
ShouldBindJSON is a shortcut for c.ShouldBindWith(obj, binding.JSON).
func (*Context) ShouldBindPlain ¶
ShouldBindPlain is a shortcut for c.ShouldBindWith(obj, binding.Plain).
func (*Context) ShouldBindQuery ¶
ShouldBindQuery is a shortcut for c.ShouldBindWith(obj, binding.Query).
func (*Context) ShouldBindTOML ¶
ShouldBindTOML is a shortcut for c.ShouldBindWith(obj, binding.TOML).
func (*Context) ShouldBindUri ¶
ShouldBindUri binds the passed struct pointer using the specified binding engine.
func (*Context) ShouldBindWith ¶
ShouldBindWith binds the passed struct pointer using the specified binding engine. See the binding package.
func (*Context) ShouldBindXML ¶
ShouldBindXML is a shortcut for c.ShouldBindWith(obj, binding.XML).
func (*Context) ShouldBindYAML ¶
ShouldBindYAML is a shortcut for c.ShouldBindWith(obj, binding.YAML).
type Engine ¶
func Default ¶
func Default(opts ...OptionFunc) *Engine
Default returns an Engine instance with the Logger and Recovery middleware already attached.
func New ¶
func New(opts ...OptionFunc) *Engine
New returns a new blank Engine instance without any middleware attached. By default, the configuration is: - RedirectTrailingSlash: true - RedirectFixedPath: false - HandleMethodNotAllowed: false - ForwardedByClientIP: true - UseRawPath: false - UnescapePathValues: true
func (*Engine) DELETE ¶
func (engine *Engine) DELETE(relativePath string, handlers ...HandlerFunc)
func (*Engine) GET ¶
func (engine *Engine) GET(relativePath string, handlers ...HandlerFunc)
func (*Engine) Handle ¶
func (engine *Engine) Handle(httpMethod string, relativePath string, handlers ...HandlerFunc)
func (*Engine) OPTIONS ¶
func (engine *Engine) OPTIONS(relativePath string, handlers ...HandlerFunc)
func (*Engine) PATCH ¶
func (engine *Engine) PATCH(relativePath string, handlers ...HandlerFunc)
func (*Engine) POST ¶
func (engine *Engine) POST(relativePath string, handlers ...HandlerFunc)
func (*Engine) PUT ¶
func (engine *Engine) PUT(relativePath string, handlers ...HandlerFunc)
func (*Engine) With ¶
func (engine *Engine) With(opts ...OptionFunc) *Engine
type HandlerChain ¶
type HandlerChain []HandlerFunc
type HandlerFunc ¶
type HandlerFunc func(*Context)
type HookManager ¶
type HookManager struct {
// contains filtered or unexported fields
}
HookManager manages hooks for different lifecycle events
func (*HookManager) RegisterHook ¶
func (m *HookManager) RegisterHook(hookType HookType, hook HandlerFunc)
RegisterHook adds a hook for a specific lifecycle event
type HookType ¶
type HookType int
HookType represents different hook points in the request lifecycle
type OptionFunc ¶
type OptionFunc func(*Engine)
type RouteDefinition ¶
type RouteDefinition struct {
Method string
Path string
RequestHandler HandlerFunc
PreRequestMiddleware HandlerChain
PostRequestMiddleware HandlerChain
Description string
Tags []string
}
type RouterGroup ¶
type RouterGroup struct {
*gin.RouterGroup
}