package
1.2.2
Repository: https://github.com/powerman/rpc-codec.git
Documentation: pkg.go.dev

# Functions

Dial connects to a JSON-RPC 2.0 server at the specified network address.
HTTPHandler returns handler for HTTP requests which will execute incoming JSON-RPC 2.0 over HTTP using srv.
HTTPRequestFromContext returns HTTP request related to this RPC (if you use HTTPHander to serve JSON RPC 2.0 over HTTP) or nil otherwise.
NewClient returns a new Client to handle requests to the set of services at the other end of the connection.
NewClientCodec returns a new rpc.ClientCodec using JSON-RPC 2.0 on conn.
NewClientWithCodec returns a new Client using the given rpc.ClientCodec.
NewCustomHTTPClient returns a new Client to handle requests to the set of services at the given url using provided doer (&http.Client{} by default).
NewError returns an Error with given code and message.
NewHTTPClient returns a new Client to handle requests to the set of services at the given url.
NewServerCodec returns a new rpc.ServerCodec using JSON-RPC 2.0 on conn, which will use srv to execute batch requests.
NewServerCodecContext is NewServerCodec with given context provided within parameters for compatible RPC methods.
ServeConn runs the JSON-RPC 2.0 server on a single connection.
ServeConnContext is ServeConn with given context provided within parameters for compatible RPC methods.
ServerError convert errors returned by Client.Call() into Error.
WrapError handles any error returned by Client.Call() by wrapping Error returned by ServerError or returning non-ServerError errors as is.

# Structs

BatchArg is a param for internal RPC JSONRPC2.Batch.
Client represents a JSON RPC 2.0 Client.
Ctx can be embedded into your struct with RPC method parameters (if that method parameters type is a struct) to make it implement WithContext interface and thus have access to request context.
Error represent JSON-RPC 2.0 "Error object".
JSONRPC2 is an internal RPC service used to process batch requests.

# Interfaces

Doer is an interface for doing HTTP requests.
WithContext is an interface which should be implemented by RPC method parameters type if you need access to request context in RPC method.

# Type aliases

The DoerFunc type is an adapter to allow the use of ordinary functions as HTTP clients.