Documentation
¶
Index ¶
- Constants
- Variables
- type Context
- func (c *Context) Data(code int, data []byte)
- func (c *Context) Fail(code int, err string)
- func (c *Context) Get(key string) (value interface{}, ok bool)
- func (c *Context) GetBool(key string) (b bool, ok bool)
- func (c *Context) GetDuration(key string) (d time.Duration, ok bool)
- func (c *Context) GetFloat64(key string) (f64 float64, ok bool)
- func (c *Context) GetInt(key string) (i int, ok bool)
- func (c *Context) GetInt64(key string) (i64 int64, ok bool)
- func (c *Context) GetString(key string) (s string, ok bool)
- func (c *Context) GetStringMap(key string) (sm map[string]interface{}, ok bool)
- func (c *Context) GetStringMapString(key string) (sms map[string]string, ok bool)
- func (c *Context) GetStringMapStringSlice(key string) (smss map[string][]string, ok bool)
- func (c *Context) GetStringSlice(key string) (ss []string, ok bool)
- func (c *Context) GetTime(key string) (t time.Time, ok bool)
- func (c *Context) GetUint(key string) (ui uint, ok bool)
- func (c *Context) GetUint64(key string) (ui64 uint64, ok bool)
- func (c *Context) HTML(code int, name string, data interface{})
- func (c *Context) JSON(code int, obj interface{})
- func (c *Context) MustGet(key string) interface{}
- func (c *Context) Next()
- func (c *Context) Param(key string) string
- func (c *Context) PostForm(key string) string
- func (c *Context) Query(key string)
- func (c *Context) Set(key string, value interface{})
- func (c *Context) SetHeader(key string, value string)
- func (c *Context) Status(statusCode int)
- func (c *Context) String(code int, format string, values ...interface{})
- type Engine
- func (e *Engine) DELETE(pattern string, handlers ...HandlerFunc)
- func (e *Engine) GET(pattern string, handlers ...HandlerFunc)
- func (e *Engine) HEAD(pattern string, handlers ...HandlerFunc)
- func (e *Engine) LoadHTMLGlob(pattern string)
- func (e *Engine) POST(pattern string, handlers ...HandlerFunc)
- func (e *Engine) PUT(pattern string, handlers ...HandlerFunc)
- func (e *Engine) Run(addr string) (err error)
- func (e *Engine) ServeHTTP(writer http.ResponseWriter, request *http.Request)
- func (e *Engine) SetFuncMap(funcMap template.FuncMap)
- type HandlerFunc
- type IRouter
- type RouterGroup
- func (rg *RouterGroup) DELETE(pattern string, handlers ...HandlerFunc)
- func (rg *RouterGroup) GET(pattern string, handlers ...HandlerFunc)
- func (rg *RouterGroup) Group(prefix string) *RouterGroup
- func (rg *RouterGroup) HEAD(pattern string, handlers ...HandlerFunc)
- func (rg *RouterGroup) POST(pattern string, handlers ...HandlerFunc)
- func (rg *RouterGroup) PUT(pattern string, handlers ...HandlerFunc)
- func (rg *RouterGroup) Static(relativePath string, root string)
- func (rg *RouterGroup) Use(middlewares ...HandlerFunc)
- type Z
Constants ¶
View Source
const ( GET = "GET" HEAD = "HEAD" POST = "POST" PUT = "PUT" PATCH = "PATCH" // RFC 5789 DELETE = "DELETE" CONNECT = "CONNECT" OPTIONS = "OPTIONS" TRACE = "TRACE" )
支持的请求方式
Variables ¶
View Source
var (
NotFoundError = errors.New("404 NOT FOUND")
)
Functions ¶
This section is empty.
Types ¶
type Context ¶
type Context struct {
// request info
Req *http.Request // 请求
Path string //路径
Method string // 请求方式
Params map[string]string // 路径参数
StatusCode int
// response info
Res http.ResponseWriter //返回
// contains filtered or unexported fields
}
func (*Context) GetDuration ¶
GetDuration 返回与键关联的时间间隔值.
func (*Context) GetFloat64 ¶
GetFloat64 返回与值关联的双精度浮点数
func (*Context) GetStringMap ¶
GetStringMap 返回与键关联的值作为接口映射.
func (*Context) GetStringMapString ¶
GetStringMapString 返回与键关联的值作为字符串映射.
func (*Context) GetStringMapStringSlice ¶
GetStringMapStringSlice 返回与键关联的值,作为映射到字符串切片的映射.
func (*Context) GetStringSlice ¶
GetStringSlice 返回与键关联的切片字符串值.
type Engine ¶
type Engine struct {
*RouterGroup
// contains filtered or unexported fields
}
Engine implement the interface of ServeHTTP
func (*Engine) DELETE ¶
func (e *Engine) DELETE(pattern string, handlers ...HandlerFunc)
func (*Engine) GET ¶
func (e *Engine) GET(pattern string, handlers ...HandlerFunc)
func (*Engine) HEAD ¶
func (e *Engine) HEAD(pattern string, handlers ...HandlerFunc)
func (*Engine) LoadHTMLGlob ¶
func (*Engine) POST ¶
func (e *Engine) POST(pattern string, handlers ...HandlerFunc)
func (*Engine) PUT ¶
func (e *Engine) PUT(pattern string, handlers ...HandlerFunc)
func (*Engine) ServeHTTP ¶
func (e *Engine) ServeHTTP(writer http.ResponseWriter, request *http.Request)
func (*Engine) SetFuncMap ¶
type HandlerFunc ¶
type HandlerFunc func(ctx *Context)
HandlerFunc defines the request handler used by gee
func LoggerDefault ¶
func LoggerDefault() HandlerFunc
func Recovery ¶
func Recovery() HandlerFunc
type IRouter ¶
type IRouter interface {
GET(pattern string, handlers ...HandlerFunc)
POST(pattern string, handlers ...HandlerFunc)
PUT(pattern string, handlers ...HandlerFunc)
DELETE(pattern string, handlers ...HandlerFunc)
HEAD(pattern string, handlers ...HandlerFunc)
}
type RouterGroup ¶
type RouterGroup struct {
// contains filtered or unexported fields
}
分组路由
func (*RouterGroup) DELETE ¶
func (rg *RouterGroup) DELETE(pattern string, handlers ...HandlerFunc)
DELETE 添加DELETE路由
func (*RouterGroup) GET ¶
func (rg *RouterGroup) GET(pattern string, handlers ...HandlerFunc)
GET 添加GET路由
func (*RouterGroup) Group ¶
func (rg *RouterGroup) Group(prefix string) *RouterGroup
func (*RouterGroup) HEAD ¶
func (rg *RouterGroup) HEAD(pattern string, handlers ...HandlerFunc)
HEAD 添加HEAD路由
func (*RouterGroup) POST ¶
func (rg *RouterGroup) POST(pattern string, handlers ...HandlerFunc)
POST 添加POST路由
func (*RouterGroup) PUT ¶
func (rg *RouterGroup) PUT(pattern string, handlers ...HandlerFunc)
PUT 添加PUT路由
func (*RouterGroup) Static ¶
func (rg *RouterGroup) Static(relativePath string, root string)
serve static files
func (*RouterGroup) Use ¶
func (rg *RouterGroup) Use(middlewares ...HandlerFunc)
Click to show internal directories.
Click to hide internal directories.