Documentation
¶
Index ¶
- type Client
- func (c *Client) Close() error
- func (c *Client) ConnectMock(mock *mock.HelloService, opts ...grpc.DialOption) (err error)
- func (c *Client) SayBidirectional(ctx context.Context, langs <-chan string, greetings chan<- string) (err error)
- func (c *Client) SayClientStream(ctx context.Context, langs <-chan string) (greetings []string, err error)
- func (c *Client) SayHello(ctx context.Context, langCode string) (_ string, err error)
- func (c *Client) SayServerStream(ctx context.Context, langCodes []string) (greetings []string, err error)
- type Messages
- type Server
- func (s *Server) Run(sock net.Listener)
- func (s *Server) SayBidirectional(stream pb.Hello_SayBidirectionalServer) (err error)
- func (s *Server) SayClientStream(stream pb.Hello_SayClientStreamServer) (err error)
- func (s *Server) SayHello(ctx context.Context, req *pb.HelloRequest) (rep *pb.HelloReply, err error)
- func (s *Server) SayServerStream(req *pb.HelloManyRequest, stream pb.Hello_SayServerStreamServer) (err error)
- func (s *Server) Serve(bindaddr string) (err error)
- func (s *Server) Shutdown() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps a generated gRPC client with the connection
func NewClient ¶
func NewClient(endpoint string, opts ...grpc.DialOption) (c *Client, err error)
Create a new client from client options
func (*Client) ConnectMock ¶
func (c *Client) ConnectMock(mock *mock.HelloService, opts ...grpc.DialOption) (err error)
Connect the mock to the client
func (*Client) SayBidirectional ¶
func (*Client) SayClientStream ¶
type Server ¶
type Server struct {
pb.UnimplementedHelloServer
// contains filtered or unexported fields
}
Struct that implements the gRPC service
func NewServer ¶
func NewServer(opts ...grpc.ServerOption) (s *Server, err error)
Create a new server
func (*Server) Run ¶
Run the gRPC server on the socket. This is extracted into its own method to make it easier to inject sockets for testing.
func (*Server) SayBidirectional ¶
func (s *Server) SayBidirectional(stream pb.Hello_SayBidirectionalServer) (err error)
Bidirectional streaming RPC
func (*Server) SayClientStream ¶
func (s *Server) SayClientStream(stream pb.Hello_SayClientStreamServer) (err error)
Client streaming RPC
func (*Server) SayHello ¶
func (s *Server) SayHello(ctx context.Context, req *pb.HelloRequest) (rep *pb.HelloReply, err error)
Unary RPC
func (*Server) SayServerStream ¶
func (s *Server) SayServerStream(req *pb.HelloManyRequest, stream pb.Hello_SayServerStreamServer) (err error)
Server streaming RPC
Click to show internal directories.
Click to hide internal directories.