msgpackrpc

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2019 License: BSD-3-Clause Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
const (
	E_PARSE       = -32700
	E_INVALID_REQ = -32600
	E_NO_METHOD   = -32601
	E_BAD_PARAMS  = -32602
	E_INTERNAL    = -32603
	E_SERVER      = -32000
)

Variables

View Source
var ContentType = `application/msgpack`

Functions

func Call

func Call(url string, method string, request interface{}, reply interface{}) (e error)

Types

type Codec

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

Codec creates a CodecRequest to process each request.

func NewCodec

func NewCodec() *Codec

func (*Codec) NewRequest

func (c *Codec) NewRequest(r *http.Request) rpcHttp.CodecRequest

type CodecRequest

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

func (*CodecRequest) Method

func (c *CodecRequest) Method() (string, error)

func (*CodecRequest) ReadRequest

func (c *CodecRequest) ReadRequest(args interface{}) error

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 Error

type Error struct {
	Code    int         `msgpack:"code"`    /* required */
	Message string      `msgpack:"message"` /* required */
	Data    interface{} `msgpack:"data"`    /* optional */
}

func ConvertError

func ConvertError(err error) (replyError *Error)

func (*Error) Error

func (e *Error) Error() string

Jump to

Keyboard shortcuts

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