Documentation ¶
Overview ¶
Package grpcctx contains helper functionality for testing with grpc-go.
Index ¶
- type ContextWrapper
- func (c *ContextWrapper) WithCaller(caller string) *ContextWrapper
- func (c *ContextWrapper) WithEncoding(encoding string) *ContextWrapper
- func (c *ContextWrapper) WithRoutingDelegate(routingDelegate string) *ContextWrapper
- func (c *ContextWrapper) WithRoutingKey(routingKey string) *ContextWrapper
- func (c *ContextWrapper) WithService(service string) *ContextWrapper
- func (c *ContextWrapper) WithShardKey(shardKey string) *ContextWrapper
- func (c *ContextWrapper) Wrap(ctx context.Context) context.Context
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ContextWrapper ¶
type ContextWrapper struct {
// contains filtered or unexported fields
}
ContextWrapper wraps a context for grpc-go with the required headers for yarpc.
This is a convenience object for use when using grpc-go clients. You must set certain yarpc-specific headers when using native grpc-go clients calling into yarpc servers, and this object makes that simpler.
func NewContextWrapper ¶
func NewContextWrapper() *ContextWrapper
NewContextWrapper returns a new ContextWrapper.
The only fields that a grpc-go client needs to set are caller and service. Encoding is also required if content-type is not set properly. See the documention on EncodingHeader.
func (*ContextWrapper) WithCaller ¶
func (c *ContextWrapper) WithCaller(caller string) *ContextWrapper
WithCaller returns a new ContextWrapper with the given caller.
func (*ContextWrapper) WithEncoding ¶
func (c *ContextWrapper) WithEncoding(encoding string) *ContextWrapper
WithEncoding returns a new ContextWrapper with the given encoding.
func (*ContextWrapper) WithRoutingDelegate ¶
func (c *ContextWrapper) WithRoutingDelegate(routingDelegate string) *ContextWrapper
WithRoutingDelegate returns a new ContextWrapper with the given routing delegate.
func (*ContextWrapper) WithRoutingKey ¶
func (c *ContextWrapper) WithRoutingKey(routingKey string) *ContextWrapper
WithRoutingKey returns a new ContextWrapper with the given routing key.
func (*ContextWrapper) WithService ¶
func (c *ContextWrapper) WithService(service string) *ContextWrapper
WithService returns a new ContextWrapper with the given service.
func (*ContextWrapper) WithShardKey ¶
func (c *ContextWrapper) WithShardKey(shardKey string) *ContextWrapper
WithShardKey returns a new ContextWrapper with the given shard key.