mirror of
https://github.com/go-micro/go-micro.git
synced 2024-11-24 08:02:32 +02:00
Update
This commit is contained in:
parent
46687746a4
commit
8cfad5db33
@ -16,7 +16,7 @@ Feature | Package | Built-in Plugin | Description
|
||||
Discovery | [Registry](https://godoc.org/github.com/micro/go-micro/registry) | consul | A way of locating services to communicate with
|
||||
Client | [Client](https://godoc.org/github.com/micro/go-micro/client) | rpc | Used to make RPC requests to a service
|
||||
Codec | [Codec](https://godoc.org/github.com/micro/go-micro/codec) | proto,json | Encoding/Decoding handler for requests
|
||||
Selector | [Selector](https://godoc.org/github.com/micro/go-micro/selector) | random | Service node filter and pool
|
||||
Balancer | [Selector](https://godoc.org/github.com/micro/go-micro/selector) | random | Service node filter and pool
|
||||
Server | [Server](https://godoc.org/github.com/micro/go-micro/server) | rpc | Listens and serves RPC requests
|
||||
Pub/Sub | [Broker](https://godoc.org/github.com/micro/go-micro/broker) | http | Publish and Subscribe to events
|
||||
Transport | [Transport](https://godoc.org/github.com/micro/go-micro/transport) | http | Communication mechanism between services
|
||||
|
@ -93,8 +93,8 @@ var _ server.Option
|
||||
// Client API for Example service
|
||||
|
||||
type ExampleClient interface {
|
||||
Call(ctx context.Context, in *Request) (*Response, error)
|
||||
Stream(ctx context.Context, in *StreamingRequest) (Example_StreamClient, error)
|
||||
Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error)
|
||||
Stream(ctx context.Context, in *StreamingRequest, opts ...client.CallOption) (Example_StreamClient, error)
|
||||
}
|
||||
|
||||
type exampleClient struct {
|
||||
@ -115,20 +115,20 @@ func NewExampleClient(serviceName string, c client.Client) ExampleClient {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *exampleClient) Call(ctx context.Context, in *Request) (*Response, error) {
|
||||
func (c *exampleClient) Call(ctx context.Context, in *Request, opts ...client.CallOption) (*Response, error) {
|
||||
req := c.c.NewRequest(c.serviceName, "Example.Call", in)
|
||||
out := new(Response)
|
||||
err := c.c.Call(ctx, req, out)
|
||||
err := c.c.Call(ctx, req, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *exampleClient) Stream(ctx context.Context, in *StreamingRequest) (Example_StreamClient, error) {
|
||||
func (c *exampleClient) Stream(ctx context.Context, in *StreamingRequest, opts ...client.CallOption) (Example_StreamClient, error) {
|
||||
req := c.c.NewRequest(c.serviceName, "Example.Stream", in)
|
||||
outCh := make(chan *StreamingResponse)
|
||||
stream, err := c.c.Stream(ctx, req, outCh)
|
||||
stream, err := c.c.Stream(ctx, req, outCh, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user