Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Error ¶
type Error struct { Code int `json:"code"` Message string `json:"message"` Data interface{} `json:"data,omitempty"` }
Error object
func ErrInternalError ¶
func ErrInternalError(data interface{}) *Error
ErrInternalError Internal JSON-RPC error.
func ErrInvalidParams ¶
func ErrInvalidParams(data interface{}) *Error
ErrInvalidParams Invalid method parameter(s).
func ErrInvalidRequest ¶
func ErrInvalidRequest(data interface{}) *Error
ErrInvalidRequest The JSON sent is not a valid Request object.
func ErrMethodNotFound ¶
func ErrMethodNotFound(data interface{}) *Error
ErrMethodNotFound The method does not exist / is not available.
func ErrParseError ¶
func ErrParseError(data interface{}) *Error
ErrParseError Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text.
type Method ¶
type Method interface { Name() string Handle(ctx context.Context, params io.Reader, result io.Writer) error }
Method jsonrpc
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
Repo for storing methods
func (*Repo) RegisterMethod ¶
RegisterMethod registers method in repo
func (*Repo) ServeHTTP ¶
func (repo *Repo) ServeHTTP(w http.ResponseWriter, r *http.Request)
ServeHTTP implement http.Handler for handling JSON-RPC requests
func (*Repo) UnregisterMethod ¶
UnregisterMethod removes method by name
Click to show internal directories.
Click to hide internal directories.