Documentation
¶
Index ¶
- Constants
- type CmdResp
- func (r *CmdResp) Error() string
- func (r *CmdResp) HasError() bool
- func (r *CmdResp) Int64MapValue() map[string]int64
- func (r *CmdResp) Int64Value() int64
- func (r *CmdResp) Int64sValue() []int64
- func (r *CmdResp) IntMapValue() map[string]int
- func (r *CmdResp) IntValue() int
- func (r *CmdResp) IntsValue() []int
- func (r *CmdResp) StringMapValue() map[string]string
- func (r *CmdResp) StringValue() string
- func (r *CmdResp) StringsValue() []string
- type Ctx
- type Engine
- func (eng *Engine) ApplyPlugins(plugins ...*metapb.Plugin) error
- func (eng *Engine) Destroy()
- func (eng *Engine) Init(cfg string) error
- func (eng *Engine) LastActive() time.Time
- func (eng *Engine) Name() string
- func (eng *Engine) Post(c filter.Context) (int, error)
- func (eng *Engine) PostErr(c filter.Context, code int, err error)
- func (eng *Engine) Pre(c filter.Context) (int, error)
- func (eng *Engine) UpdatePlugin(plugin *metapb.Plugin) error
- type FastHTTPRequestAdapter
- func (req *FastHTTPRequestAdapter) Body() string
- func (req *FastHTTPRequestAdapter) Cookie(name string) string
- func (req *FastHTTPRequestAdapter) Header(name string) string
- func (req *FastHTTPRequestAdapter) Query(name string) string
- func (req *FastHTTPRequestAdapter) RemoveCookie(name string)
- func (req *FastHTTPRequestAdapter) RemoveHeader(name string)
- func (req *FastHTTPRequestAdapter) SetBody(body string)
- func (req *FastHTTPRequestAdapter) SetCookie(name, value string)
- func (req *FastHTTPRequestAdapter) SetHeader(name, value string)
- type FastHTTPResponseAdapter
- func (rsp *FastHTTPResponseAdapter) Body() string
- func (rsp *FastHTTPResponseAdapter) Cookie(name string) string
- func (rsp *FastHTTPResponseAdapter) Delegate() *fasthttp.Response
- func (rsp *FastHTTPResponseAdapter) Header(name string) string
- func (rsp *FastHTTPResponseAdapter) RemoveCookie(name string)
- func (rsp *FastHTTPResponseAdapter) RemoveHeader(name string)
- func (rsp *FastHTTPResponseAdapter) SetBody(body string)
- func (rsp *FastHTTPResponseAdapter) SetCookie(domain, path, name, value string, expire int64, httpOnly, secure bool)
- func (rsp *FastHTTPResponseAdapter) SetHeader(name, value string)
- func (rsp *FastHTTPResponseAdapter) SetStatusCode(code int)
- type HTTPModule
- func (h *HTTPModule) Delete(url string, body string, header map[string][]string) *HTTPResult
- func (h *HTTPModule) DeleteJSON(url string, body string, header map[string][]string) *HTTPResult
- func (h *HTTPModule) Get(url string) *HTTPResult
- func (h *HTTPModule) NewHTTPResponse() *FastHTTPResponseAdapter
- func (h *HTTPModule) Post(url string, body string, header map[string][]string) *HTTPResult
- func (h *HTTPModule) PostJSON(url string, body string, header map[string][]string) *HTTPResult
- func (h *HTTPModule) Put(url string, body string, header map[string][]string) *HTTPResult
- func (h *HTTPModule) PutJSON(url string, body string, header map[string][]string) *HTTPResult
- type HTTPResult
- type JSONModule
- type LogModule
- func (l *LogModule) Debug(v ...interface{})
- func (l *LogModule) Debugf(format string, v ...interface{})
- func (l *LogModule) Error(v ...interface{})
- func (l *LogModule) Errorf(format string, v ...interface{})
- func (l *LogModule) Fatal(v ...interface{})
- func (l *LogModule) Fatalf(format string, v ...interface{})
- func (l *LogModule) Info(v ...interface{})
- func (l *LogModule) Infof(format string, v ...interface{})
- func (l *LogModule) Warn(v ...interface{})
- func (l *LogModule) Warnf(format string, v ...interface{})
- func (l *LogModule) Warning(v ...interface{})
- func (l *LogModule) Warningf(format string, v ...interface{})
- type RedisModule
- type RedisOp
- type Runtime
Constants ¶
const ( // PluginConstructor every plugin needs a constructor PluginConstructor = "NewPlugin" // PluginPre filter pre method PluginPre = "pre" // PluginPost filter post method PluginPost = "post" // PluginPostErr filter post error method PluginPostErr = "postErr" // PluginReturnCodeFieldName code field name in return json object PluginReturnCodeFieldName = "code" // PluginReturnErrorFieldName error field name in return json object PluginReturnErrorFieldName = "error" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CmdResp ¶
type CmdResp struct {
// contains filtered or unexported fields
}
CmdResp redis cmd resp
func (*CmdResp) Int64MapValue ¶
Int64MapValue returns int64 map value
func (*CmdResp) Int64sValue ¶
Int64sValue returns int64s value
func (*CmdResp) IntMapValue ¶
IntMapValue returns int map value
func (*CmdResp) StringMapValue ¶
StringMapValue returns string map value
func (*CmdResp) StringValue ¶
StringValue returns string value
func (*CmdResp) StringsValue ¶
StringsValue returns strings value
type Ctx ¶
type Ctx struct {
// contains filtered or unexported fields
}
Ctx plugin ctx
func (*Ctx) ForwardRequest ¶
func (c *Ctx) ForwardRequest() *FastHTTPRequestAdapter
ForwardRequest return forward request
func (*Ctx) OriginRequest ¶
func (c *Ctx) OriginRequest() *FastHTTPRequestAdapter
OriginRequest return origin request
type Engine ¶
type Engine struct {
filter.BaseFilter
// contains filtered or unexported fields
}
Engine plugin engine
func (*Engine) ApplyPlugins ¶
ApplyPlugins apply plugins
func (*Engine) LastActive ¶
LastActive returns the time that last used
type FastHTTPRequestAdapter ¶
type FastHTTPRequestAdapter struct {
// contains filtered or unexported fields
}
FastHTTPRequestAdapter fasthttp request adapter
func (*FastHTTPRequestAdapter) Body ¶
func (req *FastHTTPRequestAdapter) Body() string
Body returns request body
func (*FastHTTPRequestAdapter) Cookie ¶
func (req *FastHTTPRequestAdapter) Cookie(name string) string
Cookie returns cookie value
func (*FastHTTPRequestAdapter) Header ¶
func (req *FastHTTPRequestAdapter) Header(name string) string
Header returns header value
func (*FastHTTPRequestAdapter) Query ¶
func (req *FastHTTPRequestAdapter) Query(name string) string
Query returns query string value
func (*FastHTTPRequestAdapter) RemoveCookie ¶
func (req *FastHTTPRequestAdapter) RemoveCookie(name string)
RemoveCookie remove cookie
func (*FastHTTPRequestAdapter) RemoveHeader ¶
func (req *FastHTTPRequestAdapter) RemoveHeader(name string)
RemoveHeader remove header
func (*FastHTTPRequestAdapter) SetBody ¶
func (req *FastHTTPRequestAdapter) SetBody(body string)
SetBody set body
func (*FastHTTPRequestAdapter) SetCookie ¶
func (req *FastHTTPRequestAdapter) SetCookie(name, value string)
SetCookie set cookie value
func (*FastHTTPRequestAdapter) SetHeader ¶
func (req *FastHTTPRequestAdapter) SetHeader(name, value string)
SetHeader set header value
type FastHTTPResponseAdapter ¶
type FastHTTPResponseAdapter struct {
// contains filtered or unexported fields
}
FastHTTPResponseAdapter fasthttp response adapter
func (*FastHTTPResponseAdapter) Body ¶
func (rsp *FastHTTPResponseAdapter) Body() string
Body returns request body
func (*FastHTTPResponseAdapter) Cookie ¶
func (rsp *FastHTTPResponseAdapter) Cookie(name string) string
Cookie returns cookie value
func (*FastHTTPResponseAdapter) Delegate ¶
func (rsp *FastHTTPResponseAdapter) Delegate() *fasthttp.Response
Delegate returns delegate fasthttp response
func (*FastHTTPResponseAdapter) Header ¶
func (rsp *FastHTTPResponseAdapter) Header(name string) string
Header returns header value
func (*FastHTTPResponseAdapter) RemoveCookie ¶
func (rsp *FastHTTPResponseAdapter) RemoveCookie(name string)
RemoveCookie remove cookie
func (*FastHTTPResponseAdapter) RemoveHeader ¶
func (rsp *FastHTTPResponseAdapter) RemoveHeader(name string)
RemoveHeader remove header
func (*FastHTTPResponseAdapter) SetBody ¶
func (rsp *FastHTTPResponseAdapter) SetBody(body string)
SetBody set body
func (*FastHTTPResponseAdapter) SetCookie ¶
func (rsp *FastHTTPResponseAdapter) SetCookie(domain, path, name, value string, expire int64, httpOnly, secure bool)
SetCookie set cookie value
func (*FastHTTPResponseAdapter) SetHeader ¶
func (rsp *FastHTTPResponseAdapter) SetHeader(name, value string)
SetHeader set header value
func (*FastHTTPResponseAdapter) SetStatusCode ¶
func (rsp *FastHTTPResponseAdapter) SetStatusCode(code int)
SetStatusCode set status code
type HTTPModule ¶
type HTTPModule struct {
// contains filtered or unexported fields
}
HTTPModule http module
func (*HTTPModule) Delete ¶
func (h *HTTPModule) Delete(url string, body string, header map[string][]string) *HTTPResult
Delete do delete
func (*HTTPModule) DeleteJSON ¶
func (h *HTTPModule) DeleteJSON(url string, body string, header map[string][]string) *HTTPResult
DeleteJSON do delete json
func (*HTTPModule) NewHTTPResponse ¶
func (h *HTTPModule) NewHTTPResponse() *FastHTTPResponseAdapter
NewHTTPResponse returns http response
func (*HTTPModule) Post ¶
func (h *HTTPModule) Post(url string, body string, header map[string][]string) *HTTPResult
Post do post
func (*HTTPModule) PostJSON ¶
func (h *HTTPModule) PostJSON(url string, body string, header map[string][]string) *HTTPResult
PostJSON do post
func (*HTTPModule) Put ¶
func (h *HTTPModule) Put(url string, body string, header map[string][]string) *HTTPResult
Put do put
func (*HTTPModule) PutJSON ¶
func (h *HTTPModule) PutJSON(url string, body string, header map[string][]string) *HTTPResult
PutJSON do put json
type HTTPResult ¶
type HTTPResult struct {
// contains filtered or unexported fields
}
HTTPResult result
func (*HTTPResult) Cookie ¶
func (res *HTTPResult) Cookie() []*http.Cookie
Cookie returns http response cookie
func (*HTTPResult) HasError ¶
func (res *HTTPResult) HasError() bool
HasError returns true if has a error
func (*HTTPResult) Header ¶
func (res *HTTPResult) Header() map[string][]string
Header returns http response header
func (*HTTPResult) StatusCode ¶
func (res *HTTPResult) StatusCode() int
StatusCode returns status code
type JSONModule ¶
type JSONModule struct {
}
JSONModule json builtin
func (*JSONModule) Parse ¶
func (j *JSONModule) Parse(value string) map[string]interface{}
Parse parse a string to json
func (*JSONModule) Stringify ¶
func (j *JSONModule) Stringify(value interface{}) string
Stringify returns json string
type LogModule ¶
type LogModule struct {
}
LogModule log module
type RedisModule ¶
type RedisModule struct {
// contains filtered or unexported fields
}
RedisModule redis module
func (*RedisModule) CreateRedis ¶
func (m *RedisModule) CreateRedis(cfg map[string]interface{}) *RedisOp
CreateRedis create redis
type Runtime ¶
type Runtime struct {
sync.RWMutex
filter.BaseFilter
// contains filtered or unexported fields
}
Runtime plugin runtime
func NewRuntime ¶
NewRuntime return a runtime