jsonclient

package
v1.75.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: BSD-3-Clause Imports: 10 Imported by: 25 modules, 219 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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 CallbackExt added in v1.65.3

type CallbackExt func(res ...interface{}) (interface{}, error)

CallbackExt an extension 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) RunExt added in v1.65.3

func (c *RPCCtx) RunExt(arg ...interface{})

RunExt extension to run

func (*RPCCtx) RunResult

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

RunResult format rpc result

func (*RPCCtx) RunResultExt added in v1.65.3

func (c *RPCCtx) RunResultExt(arg ...interface{}) (interface{}, error)

RunResultExt format rpc result with ext cb func

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

func (*RPCCtx) SetResultCbExt added in v1.65.3

func (c *RPCCtx) SetResultCbExt(cb CallbackExt)

SetResultCbExt extension rpcctx callback

Jump to

Keyboard shortcuts

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