jsonrpc

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package jsonrpc is a JSON-RPC 2.0 library for Go. This implementation abstracts the low-level details of JSON-RPC 2.0 and provides a high-level programming interface. The idea is that this implementation is not oriented to the specific connection protocol (TCP, HTTP, etc.). It is intended to be used by other libraries that manage the connections.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrAlreadyExists = errors.New("already exists")
	ErrInvalidFunc   = errors.New("invalid function")
)

Functions

This section is empty.

Types

type JsonRpc

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

func NewJsonRpc

func NewJsonRpc() *JsonRpc

func (*JsonRpc) Call

func (s *JsonRpc) Call(request []byte) json.RawMessage

func (*JsonRpc) RegisterFunc

func (s *JsonRpc) RegisterFunc(name string, handler any, paramNames ...string) error

type RpcError

type RpcError struct {
	Code    int64  `json:"code"`
	Message string `json:"message"`
	Data    any    `json:"data,omitempty"`
}

RpcError represents an error that occurred during JSON-RPC processing.

func NewInternalError

func NewInternalError(message string) *RpcError

func (*RpcError) Error

func (err *RpcError) Error() string

Error implements the error interface. notest

Directories

Path Synopsis
providers

Jump to

Keyboard shortcuts

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