json

package
v0.0.0-...-5a544cf Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2019 License: MIT Imports: 1 Imported by: 5

Documentation

Overview

Package json is a JSON parser for request & response body used in JSON-RPC

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RPCError

type RPCError struct {
	Code    int32  `json:"code,omitempty"`
	Message string `json:"message,omitempty"`
}

RPCError is a interface for JSON-RPC error

type RPCRequest

type RPCRequest struct {
	Jsonrpc string        `json:"jsonrpc"`
	Method  string        `json:"method"`
	Params  []interface{} `json:"params"`
	ID      int32         `json:"id"`
}

RPCRequest is a interface for JSON-RPC request

func GetRPCRequestFromJSON

func GetRPCRequestFromJSON(msg string) RPCRequest

GetRPCRequestFromJSON returns RPCRequest struct from JSON

func (*RPCRequest) String

func (r *RPCRequest) String() string

type RPCResponse

type RPCResponse struct {
	Jsonrpc string      `json:"jsonrpc"`
	ID      int32       `json:"id"`
	Result  interface{} `json:"result,omitempty"`
	Error   *RPCError   `json:"error,omitempty"`
}

RPCResponse is a interface for JSON-RPC response

func GetRPCResponseFromJSON

func GetRPCResponseFromJSON(msg string) RPCResponse

GetRPCResponseFromJSON returns RPCRequest struct from JSON

func (*RPCResponse) String

func (r *RPCResponse) String() string

Jump to

Keyboard shortcuts

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