client

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 29, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RESTClientType = "rest"
	RPCClientType  = "rpc"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Type 返回客户端类型(rest/rpc)
	Type() string
	// Close 关闭客户端
	Close(ctx context.Context) error
}

Client 统一的客户端接口

func NewClient

func NewClient(clientType string, config any) (Client, error)

NewClient 统一的客户端创建函数

type RESTClient

type RESTClient interface {
	Type() string
	rest.Client // 嵌入REST客户端接口
}

RESTClient REST客户端接口,继承统一接口

type RESTConfig

type RESTConfig struct {
	Type    string // "http" or "fasthttp"
	BaseURL string
	Options []rest.ClientOption
}

RESTConfig REST客户端配置

type RPCClient

type RPCClient interface {
	Type() string
	rpc.Client // 嵌入RPC客户端接口
}

RPCClient RPC客户端接口,继承统一接口

type RPCConfig

type RPCConfig struct {
	Method  string // "grpc"
	Options []rpc.ClientOptions
}

RPCConfig RPC客户端配置

Jump to

Keyboard shortcuts

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