xrpc

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Aug 1, 2022 License: MIT Imports: 7 Imported by: 2

Documentation

Index

Constants

View Source
const TypeNode = "rpcs"

Variables

This section is empty.

Functions

func Deregister

func Deregister(name string)

Deregister 清理配置适配器

func NewBuilder

func NewBuilder() container.StandardBuilder

func Register

func Register(resolver rpcResover)

Register 注册配置文件适配器

Types

type Body

type Body interface {
	GetStatus() int32
	GetHeader() map[string]string
	GetResult() []byte
}

type Client

type Client interface {
	//Swap 将当前请求参数作为RPC参数并发送RPC请求
	Swap(ctx context.Context, service string, opts ...RequestOption) (res Body, err error)

	//RequestByCtx RPC请求,可通过context撤销请求
	Request(ctx sctx.Context, service string, input interface{}, opts ...RequestOption) (res Body, err error)
}

type Options

type Options struct {
	Header       xtypes.SMap // map[string]string
	WaitForReady bool
}

type RequestOption

type RequestOption func(*Options)

func WithContentType

func WithContentType(contentType string) RequestOption

func WithHeaders

func WithHeaders(header map[string]string) RequestOption

func WithWaitForReady

func WithWaitForReady(waitForReady bool) RequestOption

func WithXRequestID

func WithXRequestID(requestID string) RequestOption

type StandardRPC

type StandardRPC interface {
	GetRPC(name ...string) (c Client)
}

func NewXRPC

func NewXRPC(container container.Container) StandardRPC

NewStandardRPC 创建RPC服务代理

Jump to

Keyboard shortcuts

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