Documentation
¶
Index ¶
- type Context
- func (c *Context) ReqBody(v any) error
- func (c *Context) ReqParam(key string) string
- func (c *Context) ReqQuery(key string) string
- func (c *Context) ResAddHeader(key string, val string)
- func (c *Context) ResFlex(code int, typ string, message string) error
- func (c *Context) ResJson(code int, obj interface{}) error
- func (c *Context) ResSetStatuscode(code int)
- func (c *Context) ResString(code int, message string) error
- type Engine
- type H
- type HandlerFunc
- type RouterGroup
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// origin objects
Writer http.ResponseWriter
Req *http.Request
// request info
Path string
Method string
// response info
StatusCode int
// get path params
Params map[string]string
}
func NewContext ¶
func NewContext(w http.ResponseWriter, req *http.Request) *Context
func (*Context) ResAddHeader ¶
func (*Context) ResSetStatuscode ¶
type Engine ¶
type Engine struct {
*RouterGroup
// contains filtered or unexported fields
}
type HandlerFunc ¶
type RouterGroup ¶
type RouterGroup struct {
// contains filtered or unexported fields
}
func (*RouterGroup) GET ¶
func (group *RouterGroup) GET(pattern string, handler HandlerFunc)
GET defines the method to add GET request
func (*RouterGroup) Group ¶
func (group *RouterGroup) Group(prefix string) *RouterGroup
Group is defined to create a new RouterGroup remember all groups share the same Engine instance
func (*RouterGroup) POST ¶
func (group *RouterGroup) POST(pattern string, handler HandlerFunc)
POST defines the method to add POST request
Click to show internal directories.
Click to hide internal directories.