rpc

package
v0.1.43 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrServiceIsNil  = errors.New("[rpc] service 不能为nil")
	ErrStructPtrOnly = errors.New("[rpc] service 只能传入结构体指针")
)

Functions

func InitClient

func InitClient(addr string, srv Service) error

Types

type Client added in v0.1.43

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

func (*Client) Invoke added in v0.1.43

func (c *Client) Invoke(ctx context.Context, req *message.Request) (*message.Response, error)

func (*Client) Send added in v0.1.43

func (c *Client) Send(data []byte) ([]byte, error)

type Proxy

type Proxy interface {
	Invoke(ctx context.Context, req *message.Request) (*message.Response, error)
}

type Server added in v0.1.43

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

func NewServer added in v0.1.43

func NewServer() *Server

func (*Server) Register added in v0.1.43

func (s *Server) Register(srv Service)

func (*Server) Start added in v0.1.43

func (s *Server) Start(addr string) error

type Service

type Service interface {
	Name() string
}

type UserServiceImpl added in v0.1.43

type UserServiceImpl struct {
	testdata.UserService
}

func (*UserServiceImpl) GetUserByID added in v0.1.43

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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