Documentation ¶
Overview ¶
Package jsonclient 实现JSON rpc客户端请求功能
Index ¶
- type Callback
- type CallbackExt
- type JSONClient
- type RPCCtx
- func (c *RPCCtx) Run()
- func (c *RPCCtx) RunExt(arg ...interface{})
- func (c *RPCCtx) RunResult() (interface{}, error)
- func (c *RPCCtx) RunResultExt(arg ...interface{}) (interface{}, error)
- func (c *RPCCtx) RunWithoutMarshal()
- func (c *RPCCtx) SetResultCb(cb Callback)
- func (c *RPCCtx) SetResultCbExt(cb CallbackExt)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Callback ¶
type Callback func(res interface{}) (interface{}, error)
Callback a callback function
type CallbackExt ¶
type CallbackExt func(res ...interface{}) (interface{}, error)
CallbackExt an extension callback function
type JSONClient ¶
type JSONClient struct {
// contains filtered or unexported fields
}
JSONClient a object of jsonclient
func New ¶
func New(prefix, url string, tlsVerify bool) (*JSONClient, error)
New produce a jsonclient by perfix and url
func NewJSONClient ¶
func NewJSONClient(url string) (*JSONClient, error)
NewJSONClient produce a json object
func (*JSONClient) Call ¶
func (client *JSONClient) Call(method string, params, resp interface{}) error
Call jsonclinet call method
type RPCCtx ¶
type RPCCtx struct { Addr string Method string Params interface{} Res interface{} // contains filtered or unexported fields }
RPCCtx rpc ctx interface TODO: SetPostRunCb()
func (*RPCCtx) RunResultExt ¶
RunResultExt format rpc result with ext cb func
func (*RPCCtx) RunWithoutMarshal ¶
func (c *RPCCtx) RunWithoutMarshal()
RunWithoutMarshal return source result of string
func (*RPCCtx) SetResultCbExt ¶
func (c *RPCCtx) SetResultCbExt(cb CallbackExt)
SetResultCbExt extension rpcctx callback
Click to show internal directories.
Click to hide internal directories.