jsonclient

package
v0.0.0-...-3606b63 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2019 License: BSD-3-Clause Imports: 10 Imported by: 0

Documentation

Overview

Package jsonclient 实现JSON rpc客户端请求功能

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Callback

type Callback func(res interface{}) (interface{}, error)

Callback a callback function

type JSONClient

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

JSONClient a object of jsonclient

func New

func New(prefix, url string, tlsVerify bool) (*JSONClient, error)

New produce a jsonclient by perfix and url

func NewJSONClient

func NewJSONClient(url string) (*JSONClient, error)

NewJSONClient produce a json object

func (*JSONClient) Call

func (client *JSONClient) Call(method string, params, resp interface{}) error

Call jsonclinet call method

type RPCCtx

type RPCCtx struct {
	Addr   string
	Method string
	Params interface{}
	Res    interface{}
	// contains filtered or unexported fields
}

RPCCtx rpc ctx interface TODO: SetPostRunCb()

func NewRPCCtx

func NewRPCCtx(laddr, method string, params, res interface{}) *RPCCtx

NewRPCCtx produce a object of rpcctx

func (*RPCCtx) Run

func (c *RPCCtx) Run()

Run rpcctx to runresult

func (*RPCCtx) RunResult

func (c *RPCCtx) RunResult() (interface{}, error)

RunResult format rpc result

func (*RPCCtx) RunWithoutMarshal

func (c *RPCCtx) RunWithoutMarshal()

RunWithoutMarshal return source result of string

func (*RPCCtx) SetResultCb

func (c *RPCCtx) SetResultCb(cb Callback)

SetResultCb rpcctx callback

Jump to

Keyboard shortcuts

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