grpcctx

package
v1.48.0 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2020 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package grpcctx contains helper functionality for testing with grpc-go.

Index

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) WithHeader added in v1.27.0

func (c *ContextWrapper) WithHeader(key, value string) *ContextWrapper

WithHeader returns a new ContextWrapper with the given header.

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.

func (*ContextWrapper) Wrap

Wrap wraps the given context with the headers.

Jump to

Keyboard shortcuts

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