Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
NoopTags = &noopTags{}
)
Functions ¶
Types ¶
type Tags ¶
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
// Get returns value of given key
Get(key string) interface{}
// Values returns a map of key to values.
// Do not modify the underlying map, please use Set instead.
Values() map[string]interface{}
// Foreach some kind like visitor pattern , each element pair will call f func
// and if accept return with error , the whole Foreach will return error
// it some kind like each implementation in ruby https://ruby-doc.org/core-2.7.2/Hash.html#method-i-each
// todo, require to review the necessary of Foreach to return error
Foreach(f func(key string, val interface{}) error) error
Len() int
}
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.
func FromContext ¶
FromContext 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.
Click to show internal directories.
Click to hide internal directories.