xjhttp

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 27, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppConfig added in v0.0.8

type AppConfig struct {
	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
}

func (*Context) Error added in v0.0.8

func (c *Context) Error(code int, err error)

func (*Context) Fail added in v0.0.8

func (c *Context) Fail(code int, msg string)

func (*Context) JSON added in v0.0.8

func (c *Context) JSON(code int, obj interface{})

func (*Context) Make added in v0.0.8

func (c *Context) Make(code int, rcode int, data interface{}, msg string)

func (*Context) PathParam added in v0.1.0

func (c *Context) PathParam(index int) string

func (*Context) QueryAll added in v0.0.8

func (c *Context) QueryAll() url.Values

func (*Context) QueryInt added in v0.1.0

func (c *Context) QueryInt(key string) (int, error)

func (*Context) QueryInt64 added in v0.1.0

func (c *Context) QueryInt64(key string) (int64, error)

func (*Context) QueryStr added in v0.0.8

func (c *Context) QueryStr(key string) string

func (*Context) String added in v0.0.8

func (c *Context) String(code int, format string, values ...interface{})

func (*Context) Success added in v0.0.8

func (c *Context) Success(code int, data interface{})

type Engine

type Engine struct {
	// contains filtered or unexported fields
}

func Default

func Default() *Engine

func (*Engine) DELETE added in v0.0.8

func (engine *Engine) DELETE(pattern string, handler func(*Context))

func (*Engine) GET added in v0.0.8

func (engine *Engine) GET(pattern string, handler func(*Context))

func (*Engine) GetHandle

func (engine *Engine) GetHandle(mapHandle map[int]http.HandlerFunc) http.HandlerFunc

func (*Engine) HEAD added in v0.0.8

func (engine *Engine) HEAD(pattern string, handler func(*Context))

func (*Engine) HandleFunc

func (engine *Engine) HandleFunc(method, pattern string, handler func(*Context))

func (*Engine) OPTIONS added in v0.0.8

func (engine *Engine) OPTIONS(pattern string, handler func(*Context))

func (*Engine) PATCH added in v0.0.8

func (engine *Engine) PATCH(pattern string, handler func(*Context))

func (*Engine) POST added in v0.0.8

func (engine *Engine) POST(pattern string, handler func(*Context))

func (*Engine) PUT added in v0.0.8

func (engine *Engine) PUT(pattern string, handler func(*Context))

func (*Engine) PathMatch

func (engine *Engine) PathMatch(path, pattern string) int

func (*Engine) Run

func (engine *Engine) Run(address string) (err error)

func (*Engine) ServeHTTP

func (engine *Engine) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Route

type Route struct {
	Method  string
	Pattern string
	Handler http.HandlerFunc
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL