Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type RPCRequests ¶
type RPCRequests []*RpcRequest
type RpcError ¶
type RpcError struct {
Code int `json:"code"`
Message string `json:"message"`
Data interface{} `json:"data,omitempty"`
}
RpcError holds decoded RPC errors
type RpcRequest ¶
type RpcRequest struct {
JsonRpc string `json:"jsonrpc"`
Id int `json:"id"`
Method string `json:"method"`
Params interface{} `json:"params,omitempty"`
}
RpcRequest contains a JSON RPC 2.0 request to be submitted to a Server
type RpcResponse ¶
type RpcResponse struct {
JSONRPC string `json:"jsonrpc"`
Result json.RawMessage `json:"result,omitempty"`
Error *RpcError `json:"error,omitempty"`
ID int `json:"id"`
}
RpcResponse contains an RPC response with the Result field left un-decoded
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server contains information related to connecting to an RPC server
func (*Server) Exec ¶
func (srv *Server) Exec(r RpcRequest) (*RpcResponse, error)
Exec executes a single remote procedure call
func (*Server) ExecBatch ¶
func (srv *Server) ExecBatch(rs RPCRequests) ([]RpcResponse, error)
ExecBatch executes a batch of calls and parses the JSON RPC 2.0 portion of the body
the Result field is left as json.RawMessage for further parsing by the caller
func (*Server) ExecBatchFast ¶
func (srv *Server) ExecBatchFast(rs RPCRequests) ([][]byte, error)
ExecBatchFast returns a slice of []byte containing the responses to the remote procedure calls
Click to show internal directories.
Click to hide internal directories.