Documentation ¶
Index ¶
- func GetAllFromBearerToken(ctx *Context, AccessSecret string) (user, ext string, err error)
- func GetAllFromToken(token, AccessSecret string) (user, ext string, err error)
- func GetBearerToken(ctx *Context) (string, error)
- func GetExtFromToken(token, AccessSecret string) (ext string, err error)
- func GetUserFromBearerToken(ctx *Context, AccessSecret string) (user string, err error)
- func GetUserFromToken(token, AccessSecret string) (user string, err error)
- type AppConfig
- type Context
- func (c *Context) Abort()
- func (c *Context) Bind(obj interface{}) error
- func (c *Context) BindQuery(dst interface{})
- func (c *Context) Body() (string, error)
- func (c *Context) BodyGetInt(key string) (int, error)
- func (c *Context) BodyGetInt64(key string) (int64, error)
- func (c *Context) BodyGetStr(key string) (string, error)
- func (c *Context) BodyGetUint(key string) (uint, error)
- func (c *Context) BodyGetUint64(key string) (uint64, error)
- func (c *Context) BodyJson(obj interface{}) error
- func (c *Context) DefaultQuery(key, def string) string
- func (c *Context) Error(code int, err error)
- func (c *Context) Fail(code int, msg string)
- func (c *Context) Form() url.Values
- func (c *Context) GetCache(AccessSecret string, Caches *xjcache.CacheMgr, key string) interface{}
- func (c *Context) GetCacheInt(AccessSecret string, Caches *xjcache.CacheMgr, key string) int
- func (c *Context) GetCacheInt64(AccessSecret string, Caches *xjcache.CacheMgr, key string) int64
- func (c *Context) GetCacheString(AccessSecret string, Caches *xjcache.CacheMgr, key string) string
- func (c *Context) GetHeader(key string) string
- func (c *Context) GetString(key string) string
- func (c *Context) JSON(code int, obj interface{})
- func (c *Context) Make(code int, rcode int, data interface{}, msg string)
- func (c *Context) MultipartForm() (*multipart.Form, error)
- func (c *Context) Next()
- func (c *Context) Param(key string) string
- func (c *Context) ParamFloat64(key string) (float64, error)
- func (c *Context) ParamInt(key string) (int, error)
- func (c *Context) ParamInt64(key string) (int64, error)
- func (c *Context) ParamUint64(key string) (uint64, error)
- func (c *Context) PathParam(index int) string
- func (c *Context) PathParamInt(index int) (int, error)
- func (c *Context) PathParamInt64(index int) (int64, error)
- func (c *Context) Query(key string) string
- func (c *Context) QueryAll() url.Values
- func (c *Context) QueryBool(key string) bool
- func (c *Context) QueryInt(key string) (int, error)
- func (c *Context) QueryInt64(key string) (int64, error)
- func (c *Context) QueryIntDefault(key string, def int) (int, error)
- func (c *Context) QueryMap() (m map[string]interface{})
- func (c *Context) QueryStr(key string) string
- func (c *Context) QueryStruct(dst interface{})
- func (c *Context) QueryUint32(key string) (uint32, error)
- func (c *Context) QueryUint32Default(key string, def uint32) (uint32, error)
- func (c *Context) QueryUint64(key string) (uint64, error)
- func (c *Context) QueryUint64Default(key string, def uint64) (uint64, error)
- func (c *Context) R(r xjtypes.R)
- func (c *Context) RCode(code int, r xjtypes.R)
- func (c *Context) String(code int, format string, values ...interface{})
- func (c *Context) Success(code int, data interface{})
- func (c *Context) TraceInfo(msg string)
- type Engine
- func (engine *Engine) DELETE(pattern, power string, handler func(*Context))
- func (engine *Engine) GET(pattern, power string, handler func(*Context))
- func (engine *Engine) GetRoute(mapRoute map[int]Route) Route
- func (engine *Engine) Group(group string) *RouterGroup
- func (engine *Engine) HEAD(pattern, power string, handler func(*Context))
- func (engine *Engine) HandleFunc(method, pattern, power string, handler func(*Context))
- func (engine *Engine) OPTIONS(pattern, power string, handler func(*Context))
- func (engine *Engine) PATCH(pattern, power string, handler func(*Context))
- func (engine *Engine) POST(pattern, power string, handler func(*Context))
- func (engine *Engine) PUT(pattern, power string, handler func(*Context))
- func (engine *Engine) PathMatch(path, pattern string) int
- func (engine *Engine) Redirect(relativePath, root string)
- func (engine *Engine) Run(address string) (err error)
- func (engine *Engine) ServeHTTP(w http.ResponseWriter, r *http.Request)
- func (engine *Engine) Static(relativePath, root string)
- func (engine *Engine) Use(handler func(*Context))
- type HandlerFunc
- type Route
- type RouterGroup
- func (group *RouterGroup) DELETE(pattern, power string, handler func(*Context))
- func (group *RouterGroup) GET(pattern, power string, handler func(*Context))
- func (group *RouterGroup) OPTIONS(pattern, power string, handler func(*Context))
- func (group *RouterGroup) POST(pattern, power string, handler func(*Context))
- func (group *RouterGroup) PUT(pattern, power string, handler func(*Context))
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAllFromBearerToken ¶ added in v0.7.4
func GetAllFromToken ¶ added in v0.7.4
func GetBearerToken ¶ added in v0.7.4
BearerToken格式为:bearer + token,取真正的token
func GetExtFromToken ¶ added in v0.7.4
func GetUserFromBearerToken ¶ added in v0.7.4
func GetUserFromToken ¶ added in v0.7.4
Types ¶
type AppConfig ¶ added in v0.0.8
type AppConfig struct { Profile string //dev,test,prod App xjtypes.App //服务的名称等 Register xjtypes.Register //如果服务都注册到ETCD,这个可以不要 Gateway xjtypes.Gateway //如果服务间的调用都通过rpc,这个可以不要 Config xjtypes.Config //如果配置使用本地配置文件, 这个可以不要 Etcd xjtypes.Etcd //http和rpc服务的注册管理 Auth xjtypes.Auth //jwt验证的密钥和有效时间 Datasource xjtypes.Datasource //数据源 Redis xjtypes.Redis //缓存 ElasticSearch xjtypes.ElasticSearch //es搜索 Nsq xjtypes.Nsq //NSQ消息 }
type Context ¶ added in v0.0.8
type Context struct { Request *http.Request Writer http.ResponseWriter CacheMgr *xjcache.CacheMgr // contains filtered or unexported fields }
func (*Context) BodyGetInt64 ¶ added in v0.7.4
func (*Context) BodyGetStr ¶ added in v0.7.4
func (*Context) BodyGetUint ¶ added in v0.7.4
func (*Context) BodyGetUint64 ¶ added in v0.7.4
func (*Context) DefaultQuery ¶ added in v0.7.4
func (*Context) GetCacheInt ¶ added in v0.7.4
func (*Context) GetCacheInt64 ¶ added in v0.7.4
func (*Context) GetCacheString ¶ added in v0.7.4
func (*Context) MultipartForm ¶ added in v0.7.4
func (*Context) ParamFloat64 ¶ added in v0.7.4
func (*Context) ParamInt64 ¶ added in v0.7.4
func (*Context) ParamUint64 ¶ added in v0.8.0
func (*Context) PathParamInt ¶ added in v0.1.7
func (*Context) PathParamInt64 ¶ added in v0.1.7
func (*Context) QueryInt64 ¶ added in v0.1.0
func (*Context) QueryIntDefault ¶ added in v0.1.5
func (*Context) QueryStruct ¶ added in v0.1.5
func (c *Context) QueryStruct(dst interface{})
func (*Context) QueryUint32 ¶ added in v0.7.9
func (*Context) QueryUint32Default ¶ added in v0.7.9
func (*Context) QueryUint64 ¶ added in v0.7.9
func (*Context) QueryUint64Default ¶ added in v0.7.9
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
func (*Engine) Group ¶ added in v0.7.4
func (engine *Engine) Group(group string) *RouterGroup
func (*Engine) HandleFunc ¶
type HandlerFunc ¶ added in v0.7.4
type HandlerFunc func(*Context)
type RouterGroup ¶ added in v0.7.4
type RouterGroup struct {
// contains filtered or unexported fields
}
func (*RouterGroup) DELETE ¶ added in v0.7.4
func (group *RouterGroup) DELETE(pattern, power string, handler func(*Context))
func (*RouterGroup) GET ¶ added in v0.7.4
func (group *RouterGroup) GET(pattern, power string, handler func(*Context))
func (*RouterGroup) OPTIONS ¶ added in v0.7.5
func (group *RouterGroup) OPTIONS(pattern, power string, handler func(*Context))
func (*RouterGroup) POST ¶ added in v0.7.4
func (group *RouterGroup) POST(pattern, power string, handler func(*Context))
func (*RouterGroup) PUT ¶ added in v0.7.4
func (group *RouterGroup) PUT(pattern, power string, handler func(*Context))
Click to show internal directories.
Click to hide internal directories.