diff options
Diffstat (limited to 'vendor/github.com/grpc-ecosystem/go-grpc-middleware/tags/README.md')
-rw-r--r-- | vendor/github.com/grpc-ecosystem/go-grpc-middleware/tags/README.md | 56 |
1 files changed, 25 insertions, 31 deletions
diff --git a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/tags/README.md b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/tags/README.md index b954b1f9..907a59fb 100644 --- a/vendor/github.com/grpc-ecosystem/go-grpc-middleware/tags/README.md +++ b/vendor/github.com/grpc-ecosystem/go-grpc-middleware/tags/README.md @@ -68,6 +68,7 @@ _ = grpc.NewServer( - [google.golang.org/grpc/peer](https://godoc.org/google.golang.org/grpc/peer) ## <a name="pkg-index">Index</a> +* [Variables](#pkg-variables) * [func CodeGenRequestFieldExtractor(fullMethod string, req interface{}) map[string]interface{}](#CodeGenRequestFieldExtractor) * [func StreamServerInterceptor(opts ...Option) grpc.StreamServerInterceptor](#StreamServerInterceptor) * [func UnaryServerInterceptor(opts ...Option) grpc.UnaryServerInterceptor](#UnaryServerInterceptor) @@ -77,10 +78,7 @@ _ = grpc.NewServer( * [type RequestFieldExtractorFunc](#RequestFieldExtractorFunc) * [func TagBasedRequestFieldExtractor(tagName string) RequestFieldExtractorFunc](#TagBasedRequestFieldExtractor) * [type Tags](#Tags) - * [func Extract(ctx context.Context) \*Tags](#Extract) - * [func (t \*Tags) Has(key string) bool](#Tags.Has) - * [func (t \*Tags) Set(key string, value interface{}) \*Tags](#Tags.Set) - * [func (t \*Tags) Values() map[string]interface{}](#Tags.Values) + * [func Extract(ctx context.Context) Tags](#Extract) #### <a name="pkg-examples">Examples</a> * [Package (InitialisationWithOptions)](#example__initialisationWithOptions) @@ -89,6 +87,15 @@ _ = grpc.NewServer( #### <a name="pkg-files">Package files</a> [context.go](./context.go) [doc.go](./doc.go) [fieldextractor.go](./fieldextractor.go) [interceptors.go](./interceptors.go) [options.go](./options.go) +## <a name="pkg-variables">Variables</a> +``` go +var ( + + // NoopTags is a trivial, minimum overhead implementation of Tags for which all operations are no-ops. + NoopTags = &noopTags{} +) +``` + ## <a name="CodeGenRequestFieldExtractor">func</a> [CodeGenRequestFieldExtractor](./fieldextractor.go#L23) ``` go func CodeGenRequestFieldExtractor(fullMethod string, req interface{}) map[string]interface{} @@ -141,7 +148,7 @@ Keys and values will be added to the context tags of the request. If there are n func TagBasedRequestFieldExtractor(tagName string) RequestFieldExtractorFunc ``` TagBasedRequestFieldExtractor is a function that relies on Go struct tags to export log fields from requests. -These are usualy coming from a protoc-plugin, such as Gogo protobuf. +These are usually coming from a protoc-plugin, such as Gogo protobuf. message Metadata { repeated string tags = 1 [ (gogoproto.moretags) = "log_field:\"meta_tags\"" ]; @@ -149,40 +156,27 @@ These are usualy coming from a protoc-plugin, such as Gogo protobuf. The tagName is configurable using the tagName variable. Here it would be "log_field". -## <a name="Tags">type</a> [Tags](./context.go#L17-L19) +## <a name="Tags">type</a> [Tags](./context.go#L19-L27) ``` go -type Tags struct { - // contains filtered or unexported fields +type Tags interface { + // Set sets the given key in the metadata tags. + Set(key string, value interface{}) Tags + // Has checks if the given key exists. + Has(key string) bool + // Values returns a map of key to values. + // Do not modify the underlying map, please use Set instead. + Values() map[string]interface{} } ``` -Tags is the struct used for storing request tags between Context calls. -This object is *not* thread safe, and should be handled only in the context of the request. +Tags is the interface used for storing request tags between Context calls. +The default implementation is *not* thread safe, and should be handled only in the context of the request. -### <a name="Extract">func</a> [Extract](./context.go#L41) +### <a name="Extract">func</a> [Extract](./context.go#L63) ``` go -func Extract(ctx context.Context) *Tags +func Extract(ctx context.Context) Tags ``` Extracts returns a pre-existing Tags object in the Context. If the context wasn't set in a tag interceptor, a no-op Tag storage is returned that will *not* be propagated in context. -### <a name="Tags.Has">func</a> (\*Tags) [Has](./context.go#L28) -``` go -func (t *Tags) Has(key string) bool -``` -Has checks if the given key exists. - -### <a name="Tags.Set">func</a> (\*Tags) [Set](./context.go#L22) -``` go -func (t *Tags) Set(key string, value interface{}) *Tags -``` -Set sets the given key in the metadata tags. - -### <a name="Tags.Values">func</a> (\*Tags) [Values](./context.go#L35) -``` go -func (t *Tags) Values() map[string]interface{} -``` -Values returns a map of key to values. -Do not modify the underlying map, please use Set instead. - - - - Generated by [godoc2ghmd](https://github.com/GandalfUK/godoc2ghmd)
\ No newline at end of file |