rpc

package
v0.0.0-...-735ef63 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Version   = "2.0"
	DefaultID = 1
	TimeOut   = 3
)

Variables

This section is empty.

Functions

func Call

func Call(ctx context.Context, rpc Svr, args *ReqArgs, result interface{}) error

支持回调

Types

type Config

type Config struct {
	Host    string `toml:"host"`
	TimeOut uint32 `toml:"timeout"`
}

rpc

type ReqArgs

type ReqArgs struct {
	JsonRpc string      `json:"jsonrpc"`
	Method  string      `json:"method"`
	Params  interface{} `json:"params"`
	ID      uint8       `json:"id"`
}

type Resp

type Resp struct {
	JsonRpc string      `json:"jsonrpc"`
	Result  interface{} `json:"result"`
	ID      uint8       `json:"id"`
	Error   interface{} `json:"error"`
}

type Svr

type Svr interface {
	GetConfig(name string) *Config
	ModuleName() string
	ServiceName() string
}

Directories

Path Synopsis
im

Jump to

Keyboard shortcuts

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