Documentation ¶
Index ¶
- Variables
- func DecodeClientResponse(r io.Reader, reply interface{}) error
- func EncodeClientRequest(method string, args interface{}) ([]byte, error)
- type Codec
- type CodecRequest
- func (c *CodecRequest) Body() []byte
- func (c *CodecRequest) Error() error
- func (c *CodecRequest) ErrorReply(err error) interface{}
- func (c *CodecRequest) Method() (string, error)
- func (c *CodecRequest) ReadRequest(args interface{}) error
- func (c *CodecRequest) ResponseReply(reply interface{}) interface{}
- func (c *CodecRequest) WriteError(w http.ResponseWriter, status int, err error)
- func (c *CodecRequest) WriteResponse(w http.ResponseWriter, reply interface{})
- type EmptyResponse
- type Error
- type ErrorCode
Constants ¶
This section is empty.
Variables ¶
View Source
var Version = "2.0"
Functions ¶
func DecodeClientResponse ¶
DecodeClientResponse decodes the response body of a client request into the interface reply.
func EncodeClientRequest ¶
EncodeClientRequest encodes parameters for a JSON-RPC client request.
Types ¶
type Codec ¶
type Codec struct {
// contains filtered or unexported fields
}
Codec creates a CodecRequest to process each request.
func NewCustomCodec ¶
func NewCustomCodec(encSel rpc.EncoderSelector) *Codec
NewcustomCodec returns a new JSON Codec based on passed encoder selector.
func (*Codec) NewRequest ¶
NewRequest returns a CodecRequest.
func (*Codec) WriteBatchedReply ¶
func (c *Codec) WriteBatchedReply(r *http.Request, w http.ResponseWriter, replyArray []interface{})
type CodecRequest ¶
type CodecRequest struct {
// contains filtered or unexported fields
}
CodecRequest decodes and encodes a single request.
func (*CodecRequest) Error ¶
func (c *CodecRequest) Error() error
func (*CodecRequest) ErrorReply ¶
func (c *CodecRequest) ErrorReply(err error) interface{}
func (*CodecRequest) Method ¶
func (c *CodecRequest) Method() (string, error)
Method returns the RPC method for the current request.
The method uses a dotted notation as in "Service.Method".
func (*CodecRequest) ReadRequest ¶
func (c *CodecRequest) ReadRequest(args interface{}) error
ReadRequest fills the request object for the RPC method.
func (*CodecRequest) ResponseReply ¶
func (c *CodecRequest) ResponseReply(reply interface{}) interface{}
func (*CodecRequest) WriteError ¶
func (c *CodecRequest) WriteError(w http.ResponseWriter, status int, err error)
func (*CodecRequest) WriteResponse ¶
func (c *CodecRequest) WriteResponse(w http.ResponseWriter, reply interface{})
WriteResponse encodes the response and writes it to the ResponseWriter.
type EmptyResponse ¶
type EmptyResponse struct { }
type Error ¶
type Error struct { // A Number that indicates the error type that occurred. Code ErrorCode `json:"code"` /* required */ // A String providing a short description of the error. // The message SHOULD be limited to a concise single sentence. Message string `json:"message"` /* required */ // A Primitive or Structured value that contains additional information about the error. Data interface{} `json:"data"` /* optional */ }
Click to show internal directories.
Click to hide internal directories.