rpc

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetCircuits

func SetCircuits(circuits []string)

SetCircuits 设置需要熔断的接口(不需要append是因为列表是确定的不会运行中添加,所以无需动态添加)

Types

type Client

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

Client 客户端

func NewClient

func NewClient(target client.Target, opts ...Opt) *Client

NewClient 构造函数

func (*Client) Dial

func (c *Client) Dial(ctx context.Context, serverName string) (conn *Conn, err error)

type Conn added in v1.0.1

type Conn struct {
	*grpc.ClientConn
}

func (*Conn) Close added in v1.0.1

func (c *Conn) Close() error

type HandlerFunc

type HandlerFunc func(engine *grpc.Server)

type Opt added in v1.0.1

type Opt func(client *Client)

Opt grpc客户端opt

type Server

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

Server 服务端

func NewGrpc

func NewGrpc(serverName, address string, port int, handlerFunc HandlerFunc) *Server

NewGrpc 构造函数

func (*Server) ServiceInstance

func (s *Server) ServiceInstance() *register.ServiceInstance

ServiceInstance 获取服务实例(服务注册与发现)

func (*Server) Start

func (s *Server) Start() error

Start 开始启动服务

func (*Server) Stop

func (s *Server) Stop() error

Stop 停止服务

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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