Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateBatchRequestBody ¶
func GenerateBatchRequestBody(requests []*json.RawMessage) (*json.RawMessage, error)
GenerateBatchRequestBody ... JSONRPC2のバッチリクエストBodyを作成する
func GenerateRequestBody ¶
func GenerateRequestBody(id string, method string, params interface{}) (*json.RawMessage, error)
GenerateRequestBody ... JSONRPC2のリクエストBodyを作成する
Types ¶
type Action ¶
type Action interface { DecodeParams(ctx context.Context, msg *json.RawMessage) (interface{}, error) Exec(ctx context.Context, method string, params interface{}) (interface{}, error) }
Action ... JSORPC2アクションの定義
type Client ¶
type Client struct { URL string Headers map[string]string Requests []*ClientRequest }
Client ... JSONRPC2のリクエストを行う
func (*Client) AddRequest ¶
func (c *Client) AddRequest(ctx context.Context, id string, method string, params interface{}) error
AddRequest ... JSONRPC2のリクエストを登録する
func (*Client) DoBatch ¶
func (c *Client) DoBatch(ctx context.Context) ([]*ClientResponse, error)
DoBatch ... JSONRPC2のバッチリクエストを行う
func (*Client) DoSingle ¶
func (c *Client) DoSingle(ctx context.Context, method string, params interface{}) (*json.RawMessage, *ErrorResponse, error)
DoSingle ... JSONRPC2のシングルリクエストを行う
type ClientRequest ¶
type ClientRequest struct { Version string `json:"jsonrpc"` ID string `json:"id"` Method string `json:"method"` Params *json.RawMessage `json:"params"` }
ClientRequest ... JSONRPC2実行のリクエスト
type ClientResponse ¶
type ClientResponse struct { Version string `json:"jsonrpc"` ID string `json:"id"` Result *json.RawMessage `json:"result,omitempty"` Error *ErrorResponse `json:"error,omitempty"` }
ClientResponse ... JSONRPC2実行のレスポンス
type ErrorResponse ¶
ErrorResponse ... JSONRPC2のエラーレスポンス
Click to show internal directories.
Click to hide internal directories.