Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(address string, tracer opentracing.Tracer, clientFactory func(cc grpc.ClientConnInterface) interface{}) (interface{}, func() error, error)
New creates a new gRPC connection and generic service client. Automatically injects contexts over gRPC and starts a new server-side tracing span.
To make this work as a generic client constructor, you must wrap the `pb.NewXXXCLient` function to return an empty interface{} Every service should create their own client implementation by calling this function. Example from the account service client. ```
func New(address string, tracer opentracing.Tracer) (pb.AccountClient, func() error, error) { c, close, err := client.New(address, tracer, createAccountClient) return c.(pb.AccountClient), close, err
} // Generic wrapper around the pb.NewXXXClient function
func createAccountClient(cc grpc.ClientConnInterface) interface{} { return pb.NewAccountClient(cc) }
```
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.